[patch] Allow alias to point to an arbitrary ConstantExpr

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jun 2 05:36:10 PDT 2014


Rebased patches attached.

On 29 May 2014 12:44, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> Moving from llvm-dev to llvm-commits now that all the dependencies
> have been committed and the direction seems agreed upon.
>
> The attached patch changes GlobalAlias to point to an arbitrary
> ConstantExpr and it is up to MC (or the system assembler) to decide if
> that expression is valid or not.
>
> This reduces our ability to diagnose invalid uses and how early we can
> spot them, but it also lets us do things like
>
> @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
>                                  i32 ptrtoint (i32* @bar to i32)) to i32*)
>
>
> An important implication of this patch is that the notion of aliased
> global doesn't exist any more. The alias has to encode the information
> needed to access it in its metadata (linkage, visibility, type, etc).
>
> The clang patch includes a walk of alias chains, but that should be OK
> since clang knows the form of every alias it creates.
>
> The llvm patch also includes one as a local hack in the old JIT. That
> is hopefully OK since we are about to delete it and it should handle
> as many cases as before.
>
> Another consequence to notice is that getSection has to return a
> "const char *". It could return a NullTerminatedStringRef if there was
> such a thing, but when that was proposed the decision was to just uses
> "const char*" for that.
>
> Cheers,
> Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 49887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140602/59e1ae53/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-patch
Size: 13278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140602/59e1ae53/attachment-0001.bin>


More information about the llvm-commits mailing list