diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 02:41:57 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 02:41:57 +0000 |
commit | 2d21b25393a461fbf8ab824889a6c56e1dd0b1cb (patch) | |
tree | 2a66d16ed61fd38a800d76e014bf585fbc454f05 /test/Linker/Inputs | |
parent | 27bd9b361bf11cd6dfe4ea3932adc6afadcf4a86 (diff) | |
download | llvm-2d21b25393a461fbf8ab824889a6c56e1dd0b1cb.tar.gz llvm-2d21b25393a461fbf8ab824889a6c56e1dd0b1cb.tar.bz2 llvm-2d21b25393a461fbf8ab824889a6c56e1dd0b1cb.tar.xz |
Allow alias to point to an arbitrary ConstantExpr.
This 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).
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210062 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Linker/Inputs')
-rw-r--r-- | test/Linker/Inputs/PR8300.b.ll | 2 | ||||
-rw-r--r-- | test/Linker/Inputs/alias.ll | 2 | ||||
-rw-r--r-- | test/Linker/Inputs/cycle.ll | 2 |
3 files changed, 2 insertions, 4 deletions
diff --git a/test/Linker/Inputs/PR8300.b.ll b/test/Linker/Inputs/PR8300.b.ll index 362d309a19..9e538f5d28 100644 --- a/test/Linker/Inputs/PR8300.b.ll +++ b/test/Linker/Inputs/PR8300.b.ll @@ -1,7 +1,7 @@ %foo = type { [8 x i8] } %bar = type { [9 x i8] } -@zed = alias void (%foo*), void (%bar*)* @xyz +@zed = alias bitcast (void (%bar*)* @xyz to void (%foo*)*) define void @xyz(%bar* %this) { entry: diff --git a/test/Linker/Inputs/alias.ll b/test/Linker/Inputs/alias.ll index b869cae71e..f379476e76 100644 --- a/test/Linker/Inputs/alias.ll +++ b/test/Linker/Inputs/alias.ll @@ -1,3 +1,3 @@ @zed = global i32 42 @foo = alias i32* @zed -@foo2 = alias i16, i32* @zed +@foo2 = alias bitcast (i32* @zed to i16*) diff --git a/test/Linker/Inputs/cycle.ll b/test/Linker/Inputs/cycle.ll deleted file mode 100644 index d0eddb6e7c..0000000000 --- a/test/Linker/Inputs/cycle.ll +++ /dev/null @@ -1,2 +0,0 @@ -@foo = alias i32* @bar -@bar = weak global i32 0 |