[llvm-commits] [llvm] r129296 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 11 13:29:16 PDT 2011
Author: rafael
Date: Mon Apr 11 15:29:16 2011
New Revision: 129296
URL: http://llvm.org/viewvc/llvm-project?rev=129296&view=rev
Log:
implement .cfi_adjust_cfa_offset.
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=129296&r1=129295&r2=129296&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Mon Apr 11 15:29:16 2011
@@ -80,6 +80,7 @@
SourceMgr &SrcMgr;
MCAsmParserExtension *GenericParser;
MCAsmParserExtension *PlatformParser;
+ int64_t LastOffset;
/// This is the current buffer index we're lexing from as managed by the
/// SourceMgr object.
@@ -140,6 +141,14 @@
/// }
+ int64_t adjustLastOffset(int64_t Adjustment) {
+ LastOffset += Adjustment;
+ return LastOffset;
+ }
+ void setLastOffset(int64_t Offset) {
+ LastOffset = Offset;
+ }
+
private:
void CheckForValidSection();
@@ -251,6 +260,8 @@
".cfi_def_cfa");
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIDefCfaOffset>(
".cfi_def_cfa_offset");
+ AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIAdjustCfaOffset>(
+ ".cfi_adjust_cfa_offset");
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIDefCfaRegister>(
".cfi_def_cfa_register");
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveCFIOffset>(
@@ -287,6 +298,7 @@
bool ParseDirectiveCFIEndProc(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIDefCfa(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIDefCfaOffset(StringRef, SMLoc DirectiveLoc);
+ bool ParseDirectiveCFIAdjustCfaOffset(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIDefCfaRegister(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIOffset(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIPersonalityOrLsda(StringRef, SMLoc DirectiveLoc);
@@ -315,7 +327,7 @@
AsmParser::AsmParser(const Target &T, SourceMgr &_SM, MCContext &_Ctx,
MCStreamer &_Out, const MCAsmInfo &_MAI)
: Lexer(_MAI), Ctx(_Ctx), Out(_Out), SrcMgr(_SM),
- GenericParser(new GenericAsmParser), PlatformParser(0),
+ GenericParser(new GenericAsmParser), PlatformParser(0), LastOffset(0),
CurBuffer(0), MacrosEnabled(true) {
Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer));
@@ -2309,6 +2321,21 @@
if (getParser().ParseAbsoluteExpression(Offset))
return true;
+ getParser().setLastOffset(Offset);
+
+ return getStreamer().EmitCFIDefCfaOffset(Offset);
+}
+
+/// ParseDirectiveCFIAdjustCfaOffset
+/// ::= .cfi_adjust_cfa_offset adjustment
+bool GenericAsmParser::ParseDirectiveCFIAdjustCfaOffset(StringRef,
+ SMLoc DirectiveLoc) {
+ int64_t Adjustment = 0;
+ if (getParser().ParseAbsoluteExpression(Adjustment))
+ return true;
+
+ int64_t Offset = getParser().adjustLastOffset(Adjustment);
+
return getStreamer().EmitCFIDefCfaOffset(Offset);
}
More information about the llvm-commits
mailing list