[llvm-dev] address spaces in llvm
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 18 00:29:07 PDT 2016
On 17 Mar 2016, at 23:06, Mohammad Norouzi via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hi everyone,
>
> There are different address spaces in llvm. Some of them are generic, shared, global, etc.
>
> What is the difference between each of them? And when do we need to use them?
The first address space is the default. This is currently a bit overloaded and assumes that functions and the stack all share the same address space (I have some patches to fix this, but they’ve not been upstreamed because no one else currently needs this functionality).
The next address spaces up to 255 are intended to capture some language-specific behaviour. For example, 1 is used by some front ends to represent garbage-collected pointers with the same representation as pointers in AS 0.
Those from 256 and up are target specific. For example, 256 and 257 on x86 represent gs- and fs-relative addresses and so are commonly used for things like thread-local storage.
David
More information about the llvm-dev
mailing list