[PATCH] D44162: TargetMachine: Add address space to getPointerSize

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 07:42:17 PDT 2018


arsenm added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:218
 // (llvm-dsymutil, llvm-dwarfdump).
-unsigned AsmPrinter::getPointerSize() const { return TM.getPointerSize(); }
+unsigned AsmPrinter::getPointerSize() const {
+  return TM.getProgramPointerSize();
----------------
bjope wrote:
> As far as I can see this determines size of dwarf::DW_FORM_ref_addr for DWARF2, as it is used from DIEInteger::SizeOf().
> (It is also used in test code in unittests/DebugInfo/DWARF/DwarfGenerator.cpp)
> 
> 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.
> 
I think this needs getDWARFAddressSpace, but that may need a mapping to the target address space


https://reviews.llvm.org/D44162





More information about the llvm-commits mailing list