diff options
Diffstat (limited to 'lib/MC/MCParser/AsmParser.cpp')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index aac020d17e..2ccea786c7 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/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 |