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>
# 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)
# Front end stuff we need
#INCLUDE(CMake/FindLLVM.cmake)
-Find_Package(LLVM 3.2)
+Find_Package(LLVM 3.1)
# XLib
Find_Package(X11)
// 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();
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 */
#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"
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())