Skip to content

Commit

Permalink
DebugInfo: Drop rest of DIDescriptor subclasses
Browse files Browse the repository at this point in the history
Delete the remaining subclasses of (the already deleted) `DIDescriptor`.
Part of PR23080.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235404 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dexonsmith committed Apr 21, 2015
1 parent 43eab6b commit 7f89271
Show file tree
Hide file tree
Showing 28 changed files with 124 additions and 287 deletions.
11 changes: 4 additions & 7 deletions bindings/go/llvm/DIBuilderBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
DIBuilder *D = unwrap(Dref);
DIVariable V = D->createLocalVariable(
return wrap(D->createLocalVariable(
Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo);
return wrap(V);
unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo));
}

LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
Expand Down Expand Up @@ -182,8 +181,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
int64_t Lo, int64_t Count) {
DIBuilder *D = unwrap(Dref);
DISubrange S = D->getOrCreateSubrange(Lo, Count);
return wrap(S);
return wrap(D->getOrCreateSubrange(Lo, Count));
}

LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
Expand All @@ -209,8 +207,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
int64_t *Addr, size_t Length) {
DIBuilder *D = unwrap(Dref);
DIExpression Expr = D->createExpression(ArrayRef<int64_t>(Addr, Length));
return wrap(Expr);
return wrap(D->createExpression(ArrayRef<int64_t>(Addr, Length)));
}

LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/CodeGen/MachineInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ class MachineInstr : public ilist_node<MachineInstr> {

/// \brief Return the debug variable referenced by
/// this DBG_VALUE instruction.
DIVariable getDebugVariable() const {
const MDLocalVariable *getDebugVariable() const {
assert(isDebugValue() && "not a DBG_VALUE");
return cast<MDLocalVariable>(getOperand(2).getMetadata());
}

/// \brief Return the complex address expression referenced by
/// this DBG_VALUE instruction.
DIExpression getDebugExpression() const {
const MDExpression *getDebugExpression() const {
assert(isDebugValue() && "not a DBG_VALUE");
return cast<MDExpression>(getOperand(3).getMetadata());
}
Expand Down
10 changes: 5 additions & 5 deletions include/llvm/CodeGen/MachineInstrBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class MachineInstrBuilder {
MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
assert((MI->isDebugValue() ? static_cast<bool>(MI->getDebugVariable())
: true) &&
"first MDNode argument of a DBG_VALUE not a DIVariable");
"first MDNode argument of a DBG_VALUE not a variable");
return *this;
}

Expand Down Expand Up @@ -356,8 +356,8 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
const MCInstrDesc &MCID, bool IsIndirect,
unsigned Reg, unsigned Offset,
const MDNode *Variable, const MDNode *Expr) {
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
assert(isa<MDLocalVariable>(Variable) && "not a variable");
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
"Expected inlined-at fields to agree");
if (IsIndirect)
Expand Down Expand Up @@ -385,8 +385,8 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
const MCInstrDesc &MCID, bool IsIndirect,
unsigned Reg, unsigned Offset,
const MDNode *Variable, const MDNode *Expr) {
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
assert(isa<MDLocalVariable>(Variable) && "not a variable");
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
MachineFunction &MF = *BB.getParent();
MachineInstr *MI =
BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);
Expand Down
157 changes: 1 addition & 156 deletions include/llvm/IR/DebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,167 +46,12 @@ class NamedMDNode;
class LLVMContext;
class raw_ostream;

class DIVariable;
class DIObjCProperty;

/// \brief Maps from type identifier to the actual MDNode.
typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;

#define DECLARE_SIMPLIFY_DESCRIPTOR(DESC) \
class DESC; \
template <> struct simplify_type<const DESC>; \
template <> struct simplify_type<DESC>;
DECLARE_SIMPLIFY_DESCRIPTOR(DISubrange)
DECLARE_SIMPLIFY_DESCRIPTOR(DIEnumerator)
DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
DECLARE_SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
DECLARE_SIMPLIFY_DESCRIPTOR(DIVariable)
DECLARE_SIMPLIFY_DESCRIPTOR(DIExpression)
DECLARE_SIMPLIFY_DESCRIPTOR(DILocation)
DECLARE_SIMPLIFY_DESCRIPTOR(DIObjCProperty)
DECLARE_SIMPLIFY_DESCRIPTOR(DIImportedEntity)
#undef DECLARE_SIMPLIFY_DESCRIPTOR

typedef DebugNodeArray DIArray;
typedef MDTypeRefArray DITypeArray;

class DISubrange {
MDSubrange *N;

public:
DISubrange(const MDSubrange *N = nullptr) : N(const_cast<MDSubrange *>(N)) {}

operator MDSubrange *() const { return N; }
MDSubrange *operator->() const { return N; }
MDSubrange &operator*() const { return *N; }
};

class DIEnumerator {
MDEnumerator *N;

public:
DIEnumerator(const MDEnumerator *N = nullptr)
: N(const_cast<MDEnumerator *>(N)) {}

operator MDEnumerator *() const { return N; }
MDEnumerator *operator->() const { return N; }
MDEnumerator &operator*() const { return *N; }
};

class DITemplateTypeParameter {
MDTemplateTypeParameter *N;

public:
DITemplateTypeParameter(const MDTemplateTypeParameter *N = nullptr)
: N(const_cast<MDTemplateTypeParameter *>(N)) {}

operator MDTemplateTypeParameter *() const { return N; }
MDTemplateTypeParameter *operator->() const { return N; }
MDTemplateTypeParameter &operator*() const { return *N; }
};

class DITemplateValueParameter {
MDTemplateValueParameter *N;

public:
DITemplateValueParameter(const MDTemplateValueParameter *N = nullptr)
: N(const_cast<MDTemplateValueParameter *>(N)) {}

operator MDTemplateValueParameter *() const { return N; }
MDTemplateValueParameter *operator->() const { return N; }
MDTemplateValueParameter &operator*() const { return *N; }
};

class DIGlobalVariable {
MDGlobalVariable *N;

public:
DIGlobalVariable(const MDGlobalVariable *N = nullptr)
: N(const_cast<MDGlobalVariable *>(N)) {}

operator MDGlobalVariable *() const { return N; }
MDGlobalVariable *operator->() const { return N; }
MDGlobalVariable &operator*() const { return *N; }
};

class DIVariable {
MDLocalVariable *N;

public:
DIVariable(const MDLocalVariable *N = nullptr)
: N(const_cast<MDLocalVariable *>(N)) {}

operator MDLocalVariable *() const { return N; }
MDLocalVariable *operator->() const { return N; }
MDLocalVariable &operator*() const { return *N; }
};

class DIExpression {
MDExpression *N;

public:
DIExpression(const MDExpression *N = nullptr)
: N(const_cast<MDExpression *>(N)) {}

operator MDExpression *() const { return N; }
MDExpression *operator->() const { return N; }
MDExpression &operator*() const { return *N; }
};

class DILocation {
MDLocation *N;

public:
DILocation(const MDLocation *N = nullptr) : N(const_cast<MDLocation *>(N)) {}

operator MDLocation *() const { return N; }
MDLocation *operator->() const { return N; }
MDLocation &operator*() const { return *N; }
};

class DIObjCProperty {
MDObjCProperty *N;

public:
DIObjCProperty(const MDObjCProperty *N = nullptr)
: N(const_cast<MDObjCProperty *>(N)) {}

operator MDObjCProperty *() const { return N; }
MDObjCProperty *operator->() const { return N; }
MDObjCProperty &operator*() const { return *N; }
};

class DIImportedEntity {
MDImportedEntity *N;

public:
DIImportedEntity(const MDImportedEntity *N = nullptr)
: N(const_cast<MDImportedEntity *>(N)) {}

operator MDImportedEntity *() const { return N; }
MDImportedEntity *operator->() const { return N; }
MDImportedEntity &operator*() const { return *N; }
};

#define SIMPLIFY_DESCRIPTOR(DESC) \
template <> struct simplify_type<const DESC> { \
typedef Metadata *SimpleType; \
static SimpleType getSimplifiedValue(const DESC &DI) { return DI; } \
}; \
template <> struct simplify_type<DESC> : simplify_type<const DESC> {};
SIMPLIFY_DESCRIPTOR(DISubrange)
SIMPLIFY_DESCRIPTOR(DIEnumerator)
SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
SIMPLIFY_DESCRIPTOR(DIVariable)
SIMPLIFY_DESCRIPTOR(DIExpression)
SIMPLIFY_DESCRIPTOR(DILocation)
SIMPLIFY_DESCRIPTOR(DIObjCProperty)
SIMPLIFY_DESCRIPTOR(DIImportedEntity)
#undef SIMPLIFY_DESCRIPTOR

/// \brief Find subprogram that is enclosing this scope.
MDSubprogram *getDISubprogram(const MDNode *Scope);

Expand Down Expand Up @@ -251,7 +96,7 @@ class DebugInfoFinder {
void processDeclare(const Module &M, const DbgDeclareInst *DDI);
/// \brief Process DbgValueInst.
void processValue(const Module &M, const DbgValueInst *DVI);
/// \brief Process DILocation.
/// \brief Process debug info location.
void processLocation(const Module &M, const MDLocation *Loc);

/// \brief Clear all lists.
Expand Down
2 changes: 1 addition & 1 deletion lib/Analysis/ModuleDebugInfoPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
O << '\n';
}

for (DIGlobalVariable GV : Finder.global_variables()) {
for (const MDGlobalVariable *GV : Finder.global_variables()) {
O << "Global variable: " << GV->getName();
printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
if (!GV->getLinkageName().empty())
Expand Down
4 changes: 2 additions & 2 deletions lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,15 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
raw_svector_ostream OS(Str);
OS << "DEBUG_VALUE: ";

DIVariable V = MI->getDebugVariable();
const MDLocalVariable *V = MI->getDebugVariable();
if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) {
StringRef Name = SP->getDisplayName();
if (!Name.empty())
OS << Name << ":";
}
OS << V->getName();

DIExpression Expr = MI->getDebugExpression();
const MDExpression *Expr = MI->getDebugExpression();
if (Expr->isBitPiece())
OS << " [bit_piece offset=" << Expr->getBitPieceOffset()
<< " size=" << Expr->getBitPieceSize() << "]";
Expand Down
2 changes: 1 addition & 1 deletion lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
// Use the base variable (without any DW_OP_piece expressions)
// as index into History. The full variables including the
// piece expressions are attached to the MI.
MDLocalVariable *RawVar = MI.getDebugVariable();
const MDLocalVariable *RawVar = MI.getDebugVariable();
assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
"Expected inlined-at fields to agree");
InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());
Expand Down
7 changes: 3 additions & 4 deletions lib/CodeGen/AsmPrinter/DebugLocEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DebugLocEntry {
const ConstantInt *getConstantInt() const { return Constant.CIP; }
MachineLocation getLoc() const { return Loc; }
bool isBitPiece() const { return getExpression()->isBitPiece(); }
DIExpression getExpression() const { return Expression; }
const MDExpression *getExpression() const { return Expression; }
friend bool operator==(const Value &, const Value &);
friend bool operator<(const Value &, const Value &);
};
Expand All @@ -94,9 +94,8 @@ class DebugLocEntry {
/// Return true if the merge was successful.
bool MergeValues(const DebugLocEntry &Next) {
if (Begin == Next.Begin) {
DIExpression Expr = cast_or_null<MDExpression>(Values[0].Expression);
DIExpression NextExpr =
cast_or_null<MDExpression>(Next.Values[0].Expression);
auto *Expr = cast_or_null<MDExpression>(Values[0].Expression);
auto *NextExpr = cast_or_null<MDExpression>(Next.Values[0].Expression);
if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
addValues(Next.Values);
End = Next.End;
Expand Down
11 changes: 6 additions & 5 deletions lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
}

/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
const MDGlobalVariable *GV) {
// Check for pre-existence.
if (DIE *Die = getDIE(GV))
return Die;
Expand Down Expand Up @@ -632,7 +633,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
}

std::unique_ptr<DIE>
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) {
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
insertDIE(Module, IMDie.get());
DIE *EntityDie;
Expand Down Expand Up @@ -687,8 +688,8 @@ void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) {
if (!SPDIE)
SPDIE = getDIE(SP);
assert(SPDIE);
for (DIVariable DV : Variables) {
DbgVariable NewVar(DV, nullptr, DIExpression(), DD);
for (const MDLocalVariable *DV : Variables) {
DbgVariable NewVar(DV, /* IA */ nullptr, /* Expr */ nullptr, DD);
auto VariableDie = constructVariableDIE(NewVar);
applyVariableAttributes(NewVar, *VariableDie);
SPDIE->addChild(std::move(VariableDie));
Expand Down Expand Up @@ -763,7 +764,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
assert(DV.getExpression().size() == 1);
DIExpression Expr = DV.getExpression().back();
const MDExpression *Expr = DV.getExpression().back();
bool ValidReg;
if (Location.getOffset()) {
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
Expand Down
4 changes: 2 additions & 2 deletions lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DwarfCompileUnit : public DwarfUnit {
void applyStmtList(DIE &D);

/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
DIE *getOrCreateGlobalVariableDIE(DIGlobalVariable GV);
DIE *getOrCreateGlobalVariableDIE(const MDGlobalVariable *GV);

/// addLabelAddress - Add a dwarf label attribute data and value using
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
Expand Down Expand Up @@ -156,7 +156,7 @@ class DwarfCompileUnit : public DwarfUnit {

/// \brief Construct import_module DIE.
std::unique_ptr<DIE>
constructImportedEntityDIE(const DIImportedEntity &Module);
constructImportedEntityDIE(const MDImportedEntity *Module);

void finishSubprogramDefinition(const MDSubprogram *SP);

Expand Down
Loading

0 comments on commit 7f89271

Please sign in to comment.