[llvm-commits] First patch to add support for variable address spaces to optimizers

Eli Friedman eli.friedman at gmail.com
Wed Oct 10 13:38:17 PDT 2012


On Wed, Oct 10, 2012 at 1:27 PM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> This patch starts enabling proper use of the variable address space throughout LLVM.
> What this does is when it is known, it passes in the address space to the data layout for some functions.
> The next patch will contain the more intrusive changes of getIntPtrType/get*PtrTy/getPointerTy.

I'm sort of uncomfortable with the number of places you're hardcoding
"0"; can you add a function to DataLayout with a more explanatory
name?

Index: include/llvm-c/Target.h
===================================================================
--- include/llvm-c/Target.h	(revision 165622)
+++ include/llvm-c/Target.h	(working copy)
@@ -170,7 +170,7 @@

 /** Returns the pointer size in bytes for a target.
     See the method llvm::DataLayout::getPointerSize. */
-unsigned LLVMPointerSize(LLVMTargetDataRef);
+unsigned LLVMPointerSize(LLVMTargetDataRef, unsigned AS);

This change isn't acceptable; the C API is stable.  Add a new function
if necessary.

   /// FIXME: The defaults need to be removed once all of
   /// the backends/clients are updated.
-  unsigned getPointerSizeInBits(unsigned AS = 0)    const {
+  unsigned getPointerSizeInBits(unsigned AS)    const {

Get rid of the outdated FIXMEs.

-Eli



More information about the llvm-commits mailing list