Shorten DotDebugLocEntry to just DebugLocEntry and reformat.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204102 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-03-18 02:18:24 +00:00
parent c5b39af329
commit b005e96324
3 changed files with 27 additions and 33 deletions

View File

@ -283,15 +283,15 @@ void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue *> &Values) {
// Hash the contents of a loclistptr class. // Hash the contents of a loclistptr class.
void DIEHash::hashLocList(const DIELocList &LocList) { void DIEHash::hashLocList(const DIELocList &LocList) {
SmallVectorImpl<DotDebugLocEntry>::const_iterator Start = SmallVectorImpl<DebugLocEntry>::const_iterator Start =
AP->getDwarfDebug()->getDebugLocEntries().begin(); AP->getDwarfDebug()->getDebugLocEntries().begin();
Start += LocList.getValue(); Start += LocList.getValue();
HashingByteStreamer Streamer(*this); HashingByteStreamer Streamer(*this);
for (SmallVectorImpl<DotDebugLocEntry>::const_iterator for (SmallVectorImpl<DebugLocEntry>::const_iterator
I = Start, I = Start,
E = AP->getDwarfDebug()->getDebugLocEntries().end(); E = AP->getDwarfDebug()->getDebugLocEntries().end();
I != E; ++I) { I != E; ++I) {
const DotDebugLocEntry &Entry = *I; const DebugLocEntry &Entry = *I;
// Go through the entries until we hit the end of the list, // Go through the entries until we hit the end of the list,
// which is the next empty entry. // which is the next empty entry.
if (Entry.isEmpty()) if (Entry.isEmpty())

View File

@ -1163,7 +1163,7 @@ static bool isDbgValueInDefinedReg(const MachineInstr *MI) {
} }
// Get .debug_loc entry for the instruction range starting at MI. // Get .debug_loc entry for the instruction range starting at MI.
static DotDebugLocEntry getDebugLocEntry(AsmPrinter *Asm, static DebugLocEntry getDebugLocEntry(AsmPrinter *Asm,
const MCSymbol *FLabel, const MCSymbol *FLabel,
const MCSymbol *SLabel, const MCSymbol *SLabel,
const MachineInstr *MI) { const MachineInstr *MI) {
@ -1178,14 +1178,14 @@ static DotDebugLocEntry getDebugLocEntry(AsmPrinter *Asm,
MLoc.set(MI->getOperand(0).getReg()); MLoc.set(MI->getOperand(0).getReg());
else else
MLoc.set(MI->getOperand(0).getReg(), MI->getOperand(1).getImm()); MLoc.set(MI->getOperand(0).getReg(), MI->getOperand(1).getImm());
return DotDebugLocEntry(FLabel, SLabel, MLoc, Var); return DebugLocEntry(FLabel, SLabel, MLoc, Var);
} }
if (MI->getOperand(0).isImm()) if (MI->getOperand(0).isImm())
return DotDebugLocEntry(FLabel, SLabel, MI->getOperand(0).getImm()); return DebugLocEntry(FLabel, SLabel, MI->getOperand(0).getImm());
if (MI->getOperand(0).isFPImm()) if (MI->getOperand(0).isFPImm())
return DotDebugLocEntry(FLabel, SLabel, MI->getOperand(0).getFPImm()); return DebugLocEntry(FLabel, SLabel, MI->getOperand(0).getFPImm());
if (MI->getOperand(0).isCImm()) if (MI->getOperand(0).isCImm())
return DotDebugLocEntry(FLabel, SLabel, MI->getOperand(0).getCImm()); return DebugLocEntry(FLabel, SLabel, MI->getOperand(0).getCImm());
llvm_unreachable("Unexpected 3 operand DBG_VALUE instruction!"); llvm_unreachable("Unexpected 3 operand DBG_VALUE instruction!");
} }
@ -1278,7 +1278,7 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
DotDebugLocEntries.push_back( DotDebugLocEntries.push_back(
getDebugLocEntry(Asm, FLabel, SLabel, Begin)); getDebugLocEntry(Asm, FLabel, SLabel, Begin));
} }
DotDebugLocEntries.push_back(DotDebugLocEntry()); DotDebugLocEntries.push_back(DebugLocEntry());
} }
// Collect info for variables that were optimized out. // Collect info for variables that were optimized out.
@ -2296,7 +2296,7 @@ void DwarfDebug::emitDebugStr() {
} }
void DwarfDebug::emitDebugLocEntry(ByteStreamer &Streamer, void DwarfDebug::emitDebugLocEntry(ByteStreamer &Streamer,
const DotDebugLocEntry &Entry) { const DebugLocEntry &Entry) {
DIVariable DV(Entry.getVariable()); DIVariable DV(Entry.getVariable());
if (Entry.isInt()) { if (Entry.isInt()) {
DIBasicType BTy(DV.getType()); DIBasicType BTy(DV.getType());
@ -2359,11 +2359,11 @@ void DwarfDebug::emitDebugLoc() {
if (DotDebugLocEntries.empty()) if (DotDebugLocEntries.empty())
return; return;
for (SmallVectorImpl<DotDebugLocEntry>::iterator for (SmallVectorImpl<DebugLocEntry>::iterator
I = DotDebugLocEntries.begin(), I = DotDebugLocEntries.begin(),
E = DotDebugLocEntries.end(); E = DotDebugLocEntries.end();
I != E; ++I) { I != E; ++I) {
DotDebugLocEntry &Entry = *I; DebugLocEntry &Entry = *I;
if (I + 1 != DotDebugLocEntries.end()) if (I + 1 != DotDebugLocEntries.end())
Entry.Merge(I + 1); Entry.Merge(I + 1);
} }
@ -2374,11 +2374,11 @@ void DwarfDebug::emitDebugLoc() {
unsigned char Size = Asm->getDataLayout().getPointerSize(); unsigned char Size = Asm->getDataLayout().getPointerSize();
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0)); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
unsigned index = 1; unsigned index = 1;
for (SmallVectorImpl<DotDebugLocEntry>::const_iterator for (SmallVectorImpl<DebugLocEntry>::const_iterator
I = DotDebugLocEntries.begin(), I = DotDebugLocEntries.begin(),
E = DotDebugLocEntries.end(); E = DotDebugLocEntries.end();
I != E; ++I, ++index) { I != E; ++I, ++index) {
const DotDebugLocEntry &Entry = *I; const DebugLocEntry &Entry = *I;
if (Entry.isMerged()) if (Entry.isMerged())
continue; continue;

View File

@ -68,18 +68,13 @@ public:
/// \brief This struct describes location entries emitted in the .debug_loc /// \brief This struct describes location entries emitted in the .debug_loc
/// section. /// section.
class DotDebugLocEntry { class DebugLocEntry {
// Begin and end symbols for the address range that this location is valid. // Begin and end symbols for the address range that this location is valid.
const MCSymbol *Begin; const MCSymbol *Begin;
const MCSymbol *End; const MCSymbol *End;
// Type of entry that this represents. // Type of entry that this represents.
enum EntryType { enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };
E_Location,
E_Integer,
E_ConstantFP,
E_ConstantInt
};
enum EntryType EntryKind; enum EntryType EntryKind;
union { union {
@ -98,27 +93,26 @@ class DotDebugLocEntry {
bool Merged; bool Merged;
public: public:
DotDebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) { DebugLocEntry() : Begin(0), End(0), Variable(0), Merged(false) {
Constants.Int = 0; Constants.Int = 0;
} }
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L, DebugLocEntry(const MCSymbol *B, const MCSymbol *E, MachineLocation &L,
const MDNode *V) const MDNode *V)
: Begin(B), End(E), Loc(L), Variable(V), Merged(false) { : Begin(B), End(E), Loc(L), Variable(V), Merged(false) {
Constants.Int = 0; Constants.Int = 0;
EntryKind = E_Location; EntryKind = E_Location;
} }
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i) DebugLocEntry(const MCSymbol *B, const MCSymbol *E, int64_t i)
: Begin(B), End(E), Variable(0), Merged(false) { : Begin(B), End(E), Variable(0), Merged(false) {
Constants.Int = i; Constants.Int = i;
EntryKind = E_Integer; EntryKind = E_Integer;
} }
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr) DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantFP *FPtr)
: Begin(B), End(E), Variable(0), Merged(false) { : Begin(B), End(E), Variable(0), Merged(false) {
Constants.CFP = FPtr; Constants.CFP = FPtr;
EntryKind = E_ConstantFP; EntryKind = E_ConstantFP;
} }
DotDebugLocEntry(const MCSymbol *B, const MCSymbol *E, DebugLocEntry(const MCSymbol *B, const MCSymbol *E, const ConstantInt *IPtr)
const ConstantInt *IPtr)
: Begin(B), End(E), Variable(0), Merged(false) { : Begin(B), End(E), Variable(0), Merged(false) {
Constants.CIP = IPtr; Constants.CIP = IPtr;
EntryKind = E_ConstantInt; EntryKind = E_ConstantInt;
@ -128,7 +122,7 @@ public:
/// labels are referenced is used to find debug_loc offset for a given DIE. /// labels are referenced is used to find debug_loc offset for a given DIE.
bool isEmpty() const { return Begin == 0 && End == 0; } bool isEmpty() const { return Begin == 0 && End == 0; }
bool isMerged() const { return Merged; } bool isMerged() const { return Merged; }
void Merge(DotDebugLocEntry *Next) { void Merge(DebugLocEntry *Next) {
if (!(Begin && Loc == Next->Loc && End == Next->Begin)) if (!(Begin && Loc == Next->Loc && End == Next->Begin))
return; return;
Next->Begin = Begin; Next->Begin = Begin;
@ -383,8 +377,8 @@ class DwarfDebug : public AsmPrinterHandler {
// Collection of abstract variables. // Collection of abstract variables.
DenseMap<const MDNode *, DbgVariable *> AbstractVariables; DenseMap<const MDNode *, DbgVariable *> AbstractVariables;
// Collection of DotDebugLocEntry. // Collection of DebugLocEntry.
SmallVector<DotDebugLocEntry, 4> DotDebugLocEntries; SmallVector<DebugLocEntry, 4> DotDebugLocEntries;
// Collection of subprogram DIEs that are marked (at the end of the module) // Collection of subprogram DIEs that are marked (at the end of the module)
// as DW_AT_inline. // as DW_AT_inline.
@ -769,13 +763,13 @@ public:
MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; } MCSymbol *getDebugLocSym() const { return DwarfDebugLocSectionSym; }
/// Returns the entries for the .debug_loc section. /// Returns the entries for the .debug_loc section.
const SmallVectorImpl<DotDebugLocEntry> &getDebugLocEntries() const { const SmallVectorImpl<DebugLocEntry> &getDebugLocEntries() const {
return DotDebugLocEntries; return DotDebugLocEntries;
} }
/// \brief Emit an entry for the debug loc section. This can be used to /// \brief Emit an entry for the debug loc section. This can be used to
/// handle an entry that's going to be emitted into the debug loc section. /// handle an entry that's going to be emitted into the debug loc section.
void emitDebugLocEntry(ByteStreamer &Streamer, const DotDebugLocEntry &Entry); void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocEntry &Entry);
/// Find the MDNode for the given reference. /// Find the MDNode for the given reference.
template <typename T> T resolve(DIRef<T> Ref) const { template <typename T> T resolve(DIRef<T> Ref) const {