This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen/AccelTable] Add the "sizetype" synthetic type to the accelerator table
ClosedPublic

Authored by labath on Apr 9 2018, 9:11 AM.

Details

Summary

This type is created on-demand and used as the base type for array
ranges. Since it is "special", its construction did not go through the
createTypeDIE function and so it was never inserted into the accelerator
table, although it clearly belongs there.

I add an explicit addAccelType call to insert it into the table.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Apr 9 2018, 9:11 AM
labath added inline comments.Apr 9 2018, 9:15 AM
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
1407 ↗(On Diff #141669)

Another interesting question is whether we shouldn't rename this to something more unique (_Sizetype ?). As it stands now, if a user has his own sizetype defined, lldb will get confused and will not be able to differentiate the two. Gcc emits this type as "unsigned long", but doing that is a bit trickier for us as we don't want to assume a particular front-end here.

JDevlieghere added inline comments.Apr 10 2018, 2:24 AM
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
1407 ↗(On Diff #141669)

Let's use a double underscore then as that's reserved for the compilers internal use. I think both GCC and LLVM define the macro __SIZE_TYPE__, but I don't know if it's worth to repurpose that for this.

labath updated this revision to Diff 141820.Apr 10 2018, 3:44 AM

I don't think repurpusing the SIZE_TYPE name is a good idea, because it may
give off the impression that this type *is* the compiler's SIZE_TYPE type,
but in reality, we don't even try to match it's definition. Also, right now the
compiler's SIZE_TYPE does not seem to make it into debug info, but if that
ever changes, then we will have the multiple definition problem again.

So I think this should be really unique. Right now, the best name I came up with
is ARRAY_SIZE_TYPE.

JDevlieghere accepted this revision.Apr 10 2018, 3:53 AM

Sounds reasonable. LGTM!

This revision is now accepted and ready to land.Apr 10 2018, 3:53 AM
This revision was automatically updated to reflect the committed changes.