From 68eb509bdc5c7007520d5231cd92de28106236df Mon Sep 17 00:00:00 2001
From: Ed Schouten
Date: Wed, 3 Jun 2009 21:10:15 +0000
Subject: [PATCH] Import LLVM, at r72805, which fixes PR4315 and PR4316.
Normally I'm not updating sources this often, but I want to get rid of
this breakage, because right now I can't offer a proper source snapshot
yet.
---
CMakeLists.txt | 12 +
docs/CMake.html | 4 +
docs/GoldPlugin.html | 30 +++
include/llvm/CodeGen/JITCodeEmitter.h | 66 ++---
include/llvm/CodeGen/MachineCodeEmitter.h | 70 ++---
.../llvm/ExecutionEngine/JITMemoryManager.h | 26 +-
include/llvm/Support/StandardPasses.h | 250 ++++++++++++++++++
lib/CodeGen/CMakeLists.txt | 2 +
lib/CodeGen/ELFCodeEmitter.cpp | 94 +++++++
lib/CodeGen/ELFCodeEmitter.h | 87 ++++++
lib/CodeGen/ELFWriter.cpp | 142 +---------
lib/ExecutionEngine/JIT/JITEmitter.cpp | 14 +-
lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 54 ++--
lib/Target/Alpha/AlphaISelDAGToDAG.cpp | 68 ++---
lib/Target/Alpha/AlphaISelLowering.cpp | 3 -
lib/Target/Alpha/AlphaInstrInfo.cpp | 53 ++++
lib/Target/Alpha/AlphaInstrInfo.h | 12 +
lib/Target/Alpha/AlphaMachineFunctionInfo.h | 48 ++++
lib/Target/Mips/MipsISelDAGToDAG.cpp | 38 +--
lib/Target/Mips/MipsISelLowering.cpp | 3 -
lib/Target/Mips/MipsInstrInfo.cpp | 29 ++
lib/Target/Mips/MipsInstrInfo.h | 6 +
lib/Target/Mips/MipsMachineFunction.h | 10 +-
lib/Target/PIC16/PIC16.h | 2 +
lib/Target/PIC16/PIC16AsmPrinter.cpp | 12 +-
lib/Target/PIC16/PIC16DebugInfo.cpp | 26 +-
lib/Target/PIC16/PIC16DebugInfo.h | 7 +-
lib/Target/PIC16/PIC16ISelLowering.cpp | 34 ++-
lib/Target/PIC16/PIC16InstrInfo.cpp | 28 ++
lib/Target/PIC16/PIC16InstrInfo.h | 5 +
lib/Target/PIC16/PIC16InstrInfo.td | 8 +-
lib/Target/X86/X86ISelDAGToDAG.cpp | 34 ++-
lib/Target/X86/X86ISelLowering.cpp | 3 -
lib/Transforms/Scalar/IndVarSimplify.cpp | 22 +-
...stride-ivs.ll => variable-stride-ivs-0.ll} | 0
.../IndVarSimplify/variable-stride-ivs-1.ll | 43 +++
tools/llvm-config/CMakeLists.txt | 1 -
tools/llvm-ld/Optimize.cpp | 69 +----
tools/lto/LTOCodeGenerator.cpp | 59 +----
tools/opt/opt.cpp | 143 ++--------
40 files changed, 1008 insertions(+), 609 deletions(-)
create mode 100644 include/llvm/Support/StandardPasses.h
create mode 100644 lib/CodeGen/ELFCodeEmitter.cpp
create mode 100644 lib/CodeGen/ELFCodeEmitter.h
create mode 100644 lib/Target/Alpha/AlphaMachineFunctionInfo.h
rename test/Transforms/IndVarSimplify/{variable-stride-ivs.ll => variable-stride-ivs-0.ll} (100%)
create mode 100644 test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6af569b25a0..ba63484d8c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,8 @@ This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them.")
endif()
+string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+
include(FindPerl)
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
@@ -55,6 +57,16 @@ endif( MSVC )
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
+if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
+ option(LLVM_ENABLE_ASSERTS "Enable asserts" OFF)
+else()
+ option(LLVM_ENABLE_ASSERTS "Enable asserts" ON)
+endif()
+
+if( LLVM_ENABLE_ASSERTS )
+ add_definitions( -D_DEBUG -UNDEBUG )
+endif()
+
if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
endif()
diff --git a/docs/CMake.html b/docs/CMake.html
index 27ec88ec947..b329ca46d62 100644
--- a/docs/CMake.html
+++ b/docs/CMake.html
@@ -248,6 +248,10 @@
LLVM_ENABLE_THREADS:BOOL
Build with threads support, if available. Defaults to ON.
+ LLVM_ENABLE_ASSERTS:BOOL
+ Enables code asserts. Defaults to ON if and only if
+ CMAKE_BUILD_TYPE is Release.
+
LLVM_ENABLE_PIC:BOOL
Add the -fPIC flag to the compiler command-line, if the
compiler supports this flag. Some systems, like Windows, does not
diff --git a/docs/GoldPlugin.html b/docs/GoldPlugin.html
index ee014101bc2..6be5277efd1 100644
--- a/docs/GoldPlugin.html
+++ b/docs/GoldPlugin.html
@@ -14,6 +14,7 @@
Usage
Licensing
@@ -135,6 +136,35 @@ $ llvm-gcc -use-gold-plugin a.o b.o -o main # <-- link with LLVMgold plugin
example gold does not currently eliminate foo4.
+
+
+
gold, ar and nm all support plugins now, so everything should be
+ in place for an easy to use LTO build of autotooled projects:
+
+ - Follow the instructions on how to build libLLVMgold.so.
+ - Install the newly built binutils to $PREFIX
+ - Copy Release/lib/libLLVMgold.so to
+ $PREFIX/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/ and
+ $PREFIX/lib/bfd-plugins/
+ - Set environment variables ($PREFIX is where you installed llvm-gcc and
+ binutils):
+
+export CC="$PREFIX/bin/llvm-gcc -use-gold-plugin"
+export CXX="$PREFIX/bin/llvm-g++ -use-gold-plugin"
+export AR="$PREFIX/bin/ar --plugin libLLVMgold.so"
+export NM="$PREFIX/bin/nm --plugin libLLVMgold.so"
+export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
+export CFLAGS="-O4"
+
+
+ - Configure & build the project as usual: ./configure && make && make check
+
+
The environment variable settings may work for non-autotooled projects
+ too, but you may need to set the LD environment variable as well.
+
+