[LLVMdev] [cfe-dev] Extend llvm to fix global addresses

John McCall rjmccall at apple.com
Tue Dec 6 15:54:10 PST 2011


On Dec 6, 2011, at 3:23 PM, David Blaikie wrote:
>> We've spoken to several people who do write drivers and
>> other code like the above, and they seem pretty enthusiastic about the
>> idea.  If you have input about how best to design this, at any of the levels
>> Peter spelled out, that would be interesting.
> 
> I'm curious what the particular benefits/differences would be between
> this language feature & the existing solution (casting constant
> integer values to pointers). This wasn't clear to me from the original
> post.

One thing that comes immediately to mind is that the optimizer would see
loads and stores as affecting a specific global variable and therefore
not aliasing other globals and the heap.

Dereferencing a constant pointer also only really works if you're
memory-mapping.  If you actually need to place data at a fixed address,
it's not good enough, and you'll end up needing some crazy linker magic.
One of our long-term goals is to reduce the need for that.

John.



More information about the llvm-dev mailing list