aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-11-24 02:01:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-11-24 02:01:08 +0000
commit28c9ea3c13dfb8f6bb3226ba511d189135fcb140 (patch)
tree920b8cdb1cc561bc8b375aadd1d1cffaf78349a5 /lib/MC/MCDwarf.cpp
parent4ccb49a8384d25cfeb65453da059ed1a7a00b5ed (diff)
downloadexternal_llvm-28c9ea3c13dfb8f6bb3226ba511d189135fcb140.zip
external_llvm-28c9ea3c13dfb8f6bb3226ba511d189135fcb140.tar.gz
external_llvm-28c9ea3c13dfb8f6bb3226ba511d189135fcb140.tar.bz2
Refactor how MCCFIInstructions are created.
Give MCCFIInstruction a single, private constructor and add helper static methods that create each type of cfi instruction. This is is preparation for changing its representation. The representation with a pair MachineLocations older than MC and has been abused quiet a bit to support more cfi instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCDwarf.cpp')
-rw-r--r--lib/MC/MCDwarf.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp
index 85b47fe..c9b21e3 100644
--- a/lib/MC/MCDwarf.cpp
+++ b/lib/MC/MCDwarf.cpp
@@ -1264,8 +1264,21 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
TranslateMachineLocation(MRI, Moves[i].getDestination());
const MachineLocation &Src =
TranslateMachineLocation(MRI, Moves[i].getSource());
- MCCFIInstruction Inst(Label, Dst, Src);
- Instructions.push_back(Inst);
+
+ if (Dst.isReg()) {
+ assert(Dst.getReg() == MachineLocation::VirtualFP);
+ assert(!Src.isReg());
+ MCCFIInstruction Inst =
+ MCCFIInstruction::createDefCfa(Label, Src.getReg(), -Src.getOffset());
+ Instructions.push_back(Inst);
+ } else {
+ assert(Src.isReg());
+ unsigned Reg = Src.getReg();
+ int Offset = Dst.getOffset();
+ MCCFIInstruction Inst =
+ MCCFIInstruction::createCFIOffset(Label, Reg, Offset);
+ Instructions.push_back(Inst);
+ }
}
EmitCFIInstructions(streamer, Instructions, NULL);