Shorten DotDebugLocEntry to just DebugLocEntry and reformat.

No functional change.

llvm-svn: 204102
This commit is contained in:
Eric Christopher 2014-03-18 02:18:24 +00:00
parent 8287aff1cc
commit 05135fb468
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.
void DIEHash::hashLocList(const DIELocList &LocList) {
SmallVectorImpl<DotDebugLocEntry>::const_iterator Start =
SmallVectorImpl<DebugLocEntry>::const_iterator Start =
AP->getDwarfDebug()->getDebugLocEntries().begin();
Start += LocList.getValue();
HashingByteStreamer Streamer(*this);
for (SmallVectorImpl<DotDebugLocEntry>::const_iterator
for (SmallVectorImpl<DebugLocEntry>::const_iterator
I = Start,
E = AP->getDwarfDebug()->getDebugLocEntries().end();
I != E; ++I) {
const DotDebugLocEntry &Entry = *I;
const DebugLocEntry &Entry = *I;
// Go through the entries until we hit the end of the list,
// which is the next empty entry.
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.
static DotDebugLocEntry getDebugLocEntry(AsmPrinter *Asm,
static DebugLocEntry getDebugLocEntry(AsmPrinter *Asm,
const MCSymbol *FLabel,
const MCSymbol *SLabel,
const MachineInstr *MI) {
@ -1178,14 +1178,14 @@ static DotDebugLocEntry getDebugLocEntry(AsmPrinter *Asm,
MLoc.set(MI->getOperand(0).getReg());
else
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())
return DotDebugLocEntry(FLabel, SLabel, MI->getOperand(0).getImm());
return DebugLocEntry(FLabel, SLabel, MI->getOperand(0).getImm());
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())
return DotDebugLocEntry(FLabel, SLabel, MI->getOperand(0).getCImm());
return DebugLocEntry(FLabel, SLabel, MI->getOperand(0).getCImm());
llvm_unreachable("Unexpected 3 operand DBG_VALUE instruction!");
}
@ -1278,7 +1278,7 @@ DwarfDebug::collectVariableInfo(SmallPtrSet<const MDNode *, 16> &Processed) {
DotDebugLocEntries.push_back(
getDebugLocEntry(Asm, FLabel, SLabel, Begin));
}
DotDebugLocEntries.push_back(DotDebugLocEntry());
DotDebugLocEntries.push_back(DebugLocEntry());
}
// Collect info for variables that were optimized out.
@ -2296,7 +2296,7 @@ void DwarfDebug::emitDebugStr() {
}
void DwarfDebug::emitDebugLocEntry(ByteStreamer &Streamer,
const DotDebugLocEntry &Entry) {
const DebugLocEntry &Entry) {
DIVariable DV(Entry.getVariable());
if (Entry.isInt()) {
DIBasicType BTy(DV.getType());
@ -2359,11 +2359,11 @@ void DwarfDebug::emitDebugLoc() {
if (DotDebugLocEntries.empty())
return;
for (SmallVectorImpl<DotDebugLocEntry>::iterator
for (SmallVectorImpl<DebugLocEntry>::iterator
I = DotDebugLocEntries.begin(),
E = DotDebugLocEntries.end();
I != E; ++I) {
DotDebugLocEntry &Entry = *I;
DebugLocEntry &Entry = *I;
if (I + 1 != DotDebugLocEntries.end())
Entry.Merge(I + 1);
}
@ -2374,11 +2374,11 @@ void DwarfDebug::emitDebugLoc() {
unsigned char Size = Asm->getDataLayout().getPointerSize();
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
unsigned index = 1;
for (SmallVectorImpl<DotDebugLocEntry>::const_iterator
for (SmallVectorImpl<DebugLocEntry>::const_iterator
I = DotDebugLocEntries.begin(),
E = DotDebugLocEntries.end();
I != E; ++I, ++index) {
const DotDebugLocEntry &Entry = *I;
const DebugLocEntry &Entry = *I;
if (Entry.isMerged())
continue;

View File

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