diff options
| author | Adrian Prantl <aprantl@apple.com> | 2015-03-02 20:01:54 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2015-03-02 20:01:54 +0000 |
| commit | 2185aa179d4c169c08fd8950aeba8373521cca63 (patch) | |
| tree | 1f28c92b4ff9d2ef88b44d3d8a958fec088b0719 /llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | |
| parent | abb9192652318abfb70f6956f104f9af3665f310 (diff) | |
| download | bcm5719-llvm-2185aa179d4c169c08fd8950aeba8373521cca63.tar.gz bcm5719-llvm-2185aa179d4c169c08fd8950aeba8373521cca63.zip | |
Revert "Refactor DebugLocDWARFExpression so it doesn't require access to the"
This reverts commit 230975 to investigate buildbot breakage.
llvm-svn: 231004
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index eae42daefa6..fcab067424e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -22,6 +22,14 @@ using namespace llvm; +const TargetRegisterInfo *DwarfExpression::getTRI() const { + return AP.TM.getSubtargetImpl()->getRegisterInfo(); +} + +unsigned DwarfExpression::getDwarfVersion() const { + return AP.getDwarfDebug()->getDwarfVersion(); +} + void DwarfExpression::AddReg(int DwarfReg, const char *Comment) { assert(DwarfReg >= 0 && "invalid negative dwarf register number"); if (DwarfReg < 32) { @@ -66,7 +74,7 @@ void DwarfExpression::AddShr(unsigned ShiftBy) { } bool DwarfExpression::AddMachineRegIndirect(unsigned MachineReg, int Offset) { - int DwarfReg = TRI.getDwarfRegNum(MachineReg, false); + int DwarfReg = getTRI()->getDwarfRegNum(MachineReg, false); if (DwarfReg < 0) return false; @@ -83,10 +91,11 @@ bool DwarfExpression::AddMachineRegIndirect(unsigned MachineReg, int Offset) { bool DwarfExpression::AddMachineRegPiece(unsigned MachineReg, unsigned PieceSizeInBits, unsigned PieceOffsetInBits) { - if (!TRI.isPhysicalRegister(MachineReg)) + const TargetRegisterInfo *TRI = getTRI(); + if (!TRI->isPhysicalRegister(MachineReg)) return false; - int Reg = TRI.getDwarfRegNum(MachineReg, false); + int Reg = TRI->getDwarfRegNum(MachineReg, false); // If this is a valid register number, emit it. if (Reg >= 0) { @@ -98,12 +107,12 @@ bool DwarfExpression::AddMachineRegPiece(unsigned MachineReg, // Walk up the super-register chain until we find a valid number. // For example, EAX on x86_64 is a 32-bit piece of RAX with offset 0. - for (MCSuperRegIterator SR(MachineReg, &TRI); SR.isValid(); ++SR) { - Reg = TRI.getDwarfRegNum(*SR, false); + for (MCSuperRegIterator SR(MachineReg, TRI); SR.isValid(); ++SR) { + Reg = TRI->getDwarfRegNum(*SR, false); if (Reg >= 0) { - unsigned Idx = TRI.getSubRegIndex(*SR, MachineReg); - unsigned Size = TRI.getSubRegIdxSize(Idx); - unsigned RegOffset = TRI.getSubRegIdxOffset(Idx); + unsigned Idx = TRI->getSubRegIndex(*SR, MachineReg); + unsigned Size = TRI->getSubRegIdxSize(Idx); + unsigned RegOffset = TRI->getSubRegIdxOffset(Idx); AddReg(Reg, "super-register"); if (PieceOffsetInBits == RegOffset) { AddOpPiece(Size, RegOffset); @@ -127,15 +136,15 @@ bool DwarfExpression::AddMachineRegPiece(unsigned MachineReg, // efficient DW_OP_piece. unsigned CurPos = PieceOffsetInBits; // The size of the register in bits, assuming 8 bits per byte. - unsigned RegSize = TRI.getMinimalPhysRegClass(MachineReg)->getSize() * 8; + unsigned RegSize = TRI->getMinimalPhysRegClass(MachineReg)->getSize() * 8; // Keep track of the bits in the register we already emitted, so we // can avoid emitting redundant aliasing subregs. SmallBitVector Coverage(RegSize, false); - for (MCSubRegIterator SR(MachineReg, &TRI); SR.isValid(); ++SR) { - unsigned Idx = TRI.getSubRegIndex(MachineReg, *SR); - unsigned Size = TRI.getSubRegIdxSize(Idx); - unsigned Offset = TRI.getSubRegIdxOffset(Idx); - Reg = TRI.getDwarfRegNum(*SR, false); + for (MCSubRegIterator SR(MachineReg, TRI); SR.isValid(); ++SR) { + unsigned Idx = TRI->getSubRegIndex(MachineReg, *SR); + unsigned Size = TRI->getSubRegIdxSize(Idx); + unsigned Offset = TRI->getSubRegIdxOffset(Idx); + Reg = TRI->getDwarfRegNum(*SR, false); // Intersection between the bits we already emitted and the bits // covered by this subregister. @@ -171,7 +180,7 @@ void DwarfExpression::AddSignedConstant(int Value) { // value, so the producers and consumers started to rely on heuristics // to disambiguate the value vs. location status of the expression. // See PR21176 for more details. - if (DwarfVersion >= 4) + if (getDwarfVersion() >= 4) EmitOp(dwarf::DW_OP_stack_value); } @@ -179,7 +188,7 @@ void DwarfExpression::AddUnsignedConstant(unsigned Value) { EmitOp(dwarf::DW_OP_constu); EmitUnsigned(Value); // cf. comment in DwarfExpression::AddSignedConstant(). - if (DwarfVersion >= 4) + if (getDwarfVersion() >= 4) EmitOp(dwarf::DW_OP_stack_value); } |

