Make DotDebugLocEntry a class, reorder the members along with comments

for them and update all uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2013-07-03 22:40:18 +00:00
parent 8e2e5ff024
commit 0d0782ae93
2 changed files with 29 additions and 14 deletions

View File

@ -2440,9 +2440,9 @@ void DwarfDebug::emitDebugLoc() {
Asm->OutStreamer.EmitIntValue(0, Size);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
} else {
Asm->OutStreamer.EmitSymbolValue(Entry.Begin, Size);
Asm->OutStreamer.EmitSymbolValue(Entry.End, Size);
DIVariable DV(Entry.Variable);
Asm->OutStreamer.EmitSymbolValue(Entry.getBeginSym(), Size);
Asm->OutStreamer.EmitSymbolValue(Entry.getEndSym(), Size);
DIVariable DV(Entry.getVariable());
Asm->OutStreamer.AddComment("Loc expr size");
MCSymbol *begin = Asm->OutStreamer.getContext().CreateTempSymbol();
MCSymbol *end = Asm->OutStreamer.getContext().CreateTempSymbol();
@ -2464,15 +2464,15 @@ void DwarfDebug::emitDebugLoc() {
} else if (Entry.isLocation()) {
if (!DV.hasComplexAddress())
// Regular entry.
Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
else {
// Complex address entry.
unsigned N = DV.getNumAddrElements();
unsigned i = 0;
if (N >= 2 && DV.getAddrElement(0) == DIBuilder::OpPlus) {
if (Entry.Loc.getOffset()) {
if (Entry.getLoc().getOffset()) {
i = 2;
Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
Asm->OutStreamer.AddComment("DW_OP_deref");
Asm->EmitInt8(dwarf::DW_OP_deref);
Asm->OutStreamer.AddComment("DW_OP_plus_uconst");
@ -2481,12 +2481,12 @@ void DwarfDebug::emitDebugLoc() {
} else {
// If first address element is OpPlus then emit
// DW_OP_breg + Offset instead of DW_OP_reg + Offset.
MachineLocation Loc(Entry.Loc.getReg(), DV.getAddrElement(1));
MachineLocation Loc(Entry.getLoc().getReg(), DV.getAddrElement(1));
Asm->EmitDwarfRegOp(Loc, DV.isIndirect());
i = 2;
}
} else {
Asm->EmitDwarfRegOp(Entry.Loc, DV.isIndirect());
Asm->EmitDwarfRegOp(Entry.getLoc(), DV.isIndirect());
}
// Emit remaining complex address elements.
@ -2496,7 +2496,7 @@ void DwarfDebug::emitDebugLoc() {
Asm->EmitInt8(dwarf::DW_OP_plus_uconst);
Asm->EmitULEB128(DV.getAddrElement(++i));
} else if (Element == DIBuilder::OpDeref) {
if (!Entry.Loc.isReg())
if (!Entry.getLoc().isReg())
Asm->EmitInt8(dwarf::DW_OP_deref);
} else
llvm_unreachable("unknown Opcode found in complex address");

View File

@ -62,12 +62,12 @@ public:
/// \brief This struct describes location entries emitted in the .debug_loc
/// section.
typedef struct DotDebugLocEntry {
class DotDebugLocEntry {
// Begin and end symbols for the address range that this location is valid.
const MCSymbol *Begin;
const MCSymbol *End;
MachineLocation Loc;
const MDNode *Variable;
bool Merged;
// Type of entry that this represents.
enum EntryType {
E_Location,
E_Integer,
@ -81,6 +81,17 @@ typedef struct DotDebugLocEntry {
const ConstantFP *CFP;
const ConstantInt *CIP;
} Constants;
// The location in the machine frame.
MachineLocation Loc;
// The variable to which this location entry corresponds.
const MDNode *Variable;
// Whether this location has been merged.
bool Merged;
public:
DotDebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) {
Constants.Int = 0;
}
@ -124,7 +135,11 @@ typedef struct DotDebugLocEntry {
int64_t getInt() const { return Constants.Int; }
const ConstantFP *getConstantFP() const { return Constants.CFP; }
const ConstantInt *getConstantInt() const { return Constants.CIP; }
} DotDebugLocEntry;
const MDNode *getVariable() const { return Variable; }
const MCSymbol *getBeginSym() const { return Begin; }
const MCSymbol *getEndSym() const { return End; }
MachineLocation getLoc() const { return Loc; }
};
//===----------------------------------------------------------------------===//
/// \brief This class is used to track local variable information.