[llvm-dev] RFC: Absolute or "fixed address" symbols as immediate operands
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 24 13:36:36 PDT 2016
On 10/24/2016 1:07 PM, Peter Collingbourne via llvm-dev wrote:
> On Mon, Oct 10, 2016 at 8:12 PM, Peter Collingbourne <peter at pcc.me.uk
> <mailto:peter at pcc.me.uk>> wrote:
>
> The specific change I have in mind is to allow !range metadata on
> GlobalObjects. This would
> be similar to existing !range metadata, but it would apply to the
> "address" of the attached GlobalObject, rather than any value
> loaded from it. Its presence on a GlobalObject would also imply
> that the address of the GlobalObject is "fixed" at link time.
>
> Going back to IR-level representation: here is an alternative
> representation based on a suggestion from Eli.
>
> Introduce a new type of GlobalValue called GlobalConstant.
> GlobalConstant would fit into the GlobalValue hierarchy like this:
>
> * GlobalValue
> o GlobalConstant
> o GlobalPointer
> + GlobalIndirectSymbol
> # GlobalAlias
> # GlobalIFunc
> + GlobalObject
> # Function
> # GlobalVariable
>
> GlobalValue would no longer be assumed to be of pointer type. The
> getType() overload that takes a PointerType, as well as getValueType()
> would be moved down to GlobalPointer. (A nice side benefit of this is
> that it would help flush out cases where we are unnecessarily
> depending on global pointee types.)
>
> A GlobalConstant can either be a definition or a declaration. A
> definition would look like this:
>
> @foo = globalconst i32 42
This is equivalent to writing "foo = 42" in assembly?
> while a declaration would look like this:
>
> @foo = external globalconst i32
>
> GlobalConstant could also hold a linkage and visibility. Looking at
> the other attributes that a GlobalValue can hold, many of them do not
> seem appropriate for GlobalConstant and could potentially be moved to
> GlobalPointer.
>
> Thoughts?
>
How do you plan to use this? The concept makes sense, but I've never
actually seen anyone use symbols this way.
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161024/ac3d0aac/attachment.html>
More information about the llvm-dev
mailing list