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();
} 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");
} 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.
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");
/// \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,
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;
}
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.