Browse code

bb#11112 - fixed custom pass initialization when using LLVM 2.9

Kevin Lin authored on 2014/09/30 06:30:05
Showing 4 changed files
... ...
@@ -95,7 +95,7 @@ static Value *GetUnderlyingObject(Value *P, TargetData *TD)
95 95
 
96 96
 namespace llvm {
97 97
   class PtrVerifier;
98
-#if LLVM_VERSION >= 30
98
+#if LLVM_VERSION >= 29
99 99
   void initializePtrVerifierPass(PassRegistry&);
100 100
 #endif
101 101
 
... ...
@@ -108,7 +108,7 @@ namespace llvm {
108 108
       static char ID;
109 109
       DEFINEPASS(PtrVerifier), rootNode(0), PT(), TD(), SE(), expander(),
110 110
           DT(), AbrtBB(), Changed(false), valid(false), EP() {
111
-#if LLVM_VERSION >= 30
111
+#if LLVM_VERSION >= 29
112 112
           initializePtrVerifierPass(*PassRegistry::getPassRegistry());
113 113
 #endif
114 114
       }
... ...
@@ -851,7 +851,7 @@ namespace llvm {
851 851
     char PtrVerifier::ID;
852 852
 
853 853
 } /* end namespace llvm */
854
-#if LLVM_VERSION >= 30
854
+#if LLVM_VERSION >= 29
855 855
 INITIALIZE_PASS_BEGIN(PtrVerifier, "", "", false, false)
856 856
 #if LLVM_VERSION < 32
857 857
 INITIALIZE_PASS_DEPENDENCY(TargetData)
... ...
@@ -55,7 +55,7 @@ static Value *GetUnderlyingObject(Value *P, TargetData *TD)
55 55
 }
56 56
 #endif
57 57
 
58
-#if LLVM_VERSION >= 30
58
+#if LLVM_VERSION >= 29
59 59
 namespace llvm {
60 60
     void initializePointerTrackingPass(llvm::PassRegistry&);
61 61
 };
... ...
@@ -71,7 +71,7 @@ INITIALIZE_PASS_END(PointerTracking, "pointertracking",
71 71
 
72 72
 char PointerTracking::ID = 0;
73 73
 PointerTracking::PointerTracking() : FunctionPass(ID) {
74
-#if LLVM_VERSION >= 30
74
+#if LLVM_VERSION >= 29
75 75
     initializePointerTrackingPass(*PassRegistry::getPassRegistry());
76 76
 #endif
77 77
 }
... ...
@@ -59,7 +59,7 @@ namespace llvm {
59 59
     Unknown // it can sometimes be true, sometimes false, or it is undecided
60 60
   };
61 61
 
62
-#if LLVM_VERSION >= 30
62
+#if LLVM_VERSION >= 29
63 63
   void initializePointerTrackingPass(PassRegistry&);
64 64
 #endif
65 65
 
... ...
@@ -1703,7 +1703,7 @@ public:
1703 1703
 			    Value *Val = convertOperand(func, Type::getInt8Ty(Context), inst->u.three[1]);
1704 1704
 			    //Value *Len = convertOperand(func, Type::getInt32Ty(Context), inst->u.three[2]);
1705 1705
                             Value *Len = convertOperand(func, Type::getInt64Ty(Context), inst->u.three[2]);
1706
-#if LLVM_VERSION < 30
1706
+#if LLVM_VERSION < 29
1707 1707
 			    CallInst *c = Builder.CreateCall4(CF->FMemset, Dst, Val, Len,
1708 1708
 								ConstantInt::get(Type::getInt32Ty(Context), 1));
1709 1709
 #else
... ...
@@ -1725,7 +1725,7 @@ public:
1725 1725
 			    Src = Builder.CreatePointerCast(Src, PointerType::getUnqual(Type::getInt8Ty(Context)));
1726 1726
 			    //Value *Len = convertOperand(func, Type::getInt32Ty(Context), inst->u.three[2]);
1727 1727
                             Value *Len = convertOperand(func, Type::getInt64Ty(Context), inst->u.three[2]);
1728
-#if LLVM_VERSION < 30
1728
+#if LLVM_VERSION < 29
1729 1729
 			    CallInst *c = Builder.CreateCall4(CF->FMemcpy, Dst, Src, Len,
1730 1730
 								ConstantInt::get(Type::getInt32Ty(Context), 1));
1731 1731
 #else
... ...
@@ -1747,7 +1747,7 @@ public:
1747 1747
 			    Src = Builder.CreatePointerCast(Src, PointerType::getUnqual(Type::getInt8Ty(Context)));
1748 1748
                             //Value *Len = convertOperand(func, Type::getInt32Ty(Context), inst->u.three[2]);
1749 1749
                             Value *Len = convertOperand(func, Type::getInt64Ty(Context), inst->u.three[2]);
1750
-#if LLVM_VERSION < 30
1750
+#if LLVM_VERSION < 29
1751 1751
 			    CallInst *c = Builder.CreateCall4(CF->FMemmove, Dst, Src, Len,
1752 1752
 								ConstantInt::get(Type::getInt32Ty(Context), 1));
1753 1753
 #else
... ...
@@ -2006,13 +2006,13 @@ static void addFunctionProtos(struct CommonFunctions *CF, ExecutionEngine *EE, M
2006 2006
     //args.push_back(Type::getInt32Ty(Context));
2007 2007
     args.push_back(Type::getInt64Ty(Context));
2008 2008
     args.push_back(Type::getInt32Ty(Context));
2009
-#if LLVM_VERSION >= 30
2009
+#if LLVM_VERSION >= 29
2010 2010
     args.push_back(Type::getInt1Ty(Context));
2011 2011
 #endif
2012 2012
     FunctionType* FuncTy_3 = FunctionType::get(Type::getVoidTy(Context),
2013 2013
 					       args, false);
2014 2014
     CF->FMemset = Function::Create(FuncTy_3, GlobalValue::ExternalLinkage,
2015
-#if LLVM_VERSION < 30
2015
+#if LLVM_VERSION < 29
2016 2016
                                    //"llvm.memset.i32",
2017 2017
                                    "llvm.memset.i64",
2018 2018
 #else
... ...
@@ -2033,13 +2033,13 @@ static void addFunctionProtos(struct CommonFunctions *CF, ExecutionEngine *EE, M
2033 2033
     //args.push_back(Type::getInt32Ty(Context));
2034 2034
     args.push_back(Type::getInt64Ty(Context));
2035 2035
     args.push_back(Type::getInt32Ty(Context));
2036
-#if LLVM_VERSION >= 30
2036
+#if LLVM_VERSION >= 29
2037 2037
     args.push_back(Type::getInt1Ty(Context));
2038 2038
 #endif
2039 2039
     FunctionType* FuncTy_4 = FunctionType::get(Type::getVoidTy(Context),
2040 2040
 					       args, false);
2041 2041
     CF->FMemmove = Function::Create(FuncTy_4, GlobalValue::ExternalLinkage,
2042
-#if LLVM_VERSION < 30
2042
+#if LLVM_VERSION < 29
2043 2043
                                     //"llvm.memmove.i32",
2044 2044
                                     "llvm.memcpy.i64",
2045 2045
 #else
... ...
@@ -2055,7 +2055,7 @@ static void addFunctionProtos(struct CommonFunctions *CF, ExecutionEngine *EE, M
2055 2055
 #endif
2056 2056
 
2057 2057
     CF->FMemcpy = Function::Create(FuncTy_4, GlobalValue::ExternalLinkage,
2058
-#if LLVM_VERSION < 30
2058
+#if LLVM_VERSION < 29
2059 2059
                                    //"llvm.memcpy.i32",
2060 2060
                                    "llvm.memcpy.i64",
2061 2061
 #else