mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-30 06:19:45 +00:00
LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.
No other functionality changes, DIBuilder testcase is included in a paired CFE commit. This relaxes the assertion in isScopeRef to also accept subclasses of DIScope. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205279 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -663,7 +663,7 @@ namespace llvm {
|
|||||||
/// variable
|
/// variable
|
||||||
/// @param Line Line number
|
/// @param Line Line number
|
||||||
DIImportedEntity createImportedDeclaration(DIScope Context,
|
DIImportedEntity createImportedDeclaration(DIScope Context,
|
||||||
DIDescriptor Decl,
|
DIScope Decl,
|
||||||
unsigned Line);
|
unsigned Line);
|
||||||
|
|
||||||
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
||||||
|
@@ -783,7 +783,7 @@ class DIImportedEntity : public DIDescriptor {
|
|||||||
public:
|
public:
|
||||||
explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
|
explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
|
||||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||||
DIDescriptor getEntity() const { return getFieldAs<DIDescriptor>(2); }
|
DIScopeRef getEntity() const { return getFieldAs<DIScopeRef>(2); }
|
||||||
unsigned getLineNumber() const { return getUnsignedField(3); }
|
unsigned getLineNumber() const { return getUnsignedField(3); }
|
||||||
StringRef getName() const { return getStringField(4); }
|
StringRef getName() const { return getStringField(4); }
|
||||||
bool Verify() const;
|
bool Verify() const;
|
||||||
|
@@ -794,7 +794,7 @@ void DwarfDebug::constructImportedEntityDIE(DwarfCompileUnit *TheCU,
|
|||||||
DIE *IMDie = new DIE(Module.getTag());
|
DIE *IMDie = new DIE(Module.getTag());
|
||||||
TheCU->insertDIE(Module, IMDie);
|
TheCU->insertDIE(Module, IMDie);
|
||||||
DIE *EntityDie;
|
DIE *EntityDie;
|
||||||
DIDescriptor Entity = Module.getEntity();
|
DIDescriptor Entity = resolve(Module.getEntity());
|
||||||
if (Entity.isNameSpace())
|
if (Entity.isNameSpace())
|
||||||
EntityDie = TheCU->getOrCreateNameSpace(DINameSpace(Entity));
|
EntityDie = TheCU->getOrCreateNameSpace(DINameSpace(Entity));
|
||||||
else if (Entity.isSubprogram())
|
else if (Entity.isSubprogram())
|
||||||
|
@@ -190,12 +190,12 @@ DIImportedEntity DIBuilder::createImportedModule(DIScope Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
|
DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
|
||||||
DIDescriptor Decl,
|
DIScope Decl,
|
||||||
unsigned Line) {
|
unsigned Line) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(VMContext, dwarf::DW_TAG_imported_declaration),
|
GetTagConstant(VMContext, dwarf::DW_TAG_imported_declaration),
|
||||||
Context,
|
Context,
|
||||||
Decl,
|
Decl.getRef(),
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
|
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
|
||||||
};
|
};
|
||||||
DIImportedEntity M(MDNode::get(VMContext, Elts));
|
DIImportedEntity M(MDNode::get(VMContext, Elts));
|
||||||
|
@@ -430,7 +430,7 @@ static bool fieldIsTypeRef(const MDNode *DbgNode, unsigned Elt) {
|
|||||||
static bool isScopeRef(const Value *Val) {
|
static bool isScopeRef(const Value *Val) {
|
||||||
return !Val ||
|
return !Val ||
|
||||||
(isa<MDString>(Val) && !cast<MDString>(Val)->getString().empty()) ||
|
(isa<MDString>(Val) && !cast<MDString>(Val)->getString().empty()) ||
|
||||||
(isa<MDNode>(Val) && DIScope(cast<MDNode>(Val)).isScope());
|
isa<MDNode>(Val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a field at position Elt of a MDNode can be a ScopeRef.
|
/// Check if a field at position Elt of a MDNode can be a ScopeRef.
|
||||||
@@ -1016,7 +1016,7 @@ void DebugInfoFinder::processModule(const Module &M) {
|
|||||||
DIArray Imports = CU.getImportedEntities();
|
DIArray Imports = CU.getImportedEntities();
|
||||||
for (unsigned i = 0, e = Imports.getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = Imports.getNumElements(); i != e; ++i) {
|
||||||
DIImportedEntity Import = DIImportedEntity(Imports.getElement(i));
|
DIImportedEntity Import = DIImportedEntity(Imports.getElement(i));
|
||||||
DIDescriptor Entity = Import.getEntity();
|
DIDescriptor Entity = Import.getEntity().resolve(TypeIdentifierMap);
|
||||||
if (Entity.isType())
|
if (Entity.isType())
|
||||||
processType(DIType(Entity));
|
processType(DIType(Entity));
|
||||||
else if (Entity.isSubprogram())
|
else if (Entity.isSubprogram())
|
||||||
|
Reference in New Issue
Block a user