diff options
author | Jim Laskey <jlaskey@mac.com> | 2007-01-24 18:45:13 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2007-01-24 18:45:13 +0000 |
commit | 5e73d5bd2e98afda12fa69a7ea83050c69be0d34 (patch) | |
tree | 0b1ab52ac594e70591f43d7d8847aee36dfb27bf /lib/CodeGen/DwarfWriter.cpp | |
parent | 7cce0ac42b6bb2fbbbadb542a0b589bd6db7de2e (diff) |
Repair debug frames as a prelude to eh_frames. Switched to using MachineMoves
by value so that clean up is less confusing (these vectors tend to be small.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/DwarfWriter.cpp | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index bdf91fda06..5d9720ba29 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -2112,16 +2112,25 @@ private: /// EmitFrameMoves - Emit frame instructions to describe the layout of the /// frame. void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, - std::vector<MachineMove *> &Moves) { + std::vector<MachineMove> &Moves) { + int stackGrowth = + Asm->TM.getFrameInfo()->getStackGrowthDirection() == + TargetFrameInfo::StackGrowsUp ? + TAI->getAddressSize() : -TAI->getAddressSize(); + for (unsigned i = 0, N = Moves.size(); i < N; ++i) { - MachineMove *Move = Moves[i]; - unsigned LabelID = DebugInfo->MappedLabel(Move->getLabelID()); + MachineMove &Move = Moves[i]; + unsigned LabelID = Move.getLabelID(); - // Throw out move if the label is invalid. - if (!LabelID) continue; + if (LabelID) { + LabelID = DebugInfo->MappedLabel(LabelID); - const MachineLocation &Dst = Move->getDestination(); - const MachineLocation &Src = Move->getSource(); + // Throw out move if the label is invalid. + if (!LabelID) continue; + } + + const MachineLocation &Dst = Move.getDestination(); + const MachineLocation &Src = Move.getSource(); // Advance row if new location. if (BaseLabel && LabelID && BaseLabelID != LabelID) { @@ -2134,11 +2143,6 @@ private: BaseLabel = "loc"; } - int stackGrowth = - Asm->TM.getFrameInfo()->getStackGrowthDirection() == - TargetFrameInfo::StackGrowsUp ? - TAI->getAddressSize() : -TAI->getAddressSize(); - // If advancing cfa. if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) { if (!Src.isRegister()) { @@ -2159,6 +2163,16 @@ private: } else { assert(0 && "Machine move no supported yet."); } + } else if (Src.isRegister() && + Src.getRegister() == MachineLocation::VirtualFP) { + if (Dst.isRegister()) { + EmitInt8(DW_CFA_def_cfa_register); + EOL("DW_CFA_def_cfa_register"); + EmitULEB128Bytes(RI->getDwarfRegNum(Dst.getRegister())); + EOL("Register"); + } else { + assert(0 && "Machine move no supported yet."); + } } else { unsigned Reg = RI->getDwarfRegNum(Src.getRegister()); int Offset = Dst.getOffset() / stackGrowth; @@ -2433,10 +2447,9 @@ private: EmitSLEB128Bytes(stackGrowth); EOL("CIE Data Alignment Factor"); EmitInt8(RI->getDwarfRegNum(RI->getRARegister())); EOL("CIE RA Column"); - std::vector<MachineMove *> Moves; + std::vector<MachineMove> Moves; RI->getInitialFrameState(Moves); EmitFrameMoves(NULL, 0, Moves); - for (unsigned i = 0, N = Moves.size(); i < N; ++i) delete Moves[i]; Asm->EmitAlignment(2); EmitLabel("frame_common_end", 0); @@ -2467,7 +2480,7 @@ private: "func_begin", SubprogramCount); EOL("FDE address range"); - std::vector<MachineMove *> &Moves = DebugInfo->getFrameMoves(); + std::vector<MachineMove> &Moves = DebugInfo->getFrameMoves(); EmitFrameMoves("func_begin", SubprogramCount, Moves); |