I'm not sure why these wrappers are here rather than just exposing the contained DataLayout
Details
Diff Detail
Event Timeline
include/llvm/Target/TargetMachine.h | ||
---|---|---|
141–155 | Can we skip the default =0 for these? If I remember correclty there are FIXME comments in DataLayout about removing the defaults in DataLayout. I think the idea is that people often forget to provide the correct address space. If an address space is mandatory one needs to motivate at a specific call site if it for example is correct to always use 0 instead of looking up the address space for the type. The amount of call sites where it always is correct to use a hard-coded 0 is probably very few. |
include/llvm/Target/TargetMachine.h | ||
---|---|---|
141–155 | I would like to remove the default, but the context where this was used I don't see where the pointer is coming from (i.e. a few places AsmPrinter). I'm doing this because it seems like the TargetMachine is the natural place to check the pointer size in GlobalISel's LegalizeInfo |
include/llvm/Target/TargetMachine.h | ||
---|---|---|
141–155 | My idea was to, for example, replace all old calls to this method into: |
Remove default. I did my best to guess at the context these were used for. Some of the DebugInfo ones are questionable, as well as AsmPrinter::getPointerSize
Thanks Matt! I like this version without the default argument.
I think your guesses about correct address spaces are as good as mine. But I'm not 100% sure about a few diffs where we now use the "program AS" instead of AS=0. See my inline comments.
lib/CodeGen/AsmPrinter/AsmPrinter.cpp | ||
---|---|---|
218–220 | As far as I can see this determines size of dwarf::DW_FORM_ref_addr for DWARF2, as it is used from DIEInteger::SizeOf(). In DWARF2 DW_FORM_ref_addr was (confusingly) defined as being the size of an address on the target machine. Not sure what that means if there are several address spaces with different sizes on the target machine. In our out-of-tree-target (a DSP) we have getPointerSize(0) != getProgramPointerSize(). Although we do not use DWARF2, so I do not think it really matter for us... You could play it safe and simply do TM.getPointerSize(0), to avoid any functional change in this patch. But using TM.getProgramPointerSize() might actually be more correct. I do not really know. | |
984 | Seems reasonable to me. | |
lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | ||
1529–1530 | Maybe one needs to inspect Ty here to really find out which address space that should be used. |
lib/CodeGen/AsmPrinter/AsmPrinter.cpp | ||
---|---|---|
218–220 | I think this needs getDWARFAddressSpace, but that may need a mapping to the target address space |
Can we skip the default =0 for these?
If I remember correclty there are FIXME comments in DataLayout about removing the defaults in DataLayout. I think the idea is that people often forget to provide the correct address space. If an address space is mandatory one needs to motivate at a specific call site if it for example is correct to always use 0 instead of looking up the address space for the type. The amount of call sites where it always is correct to use a hard-coded 0 is probably very few.