summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-04-12 15:31:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-04-12 15:31:05 +0000
commit2e1c9d218878976f0ee94b5b39335cf9c8287b36 (patch)
tree28fb86c447b5cb5145b3e5a9a7d9fddf5601af57 /llvm/lib
parenta0f6ecb01f6320b73e2a285066320d2f6ea6d69d (diff)
downloadbcm5719-llvm-2e1c9d218878976f0ee94b5b39335cf9c8287b36.tar.gz
bcm5719-llvm-2e1c9d218878976f0ee94b5b39335cf9c8287b36.zip
Implement .cfi_same_value.
llvm-svn: 129361
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp6
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp17
-rw-r--r--llvm/lib/MC/MCStreamer.cpp9
3 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 112d7d887a2..5ee0b30243c 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -493,6 +493,12 @@ static void EmitCFIInstruction(MCStreamer &Streamer,
case MCCFIInstruction::Restore:
Streamer.EmitIntValue(dwarf::DW_CFA_restore_state, 1);
return;
+ case MCCFIInstruction::SameValue: {
+ unsigned Reg = Instr.getDestination().getReg();
+ Streamer.EmitIntValue(dwarf::DW_CFA_same_value, 1);
+ Streamer.EmitULEB128IntValue(Reg, 1);
+ return;
+ }
}
llvm_unreachable("Unhandled case in switch");
}
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 418b5101514..c4a83e5df90 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -283,6 +283,8 @@ public:
&GenericAsmParser::ParseDirectiveCFIRememberState>(".cfi_remember_state");
AddDirectiveHandler<
&GenericAsmParser::ParseDirectiveCFIRestoreState>(".cfi_restore_state");
+ AddDirectiveHandler<
+ &GenericAsmParser::ParseDirectiveCFISameValue>(".cfi_same_value");
// Macro directives.
AddDirectiveHandler<&GenericAsmParser::ParseDirectiveMacrosOnOff>(
@@ -314,6 +316,7 @@ public:
bool ParseDirectiveCFIPersonalityOrLsda(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIRememberState(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveCFIRestoreState(StringRef, SMLoc DirectiveLoc);
+ bool ParseDirectiveCFISameValue(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveMacrosOnOff(StringRef, SMLoc DirectiveLoc);
bool ParseDirectiveMacro(StringRef, SMLoc DirectiveLoc);
@@ -2472,6 +2475,20 @@ bool GenericAsmParser::ParseDirectiveCFIRestoreState(StringRef IDVal,
return getStreamer().EmitCFIRestoreState();
}
+/// ParseDirectiveCFISameValue
+/// ::= .cfi_same_value register
+bool GenericAsmParser::ParseDirectiveCFISameValue(StringRef IDVal,
+ SMLoc DirectiveLoc) {
+ int64_t Register = 0;
+
+ if (ParseRegisterOrRegisterNumber(Register, DirectiveLoc))
+ return true;
+
+ getStreamer().EmitCFISameValue(Register);
+
+ return false;
+}
+
/// ParseDirectiveMacrosOnOff
/// ::= .macros_on
/// ::= .macros_off
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 1bd287b2b5b..3208295296a 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -259,6 +259,15 @@ bool MCStreamer::EmitCFIRestoreState() {
return false;
}
+void MCStreamer::EmitCFISameValue(int64_t Register) {
+ EnsureValidFrame();
+ MCDwarfFrameInfo *CurFrame = getCurrentFrameInfo();
+ MCSymbol *Label = getContext().CreateTempSymbol();
+ EmitLabel(Label);
+ MCCFIInstruction Instruction(MCCFIInstruction::SameValue, Label, Register);
+ CurFrame->Instructions.push_back(Instruction);
+}
+
void MCStreamer::EmitFnStart() {
errs() << "Not implemented yet\n";
abort();
OpenPOWER on IntegriCloud