Victor Leschuk via llvm-dev
2016-Sep-10 19:50 UTC
[llvm-dev] DebugInfo: purpose of align field
Hello all, I am currently implementing support for DWARFv5 DW_AT_alignment attr and I got a question about align field in debug info section of IR/Bitcode. Currently it is being dumped almost in any case, however according to code we use align from DI* objects only when dealing with class/structure bitfields: DwarfUnit::constructMemberDIE. Dumping align information everywhere only for 1 case looks like overhead to me. Consider the following code: struct S { char c; } s; When compiled with debug enabled in IR we get smth like that: !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 8, align: 8, elements: !7) Am I missing something? What is the purpose of "align: 8" here? Maybe we could include alignment information into DI* objects only when required (and thus dump it only when required): for types with bitfields and when alignas() was specified in code. Please advise. -- Best Regards, Victor
David Majnemer via llvm-dev
2016-Sep-11 00:47 UTC
[llvm-dev] DebugInfo: purpose of align field
We don't really need to emit alignment information for bitfields anymore, we emit enough information in the MD to exactly describe the offset of the storage unit the bitfield is within (DIFlagBitField implies that the extraData field encodes this information). On Sat, Sep 10, 2016 at 12:50 PM, Victor Leschuk via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello all, > > I am currently implementing support for DWARFv5 DW_AT_alignment attr and I > got a question about align field in debug info section of IR/Bitcode. > Currently it is being dumped almost in any case, however according to code > we use align from DI* objects only when dealing with class/structure > bitfields: DwarfUnit::constructMemberDIE. > > Dumping align information everywhere only for 1 case looks like overhead > to me. > > Consider the following code: > > struct S { > char c; > } s; > > When compiled with debug enabled in IR we get smth like that: > > !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", > file: !5, line: 1, size: 8, align: 8, elements: !7) > > Am I missing something? What is the purpose of "align: 8" here? Maybe we > could include alignment information into DI* objects only when required > (and thus dump it only when required): for types with bitfields and when > alignas() was specified in code. > > Please advise. > > -- > Best Regards, > Victor > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160910/5ded2078/attachment.html>
Adrian Prantl via llvm-dev
2016-Sep-12 21:43 UTC
[llvm-dev] DebugInfo: purpose of align field
> On Sep 10, 2016, at 12:50 PM, Victor Leschuk via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello all, > > I am currently implementing support for DWARFv5 DW_AT_alignment attr and I got a question about align field in debug info section of IR/Bitcode.Thanks for looking into this!> Currently it is being dumped almost in any case, however according to code we use align from DI* objects only when dealing with class/structure bitfields: DwarfUnit::constructMemberDIE. > > Dumping align information everywhere only for 1 case looks like overhead to me.One your patch is finished it will be used in more cases, right? :-)> > Consider the following code: > > struct S { > char c; > } s; > > When compiled with debug enabled in IR we get smth like that: > > !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 8, align: 8, elements: !7) > > Am I missing something? What is the purpose of "align: 8" here? Maybe we could include alignment information into DI* objects only when required (and thus dump it only when required): for types with bitfields and when alignas() was specified in code.What do you mean by "include" in this context? Are you arguing for making an alignment of 8 the implicit default in textual IR? Or do you want to make DICompositeType variable length? -- adrian> > Please advise. > > -- > Best Regards, > Victor > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Victor Leschuk via llvm-dev
2016-Sep-30 23:05 UTC
[llvm-dev] DebugInfo: purpose of align field
Hello Adrian, sorry for the delay with the response. Somehow I missed your message.. On 09/13/2016 12:43 AM, Adrian Prantl wrote:>> On Sep 10, 2016, at 12:50 PM, Victor Leschuk via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hello all, >> >> I am currently implementing support for DWARFv5 DW_AT_alignment attr and I got a question about align field in debug info section of IR/Bitcode. > Thanks for looking into this!No problem =)> >> Currently it is being dumped almost in any case, however according to code we use align from DI* objects only when dealing with class/structure bitfields: DwarfUnit::constructMemberDIE. >> >> Dumping align information everywhere only for 1 case looks like overhead to me. > One your patch is finished it will be used in more cases, right? :-)My point is that we dump align information everywhere and it is currently used only in 1 case. I am trying to make it so that it is dumped only when it is necessary.>> Consider the following code: >> >> struct S { >> char c; >> } s; >> >> When compiled with debug enabled in IR we get smth like that: >> >> !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 8, align: 8, elements: !7) >> >> Am I missing something? What is the purpose of "align: 8" here? Maybe we could include alignment information into DI* objects only when required (and thus dump it only when required): for types with bitfields and when alignas() was specified in code. > What do you mean by "include" in this context? Are you arguing for making an alignment of 8 the implicit default in textual IR? Or do you want to make DICompositeType variable length?I mean that in this case alignment isn't used anywhere in code further. I think we don't need alignment information in textual DI IR in case it is not default. Dumping default alignment in every case doesn't make sense for me: if we dump align info each time we need to mark "special" cases with additional flag in order to be able to know which case to "report" in DWARF. If we dump only "forced" alignment, we can just say: "Ok, alignment is specified, we need to put this into DWARF".> > -- adrian > >> Please advise. >> >> -- >> Best Regards, >> Victor >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Best Regards, Victor
Seemingly Similar Threads
- DebugInfo: purpose of align field
- DebugInfo: purpose of align field
- [LLVMdev] `Ty && "Trying to add a type that doesn't exist?
- [DebugInfo] [DWARFv5] .debug_abbrev contents for different implicit_const values
- [LLVMdev] `Ty && "Trying to add a type that doesn't exist?