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)
commit64c1e1803311610e359e26a5f0ece867f0dabd3e
tree22620fa3ecae9704f9f85544565445b5c52c7e24
parent2dfdfdf45c4c26a628527a542d9c4deaaf300ea1
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.

llvm-svn: 210062
42 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/IR/GlobalAlias.h
llvm/include/llvm/IR/GlobalObject.h
llvm/include/llvm/IR/GlobalValue.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/Globals.cpp
llvm/lib/IR/Value.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/LTO/LTOModule.cpp
llvm/lib/Linker/LinkModules.cpp
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/lib/Target/XCore/XCoreISelLowering.cpp
llvm/lib/Transforms/Utils/CloneModule.cpp
llvm/test/Assembler/addrspacecast-alias.ll
llvm/test/Assembler/alias-addrspace.ll [deleted file]
llvm/test/Assembler/alias-to-alias.ll [deleted file]
llvm/test/Assembler/alias-to-alias2.ll [deleted file]
llvm/test/Assembler/alias-type.ll [deleted file]
llvm/test/Bitcode/old-aliases.ll
llvm/test/CodeGen/ARM/aliases.ll
llvm/test/CodeGen/X86/aliases.ll
llvm/test/CodeGen/X86/dllexport-x86_64.ll
llvm/test/Feature/alias2.ll
llvm/test/Feature/aliases.ll
llvm/test/Linker/Inputs/PR8300.b.ll
llvm/test/Linker/Inputs/alias.ll
llvm/test/Linker/Inputs/cycle.ll [deleted file]
llvm/test/Linker/alias.ll
llvm/test/Linker/cycle.ll [deleted file]
llvm/test/Transforms/GlobalDCE/2009-01-05-DeadAliases.ll
llvm/test/Transforms/GlobalOpt/2009-02-15-BitcastAlias.ll
llvm/test/Transforms/GlobalOpt/alias-resolve.ll
llvm/test/Transforms/InstCombine/bitcast-alias-function.ll
llvm/test/Verifier/alias.ll
llvm/test/Verifier/bitcast-alias-address-space.ll [new file with mode: 0644]
llvm/tools/llvm-nm/llvm-nm.cpp
llvm/unittests/IR/ConstantsTest.cpp