[llvm] r193002 - Debug Info: add a newly-created DIE to a parent in the same function.
David Blaikie
dblaikie at gmail.com
Fri Oct 18 15:27:24 PDT 2013
On Fri, Oct 18, 2013 at 3:24 PM, Manman Ren <manman.ren at gmail.com> wrote:
>
> This is a pre-step for cleaning up the DIE construction in CompileUnit.
>
What sort of cleanup do you have in mind? (and I'm not sure - are you
suggesting that my comments aren't applicable to your change?)
>
> Manman
>
>
> On Fri, Oct 18, 2013 at 2:49 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>>
>> On Fri, Oct 18, 2013 at 2:14 PM, Manman Ren <manman.ren at gmail.com> wrote:
>>
>>> Author: mren
>>> Date: Fri Oct 18 16:14:19 2013
>>> New Revision: 193002
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=193002&view=rev
>>> Log:
>>> Debug Info: add a newly-created DIE to a parent in the same function.
>>>
>>
>> Looks OK, but it's a strange change to make in isolation (ie: it's not a
>> code cleanup/improvement). I assume this is in preparation for the cross-CU
>> DIE sharing, in which case, I'd still like to see test coverage for these
>> changes when the cross-CU patch is committed. (ie: within the next few
>> days, I expect to cause test failures if I revert this patch - if that
>> won't be true fairly soon, I'd prefer to revert this patch until that is
>> true)
>>
>>
>>>
>>> With this commit, all DIEs created in CompileUnit will be added to
>>> parents
>>> inside the same function. Also make getOrCreateTemplateType|Value
>>> functions
>>> private.
>>>
>>> No functionality change.
>>>
>>> Modified:
>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=193002&r1=193001&r2=193002&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Oct 18
>>> 16:14:19 2013
>>> @@ -782,11 +782,11 @@ void CompileUnit::addTemplateParams(DIE
>>> for (unsigned i = 0, e = TParams.getNumElements(); i != e; ++i) {
>>> DIDescriptor Element = TParams.getElement(i);
>>> if (Element.isTemplateTypeParameter())
>>> - Buffer.addChild(getOrCreateTemplateTypeParameterDIE(
>>> - DITemplateTypeParameter(Element)));
>>> + getOrCreateTemplateTypeParameterDIE(
>>> + DITemplateTypeParameter(Element), Buffer);
>>> else if (Element.isTemplateValueParameter())
>>> - Buffer.addChild(getOrCreateTemplateValueParameterDIE(
>>> - DITemplateValueParameter(Element)));
>>> + getOrCreateTemplateValueParameterDIE(
>>> + DITemplateValueParameter(Element), Buffer);
>>> }
>>> }
>>>
>>> @@ -1084,10 +1084,8 @@ void CompileUnit::constructTypeDIE(DIE &
>>> for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
>>> DIE *ElemDie = NULL;
>>> DIDescriptor Enum(Elements.getElement(i));
>>> - if (Enum.isEnumerator()) {
>>> - ElemDie = constructEnumTypeDIE(DIEnumerator(Enum));
>>> - Buffer.addChild(ElemDie);
>>> - }
>>> + if (Enum.isEnumerator())
>>> + ElemDie = constructEnumTypeDIE(DIEnumerator(Enum), Buffer);
>>> }
>>> DIType DTy = resolve(CTy.getTypeDerivedFrom());
>>> if (DTy) {
>>> @@ -1161,8 +1159,7 @@ void CompileUnit::constructTypeDIE(DIE &
>>> } else if (DDTy.isStaticMember()) {
>>> ElemDie = getOrCreateStaticMemberDIE(DDTy);
>>> } else {
>>> - ElemDie = createMemberDIE(DDTy);
>>> - Buffer.addChild(ElemDie);
>>> + ElemDie = createMemberDIE(DDTy, Buffer);
>>> }
>>> } else if (Element.isObjCProperty()) {
>>> DIObjCProperty Property(Element);
>>> @@ -1267,12 +1264,14 @@ void CompileUnit::constructTypeDIE(DIE &
>>> /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create
>>> new DIE
>>> /// for the given DITemplateTypeParameter.
>>> DIE *
>>> -CompileUnit::getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter
>>> TP) {
>>> +CompileUnit::getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter
>>> TP,
>>> + DIE &Buffer) {
>>> DIE *ParamDIE = getDIE(TP);
>>> if (ParamDIE)
>>> return ParamDIE;
>>>
>>> ParamDIE = new DIE(dwarf::DW_TAG_template_type_parameter);
>>> + Buffer.addChild(ParamDIE);
>>> // Add the type if it exists, it could be void and therefore no type.
>>> if (TP.getType())
>>> addType(ParamDIE, resolve(TP.getType()));
>>> @@ -1284,12 +1283,14 @@ CompileUnit::getOrCreateTemplateTypePara
>>> /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create
>>> new DIE
>>> /// for the given DITemplateValueParameter.
>>> DIE *
>>> -CompileUnit::getOrCreateTemplateValueParameterDIE(DITemplateValueParameter
>>> VP) {
>>> +CompileUnit::getOrCreateTemplateValueParameterDIE(DITemplateValueParameter
>>> VP,
>>> + DIE &Buffer) {
>>> DIE *ParamDIE = getDIE(VP);
>>> if (ParamDIE)
>>> return ParamDIE;
>>>
>>> ParamDIE = new DIE(VP.getTag());
>>> + Buffer.addChild(ParamDIE);
>>>
>>> // Add the type if there is one, template template and template
>>> parameter
>>> // packs will not have a type.
>>> @@ -1681,8 +1682,9 @@ void CompileUnit::constructArrayTypeDIE(
>>> }
>>>
>>> /// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
>>> -DIE *CompileUnit::constructEnumTypeDIE(DIEnumerator ETy) {
>>> +DIE *CompileUnit::constructEnumTypeDIE(DIEnumerator ETy, DIE &Buffer) {
>>> DIE *Enumerator = new DIE(dwarf::DW_TAG_enumerator);
>>> + Buffer.addChild(Enumerator);
>>> StringRef Name = ETy.getName();
>>> addString(Enumerator, dwarf::DW_AT_name, Name);
>>> int64_t Value = ETy.getEnumValue();
>>> @@ -1779,8 +1781,9 @@ DIE *CompileUnit::constructVariableDIE(D
>>> }
>>>
>>> /// createMemberDIE - Create new member DIE.
>>> -DIE *CompileUnit::createMemberDIE(DIDerivedType DT) {
>>> +DIE *CompileUnit::createMemberDIE(DIDerivedType DT, DIE &Buffer) {
>>> DIE *MemberDie = new DIE(DT.getTag());
>>> + Buffer.addChild(MemberDie);
>>> StringRef Name = DT.getName();
>>> if (!Name.empty())
>>> addString(MemberDie, dwarf::DW_AT_name, Name);
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=193002&r1=193001&r2=193002&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Oct 18
>>> 16:14:19 2013
>>> @@ -290,14 +290,6 @@ public:
>>> /// given DIType.
>>> DIE *getOrCreateTypeDIE(const MDNode *N);
>>>
>>> - /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create
>>> new DIE
>>> - /// for the given DITemplateTypeParameter.
>>> - DIE *getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP);
>>> -
>>> - /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create
>>> - /// new DIE for the given DITemplateValueParameter.
>>> - DIE *getOrCreateTemplateValueParameterDIE(DITemplateValueParameter
>>> TVP);
>>> -
>>> /// getOrCreateContextDIE - Get context owner's DIE.
>>> DIE *getOrCreateContextDIE(DIScope Context);
>>>
>>> @@ -328,10 +320,20 @@ private:
>>> void constructArrayTypeDIE(DIE &Buffer, DICompositeType *CTy);
>>>
>>> /// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
>>> - DIE *constructEnumTypeDIE(DIEnumerator ETy);
>>> + DIE *constructEnumTypeDIE(DIEnumerator ETy, DIE &Buffer);
>>>
>>> /// createMemberDIE - Create new member DIE.
>>> - DIE *createMemberDIE(DIDerivedType DT);
>>> + DIE *createMemberDIE(DIDerivedType DT, DIE &Buffer);
>>> +
>>> + /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create
>>> new DIE
>>> + /// for the given DITemplateTypeParameter.
>>> + DIE *getOrCreateTemplateTypeParameterDIE(DITemplateTypeParameter TP,
>>> + DIE &Buffer);
>>> +
>>> + /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create
>>> + /// new DIE for the given DITemplateValueParameter.
>>> + DIE *getOrCreateTemplateValueParameterDIE(DITemplateValueParameter
>>> TVP,
>>> + DIE &Buffer);
>>>
>>> /// getOrCreateStaticMemberDIE - Create new static data member DIE.
>>> DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131018/15b5a11c/attachment.html>
More information about the llvm-commits
mailing list