diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-11-24 02:01:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-11-24 02:01:08 +0000 |
commit | 1c3086cc91473a508a40d12f2f8a231e4b988e54 (patch) | |
tree | 93359ab0b65b51f90657fd51880dce73d797da0f /llvm/lib/MC/MCDwarf.cpp | |
parent | 561e2185178c0ac64cd9b8740cf0e5f5203fe491 (diff) | |
download | bcm5719-llvm-1c3086cc91473a508a40d12f2f8a231e4b988e54.tar.gz bcm5719-llvm-1c3086cc91473a508a40d12f2f8a231e4b988e54.zip |
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.
llvm-svn: 168532
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 85b47fe4379..c9b21e36e51 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/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); |