diff options
| author | Kevin Enderby <enderby@apple.com> | 2009-07-14 18:17:10 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2009-07-14 18:17:10 +0000 |
| commit | 4c21caa656839b43f5a1f87a7ca77cfae59937ec (patch) | |
| tree | 45390bddb67e0f0e375ccebd2151ef00d70cae5c /llvm/tools/llvm-mc/AsmParser.cpp | |
| parent | 69ddd05329ad88706bcfb9dafc4434141328b049 (diff) | |
| download | bcm5719-llvm-4c21caa656839b43f5a1f87a7ca77cfae59937ec.tar.gz bcm5719-llvm-4c21caa656839b43f5a1f87a7ca77cfae59937ec.zip | |
Added llvm-mc support for parsing the .desc directive.
llvm-svn: 75645
Diffstat (limited to 'llvm/tools/llvm-mc/AsmParser.cpp')
| -rw-r--r-- | llvm/tools/llvm-mc/AsmParser.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp index c1058016328..d94b7b3270b 100644 --- a/llvm/tools/llvm-mc/AsmParser.cpp +++ b/llvm/tools/llvm-mc/AsmParser.cpp @@ -526,6 +526,8 @@ bool AsmParser::ParseStatement() { return ParseDirectiveComm(/*IsLocal=*/true); if (!strcmp(IDVal, ".zerofill")) return ParseDirectiveDarwinZerofill(); + if (!strcmp(IDVal, ".desc")) + return ParseDirectiveDarwinSymbolDesc(); if (!strcmp(IDVal, ".subsections_via_symbols")) return ParseDirectiveDarwinSubsectionsViaSymbols(); @@ -909,6 +911,37 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { return false; } +/// ParseDirectiveDarwinSymbolDesc +/// ::= .desc identifier , expression +bool AsmParser::ParseDirectiveDarwinSymbolDesc() { + if (Lexer.isNot(asmtok::Identifier)) + return TokError("expected identifier in directive"); + + // handle the identifier as the key symbol. + SMLoc IDLoc = Lexer.getLoc(); + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal()); + Lexer.Lex(); + + if (Lexer.isNot(asmtok::Comma)) + return TokError("unexpected token in '.desc' directive"); + Lexer.Lex(); + + SMLoc DescLoc = Lexer.getLoc(); + int64_t DescValue; + if (ParseAbsoluteExpression(DescValue)) + return true; + + if (Lexer.isNot(asmtok::EndOfStatement)) + return TokError("unexpected token in '.desc' directive"); + + Lexer.Lex(); + + // Set the n_desc field of this Symbol to this DescValue + Out.EmitSymbolDesc(Sym, DescValue); + + return false; +} + /// ParseDirectiveComm /// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ] bool AsmParser::ParseDirectiveComm(bool IsLocal) { |

