support LLVM 3.4
authorHomer Hsing <homer.xing@intel.com>
Tue, 24 Sep 2013 02:10:46 +0000 (10:10 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Mon, 14 Oct 2013 09:30:56 +0000 (17:30 +0800)
LLVM 3.3 or earlier version don't support unary addition of vectors,
such as "++ int2". This patch supports LLVM 3.4.
Tested by PIGLIT, no regression.

Signed-off-by: Homer Hsing <homer.xing@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
CMake/FindLLVM.cmake
backend/src/backend/program.cpp
backend/src/llvm/llvm_gen_backend.cpp
docs/Beignet.mdwn

index e76ab42..3fa9ad9 100644 (file)
@@ -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-31 llvm-config-3.1 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-3.4 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-31 llvm-config-3.1 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-3.4 llvm-config DOC "llvm-config executable")
 endif (LLVM_INSTALL_DIR)
 
 if (LLVM_CONFIG_EXECUTABLE)
index 6550eac..6ba9593 100644 (file)
@@ -542,7 +542,12 @@ namespace gbe {
     llvm::Module *module = Act->takeModule();
 
     std::string ErrorInfo;
-    llvm::raw_fd_ostream OS(output, ErrorInfo,llvm::raw_fd_ostream::F_Binary);
+#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR > 3)
+    auto mode = llvm::sys::fs::F_Binary;
+#else
+    auto mode = llvm::raw_fd_ostream::F_Binary;
+#endif
+    llvm::raw_fd_ostream OS(output, ErrorInfo, mode);
     //still write to temp file for code simply, otherwise need add another function.
     //because gbe_program_new_from_llvm also be used by cl_program_create_from_llvm, can't be removed
     //TODO: Pass module to llvmToGen, if use module, should return Act and use OwningPtr out of this funciton
index 5b6857d..1fb3fd6 100644 (file)
 #define LLVM_VERSION_MINOR 0
 #endif /* !defined(LLVM_VERSION_MINOR) */
 
-#if (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 3)
-#error "Only LLVM 3.0 - 3.3 is supported"
-#endif /* (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 3) */
+#if (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 4)
+#error "Only LLVM 3.0 - 3.4 is supported"
+#endif /* (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 4) */
 
 using namespace llvm;
 
index c0f88de..86a235e 100644 (file)
@@ -55,7 +55,7 @@ with any thing older.
 
 [http://llvm.org/releases/](http://llvm.org/releases/)
 
-LLVM 3.1,3.2 and 3.3 are supported.
+LLVM 3.1,3.2,3.3 and 3.4 are supported.
 
 Also note that the code was compiled on GCC 4.6 and GCC 4.7. Since the code uses
 really recent C++11 features, you may expect problems with older compilers. Last