[PATCH] D36916: Associate functions with address spaces

David Chisnall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 00:55:00 PDT 2017


theraven added inline comments.


================
Comment at: include/llvm/IR/DerivedTypes.h:106
+  FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs,
+               unsigned AddrSpace);
 
----------------
pcc wrote:
> I don't understand why this needs to be part of the function type. It seems to me that this ought to work in the same way as for global variables, i.e. function takes an address space at construction time which is used to create its pointer type; address space is queried by querying address space on the pointer type.
Indeed.  One of the big differences between the C and LLVM models is that C address spaces are properties of objects whereas LLVM address spaces are properties of pointers.  The LLVM model is cleaner, but associating an address space with a function would be inconsistent.  


https://reviews.llvm.org/D36916





More information about the llvm-commits mailing list