diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-11-25 15:14:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-11-25 15:14:49 +0000 |
commit | f4f14f68f6078ea6681ee27b5bf42719d7db3441 (patch) | |
tree | 008861973146b0c72963fbaec75f7e9cb8c64798 /lib/MC/MCParser | |
parent | a91eead943d9016fd25f92ab723d8e44ead34109 (diff) | |
download | llvm-f4f14f68f6078ea6681ee27b5bf42719d7db3441.tar.gz llvm-f4f14f68f6078ea6681ee27b5bf42719d7db3441.tar.bz2 llvm-f4f14f68f6078ea6681ee27b5bf42719d7db3441.tar.xz |
Add support for .cfi_register now that it is easy to extent the representation
to support it. Original patch with the parsing and plumbing by the PaX team and
Roman Divacky. I added the bits in MCDwarf.cpp and the test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 34ebe3b859..106dd53907 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -398,6 +398,8 @@ public: &GenericAsmParser::ParseDirectiveCFISignalFrame>(".cfi_signal_frame"); AddDirectiveHandler< &GenericAsmParser::ParseDirectiveCFIUndefined>(".cfi_undefined"); + AddDirectiveHandler< + &GenericAsmParser::ParseDirectiveCFIRegister>(".cfi_register"); // Macro directives. AddDirectiveHandler<&GenericAsmParser::ParseDirectiveMacrosOnOff>( @@ -436,6 +438,7 @@ public: bool ParseDirectiveCFIEscape(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveCFISignalFrame(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveCFIUndefined(StringRef, SMLoc DirectiveLoc); + bool ParseDirectiveCFIRegister(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveMacrosOnOff(StringRef, SMLoc DirectiveLoc); bool ParseDirectiveMacro(StringRef, SMLoc DirectiveLoc); @@ -3263,6 +3266,29 @@ bool GenericAsmParser::ParseDirectiveCFIUndefined(StringRef Directive, return false; } +/// ParseDirectiveCFIRegister +/// ::= .cfi_register register, register +bool GenericAsmParser::ParseDirectiveCFIRegister(StringRef Directive, + SMLoc DirectiveLoc) { + int64_t Register1 = 0; + + if (ParseRegisterOrRegisterNumber(Register1, DirectiveLoc)) + return true; + + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in directive"); + Lex(); + + int64_t Register2 = 0; + + if (ParseRegisterOrRegisterNumber(Register2, DirectiveLoc)) + return true; + + getStreamer().EmitCFIRegister(Register1, Register2); + + return false; +} + /// ParseDirectiveMacrosOnOff /// ::= .macros_on /// ::= .macros_off |