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

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 11:56:45 PST 2018


bjope added inline comments.


================
Comment at: include/llvm/Target/TargetMachine.h:141
   /// This is the only time the DataLayout in the TargetMachine is used.
-  unsigned getPointerSize() const { return DL.getPointerSize(); }
+  unsigned getPointerSize(unsigned AS = 0) const {
+    return DL.getPointerSize(AS);
----------------
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.


https://reviews.llvm.org/D44162





More information about the llvm-commits mailing list