Allow alias to point to an arbitrary ConstantExpr.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Jun 2014 02:41:57 +0000 (02:41 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Jun 2014 02:41:57 +0000 (02:41 +0000)
commit2d21b25393a461fbf8ab824889a6c56e1dd0b1cb
tree2a66d16ed61fd38a800d76e014bf585fbc454f05
parent27bd9b361bf11cd6dfe4ea3932adc6afadcf4a86
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
42 files changed:
docs/LangRef.rst
include/llvm/IR/GlobalAlias.h
include/llvm/IR/GlobalObject.h
include/llvm/IR/GlobalValue.h
lib/AsmParser/LLParser.cpp
lib/Bitcode/Reader/BitcodeReader.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/ExecutionEngine/JIT/JITEmitter.cpp
lib/IR/AsmWriter.cpp
lib/IR/Core.cpp
lib/IR/Globals.cpp
lib/IR/Value.cpp
lib/IR/Verifier.cpp
lib/LTO/LTOModule.cpp
lib/Linker/LinkModules.cpp
lib/Target/NVPTX/NVPTXAsmPrinter.cpp
lib/Target/XCore/XCoreISelLowering.cpp
lib/Transforms/Utils/CloneModule.cpp
test/Assembler/addrspacecast-alias.ll
test/Assembler/alias-addrspace.ll [deleted file]
test/Assembler/alias-to-alias.ll [deleted file]
test/Assembler/alias-to-alias2.ll [deleted file]
test/Assembler/alias-type.ll [deleted file]
test/Bitcode/old-aliases.ll
test/CodeGen/ARM/aliases.ll
test/CodeGen/X86/aliases.ll
test/CodeGen/X86/dllexport-x86_64.ll
test/Feature/alias2.ll
test/Feature/aliases.ll
test/Linker/Inputs/PR8300.b.ll
test/Linker/Inputs/alias.ll
test/Linker/Inputs/cycle.ll [deleted file]
test/Linker/alias.ll
test/Linker/cycle.ll [deleted file]
test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll
test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
test/Transforms/GlobalOpt/alias-resolve.ll
test/Transforms/InstCombine/bitcast-alias-function.ll
test/Verifier/alias.ll
test/Verifier/bitcast-alias-address-space.ll [new file with mode: 0644]
tools/llvm-nm/llvm-nm.cpp
unittests/IR/ConstantsTest.cpp