diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-29 20:24:47 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-12-29 20:24:47 +0000 |
commit | ef4aa35164880ec610155b83fea0a2ccc94d3172 (patch) | |
tree | 80bc7614f2d7c8c3441bf2cbcad64b46a404bc8e /llvm/lib/MC/MCParser | |
parent | 8cab06a214504250cab5b15016606a43553e38e5 (diff) | |
download | bcm5719-llvm-ef4aa35164880ec610155b83fea0a2ccc94d3172.tar.gz bcm5719-llvm-ef4aa35164880ec610155b83fea0a2ccc94d3172.zip |
Implement .cfi_escape. Patch by Brian Anderson!
llvm-svn: 147352
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index aac020d17e8..2ccea786c79 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -301,6 +301,8 @@ public: &GenericAsmParser::ParseDirectiveCFIRestoreState>(".cfi_restore_state"); AddDirectiveHandler< &GenericAsmParser::ParseDirectiveCFISameValue>(".cfi_same_value"); + AddDirectiveHandler< + &GenericAsmParser::ParseDirectiveCFIEscape>(".cfi_escape"); // Macro directives. AddDirectiveHandler<&GenericAsmParser::ParseDirectiveMacrosOnOff>( @@ -334,6 +336,7 @@ public: bool ParseDirectiveCFIRememberState(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveCFIRestoreState(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveCFISameValue(StringRef, SMLoc DirectiveLoc); + bool ParseDirectiveCFIEscape(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveMacrosOnOff(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveMacro(StringRef, SMLoc DirectiveLoc); @@ -2812,6 +2815,30 @@ bool GenericAsmParser::ParseDirectiveCFISameValue(StringRef IDVal, return false; } +/// ParseDirectiveCFIEscape +/// ::= .cfi_escape expression[,...] +bool GenericAsmParser::ParseDirectiveCFIEscape(StringRef IDVal, + SMLoc DirectiveLoc) { + std::string Values; + int64_t CurrValue; + if (getParser().ParseAbsoluteExpression(CurrValue)) + return true; + + Values.push_back((uint8_t)CurrValue); + + while (getLexer().is(AsmToken::Comma)) { + Lex(); + + if (getParser().ParseAbsoluteExpression(CurrValue)) + return true; + + Values.push_back((uint8_t)CurrValue); + } + + getStreamer().EmitCFIEscape(Values); + return false; +} + /// ParseDirectiveMacrosOnOff /// ::= .macros_on /// ::= .macros_off |