summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2013-05-23 13:48:47 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-05-23 13:52:48 +0800
commit25bfb6ca3b22fc8f439ebd58ee03e33bfceeb927 (patch)
tree5eeb1e04cba861db23471c810c66e8bcc7e58598
parent34ed7dbf95eae804655869828e4544366cc4b54b (diff)
Change CMake to support LLVM 3.1.
Also fix LLVM 3.1 build errors caused by my vector scalarize commit. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--CMake/FindLLVM.cmake4
-rw-r--r--CMakeLists.txt2
-rw-r--r--backend/src/llvm/llvm_gen_backend.cpp7
-rw-r--r--backend/src/llvm/llvm_scalarize.cpp10
4 files changed, 9 insertions, 14 deletions
diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake
index b3206391..e76ab429 100644
--- a/CMake/FindLLVM.cmake
+++ b/CMake/FindLLVM.cmake
@@ -7,9 +7,9 @@
# LLVM_MODULE_LIBS - list of llvm libs for working with modules.
# LLVM_FOUND - True if llvm found.
if (LLVM_INSTALL_DIR)
- find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config DOC "llvm-config executable" PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
+ find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config DOC "llvm-config executable" PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
else (LLVM_INSTALL_DIR)
- find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config DOC "llvm-config executable")
+ find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32 llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config DOC "llvm-config executable")
endif (LLVM_INSTALL_DIR)
if (LLVM_CONFIG_EXECUTABLE)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d0d2919..c6a5d499 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,7 @@ SET(CMAKE_C_FLAGS "-Wall -mfpmath=sse -msse2 -Wcast-align -msse2 -msse3 -mssse3
# Front end stuff we need
#INCLUDE(CMake/FindLLVM.cmake)
-Find_Package(LLVM 3.2)
+Find_Package(LLVM 3.1)
# XLib
Find_Package(X11)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index a0946ef6..3fe0cbf3 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -853,11 +853,8 @@ namespace gbe
// Insert a new register for each function argument
#if LLVM_VERSION_MINOR <= 1
const AttrListPtr &PAL = F.getAttributes();
- uint32_t argID = 1; // Start at one actually
- for (; I != E; ++I, ++argID) {
-#else
- for (; I != E; ++I, ++argID) {
#endif /* LLVM_VERSION_MINOR <= 1 */
+ for (; I != E; ++I, ++argID) {
const std::string &argName = I->getName().str();
Type *type = I->getType();
@@ -892,7 +889,7 @@ namespace gbe
PointerType *pointerType = dyn_cast<PointerType>(type);
// By value structure
#if LLVM_VERSION_MINOR <= 1
- if (PAL.paramHasAttr(argID, Attribute::ByVal)) {
+ if (PAL.paramHasAttr(argID+1, Attribute::ByVal)) {
#else
if (I->hasByValAttr()) {
#endif /* LLVM_VERSION_MINOR <= 1 */
diff --git a/backend/src/llvm/llvm_scalarize.cpp b/backend/src/llvm/llvm_scalarize.cpp
index f7ef3752..bc665491 100644
--- a/backend/src/llvm/llvm_scalarize.cpp
+++ b/backend/src/llvm/llvm_scalarize.cpp
@@ -71,7 +71,11 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
+#if LLVM_VERSION_MINOR <= 1
+#include "llvm/Support/IRBuilder.h"
+#else
#include "llvm/IRBuilder.h"
+#endif /* LLVM_VERSION_MINOR <= 1 */
#include "llvm/Support/CallSite.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/raw_ostream.h"
@@ -730,13 +734,7 @@ namespace gbe {
Function::arg_iterator I = F.arg_begin(), E = F.arg_end();
-#if LLVM_VERSION_MINOR <= 1
- const AttrListPtr &PAL = F.getAttributes();
- uint32_t argID = 1; // Start at one actually
- for (; I != E; ++I, ++argID) {
-#else
for (; I != E; ++I) {
-#endif /* LLVM_VERSION_MINOR <= 1 */
Type *type = I->getType();
if(type->isVectorTy())