[llvm] r205279 - LTO type uniquing: store the Decl field of a DIImportedEntity as a DIRef.
Adrian Prantl
aprantl at apple.com
Tue Apr 1 14:11:11 PDT 2014
r205358.
On Apr 1, 2014, at 1:33 PM, Eric Christopher <echristo at gmail.com> wrote:
> Yeah, that's what I thought.
>
> Mind adding a comment?
>
> -eric
>
> On Tue, Apr 1, 2014 at 1:04 PM, Adrian Prantl <aprantl at apple.com> wrote:
>> Yes, and it's horrible :-)
>> Although DIScope is *implemented* as the parent class of most every DIxxx thing including DIType and its descendants most of DIScope's descendants are not actually subtypes of it. The DIDescriptor::isScope() method only is true for Scopes that are scopes in the strict lexical scope sense (compile_unit, subprogram, etc, ...).
>>
>> IMO the inheritance hierarchy of DIDescriptor is a little messed up.
>>
>> -- adrian
>>
>>
>> On Apr 1, 2014, at 12:32 PM, Eric Christopher <echristo at gmail.com> wrote:
>>
>>> On Mon, Mar 31, 2014 at 8:41 PM, Adrian Prantl <aprantl at apple.com> wrote:
>>>> Author: adrian
>>>> Date: Mon Mar 31 22:41:04 2014
>>>> New Revision: 205279
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=205279&view=rev
>>>> Log:
>>>> 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.
>>>
>>> Verifying: isScope returns false for things derived from scopes that
>>> aren't actually DIScope?
>>>
>>> -eric
>>>
>>>>
>>>> Modified:
>>>> llvm/trunk/include/llvm/IR/DIBuilder.h
>>>> llvm/trunk/include/llvm/IR/DebugInfo.h
>>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> llvm/trunk/lib/IR/DIBuilder.cpp
>>>> llvm/trunk/lib/IR/DebugInfo.cpp
>>>>
>>>> Modified: llvm/trunk/include/llvm/IR/DIBuilder.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DIBuilder.h?rev=205279&r1=205278&r2=205279&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/include/llvm/IR/DIBuilder.h (original)
>>>> +++ llvm/trunk/include/llvm/IR/DIBuilder.h Mon Mar 31 22:41:04 2014
>>>> @@ -663,7 +663,7 @@ namespace llvm {
>>>> /// variable
>>>> /// @param Line Line number
>>>> DIImportedEntity createImportedDeclaration(DIScope Context,
>>>> - DIDescriptor Decl,
>>>> + DIScope Decl,
>>>> unsigned Line);
>>>>
>>>> /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
>>>>
>>>> Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=205279&r1=205278&r2=205279&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
>>>> +++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Mar 31 22:41:04 2014
>>>> @@ -783,7 +783,7 @@ class DIImportedEntity : public DIDescri
>>>> public:
>>>> explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
>>>> 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); }
>>>> StringRef getName() const { return getStringField(4); }
>>>> bool Verify() const;
>>>>
>>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=205279&r1=205278&r2=205279&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
>>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Mar 31 22:41:04 2014
>>>> @@ -794,7 +794,7 @@ void DwarfDebug::constructImportedEntity
>>>> DIE *IMDie = new DIE(Module.getTag());
>>>> TheCU->insertDIE(Module, IMDie);
>>>> DIE *EntityDie;
>>>> - DIDescriptor Entity = Module.getEntity();
>>>> + DIDescriptor Entity = resolve(Module.getEntity());
>>>> if (Entity.isNameSpace())
>>>> EntityDie = TheCU->getOrCreateNameSpace(DINameSpace(Entity));
>>>> else if (Entity.isSubprogram())
>>>>
>>>> Modified: llvm/trunk/lib/IR/DIBuilder.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=205279&r1=205278&r2=205279&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/IR/DIBuilder.cpp (original)
>>>> +++ llvm/trunk/lib/IR/DIBuilder.cpp Mon Mar 31 22:41:04 2014
>>>> @@ -190,12 +190,12 @@ DIImportedEntity DIBuilder::createImport
>>>> }
>>>>
>>>> DIImportedEntity DIBuilder::createImportedDeclaration(DIScope Context,
>>>> - DIDescriptor Decl,
>>>> + DIScope Decl,
>>>> unsigned Line) {
>>>> Value *Elts[] = {
>>>> GetTagConstant(VMContext, dwarf::DW_TAG_imported_declaration),
>>>> Context,
>>>> - Decl,
>>>> + Decl.getRef(),
>>>> ConstantInt::get(Type::getInt32Ty(VMContext), Line),
>>>> };
>>>> DIImportedEntity M(MDNode::get(VMContext, Elts));
>>>>
>>>> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=205279&r1=205278&r2=205279&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
>>>> +++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Mar 31 22:41:04 2014
>>>> @@ -430,7 +430,7 @@ static bool fieldIsTypeRef(const MDNode
>>>> static bool isScopeRef(const Value *Val) {
>>>> return !Val ||
>>>> (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.
>>>> @@ -1016,7 +1016,7 @@ void DebugInfoFinder::processModule(cons
>>>> DIArray Imports = CU.getImportedEntities();
>>>> for (unsigned i = 0, e = Imports.getNumElements(); i != e; ++i) {
>>>> DIImportedEntity Import = DIImportedEntity(Imports.getElement(i));
>>>> - DIDescriptor Entity = Import.getEntity();
>>>> + DIDescriptor Entity = Import.getEntity().resolve(TypeIdentifierMap);
>>>> if (Entity.isType())
>>>> processType(DIType(Entity));
>>>> else if (Entity.isSubprogram())
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
More information about the llvm-commits
mailing list