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/Assembler | |
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/Assembler')
-rw-r--r-- | test/Assembler/addrspacecast-alias.ll | 4 | ||||
-rw-r--r-- | test/Assembler/alias-addrspace.ll | 6 | ||||
-rw-r--r-- | test/Assembler/alias-to-alias.ll | 5 | ||||
-rw-r--r-- | test/Assembler/alias-to-alias2.ll | 7 | ||||
-rw-r--r-- | test/Assembler/alias-type.ll | 6 |
5 files changed, 2 insertions, 26 deletions
diff --git a/test/Assembler/addrspacecast-alias.ll b/test/Assembler/addrspacecast-alias.ll index 052a1414ea..7d00ac4f8f 100644 --- a/test/Assembler/addrspacecast-alias.ll +++ b/test/Assembler/addrspacecast-alias.ll @@ -3,5 +3,5 @@ ; Test that global aliases are allowed to be constant addrspacecast @i = internal addrspace(1) global i8 42 -@ia = alias internal addrspace(2) i8 addrspace(3)*, i8 addrspace(1)* @i -; CHECK: @ia = alias internal addrspace(2) i8 addrspace(3)*, i8 addrspace(1)* @i +@ia = alias internal addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) +; CHECK: @ia = alias internal addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)* addrspace(3)*) diff --git a/test/Assembler/alias-addrspace.ll b/test/Assembler/alias-addrspace.ll deleted file mode 100644 index 6d378e45fa..0000000000 --- a/test/Assembler/alias-addrspace.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: not llvm-as %s 2>&1 | FileCheck %s - -@foo = global i32 42 -@bar = alias internal addrspace(1) i32* @foo - -CHECK: error: A type is required if addrspace is given diff --git a/test/Assembler/alias-to-alias.ll b/test/Assembler/alias-to-alias.ll deleted file mode 100644 index 1ea99bbb69..0000000000 --- a/test/Assembler/alias-to-alias.ll +++ /dev/null @@ -1,5 +0,0 @@ -; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s -; CHECK: Alias must point to function or variable - -@b1 = alias i32* @c1 -@c1 = alias i32* @b1 diff --git a/test/Assembler/alias-to-alias2.ll b/test/Assembler/alias-to-alias2.ll deleted file mode 100644 index a8a0196f43..0000000000 --- a/test/Assembler/alias-to-alias2.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s -; CHECK: error: Alias is pointed by alias b1 - -@g = global i32 42 - -@b1 = alias i32* @c1 -@c1 = alias i32* @g diff --git a/test/Assembler/alias-type.ll b/test/Assembler/alias-type.ll deleted file mode 100644 index ead3e95243..0000000000 --- a/test/Assembler/alias-type.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: not llvm-as %s 2>&1 | FileCheck %s - -@foo = global i32 42 -@bar = alias i32 @foo - -CHECK: error: An alias must have pointer type |