[PATCH] D70947: Add a default address space for globals to DataLayout

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 06:52:53 PST 2020


arsenm added inline comments.


================
Comment at: llvm/docs/LangRef.rst:2059
+``G<address space>``
+    Specifies the address space that should be used for global variables.
+    If omitted, the globals address space defaults to the default address
----------------
arichardson wrote:
> arsenm wrote:
> > The phrasing is a bit wrong. This implies for all global variables. This should maybe be the default address space for globals?
> Possibly something like this? `Specifies the address space to be used by default when creating global variables. If omitted, the globals address space defaults to the default address space 0. Note: variable declarations without an address space are always created in address space 0, this property only affects the default value to be used when creating globals programmatically.`
> 
> I could probably also adjust the parser to use this value as a default but I'm not sure that is desirable.
This is better. I think "when creating globals programmatically" is still a bit misleading. This is really for the case where generic code synthesizes globals out of nothing, and it's not wrong to use a different address space without more context. How about something like "when creating globals without additional contextual information" or something?

Does this actually get used in cases that produce non-constant globals?


================
Comment at: llvm/include/llvm/IR/DataLayout.h:126
   unsigned ProgramAddrSpace;
+  unsigned GlobalsAddrSpace;
 
----------------
Maybe DefaultGlobalsAddrSpace?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70947/new/

https://reviews.llvm.org/D70947





More information about the llvm-commits mailing list