llvm.org GIT mirror llvm / 7a61d70
Have IRBuilder take a template argument on whether or not to preserve names. This can save a lot of allocations if you aren't going to be looking at the output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 11 years ago
7 changed file(s) with 63 addition(s) and 60 deletion(s). Raw diff Collapse all Expand all
7070 brainf_func = cast(module->
7171 getOrInsertFunction("brainf", Type::VoidTy, NULL));
7272
73 builder = new IRBuilder(BasicBlock::Create(label, brainf_func));
73 builder = new IRBuilder<>(BasicBlock::Create(label, brainf_func));
7474
7575 //%arr = malloc i8, i32 %d
7676 ConstantInt *val_mem = ConstantInt::get(APInt(32, memtotal));
8383 BasicBlock *aberrorbb;
8484
8585 /// Variables
86 IRBuilder *builder;
86 IRBuilder<> *builder;
8787 Value *curhead;
8888 };
8989
3232 /// supports nul-terminated C strings. For fully generic names, use
3333 /// I->setName(). For access to extra instruction properties, use the mutators
3434 /// (e.g. setVolatile) on the instructions after they have been created.
35 class IRBuilder {
35 /// The template argument handles whether or not to preserve names in the final
36 /// instruction output. This defaults to on.
37 template class IRBuilder {
3638 BasicBlock *BB;
3739 BasicBlock::iterator InsertPt;
3840 public:
8082 /// template instantiation.
8183 void InsertHelper(Instruction *I, const char *Name) const {
8284 if (BB) BB->getInstList().insert(InsertPt, I);
83 if (Name[0])
85 if (preserveNames && Name[0])
8486 I->setName(Name);
8587 }
8688
707707 DEFINE_ISA_CONVERSION_FUNCTIONS (Value, LLVMValueRef )
708708 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef )
709709 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef )
710 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder, LLVMBuilderRef )
710 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef )
711711 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(PATypeHolder, LLVMTypeHandleRef )
712712 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ModuleProvider, LLVMModuleProviderRef)
713713 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef )
6060 Constant *GetFrameMap(Function &F);
6161 const Type* GetConcreteStackEntryType(Function &F);
6262 void CollectRoots(Function &F);
63 static GetElementPtrInst *CreateGEP(IRBuilder &B, Value *BasePtr,
63 static GetElementPtrInst *CreateGEP(IRBuilder<> &B, Value *BasePtr,
6464 int Idx1, const char *Name);
65 static GetElementPtrInst *CreateGEP(IRBuilder &B, Value *BasePtr,
65 static GetElementPtrInst *CreateGEP(IRBuilder<> &B, Value *BasePtr,
6666 int Idx1, int Idx2, const char *Name);
6767 };
6868
8888 // State.
8989 int State;
9090 Function::iterator StateBB, StateE;
91 IRBuilder Builder;
91 IRBuilder<> Builder;
9292
9393 public:
9494 EscapeEnumerator(Function &F, const char *N = "cleanup")
9595 : F(F), CleanupBBName(N), State(0) {}
9696
97 IRBuilder *Next() {
97 IRBuilder<> *Next() {
9898 switch (State) {
9999 default:
100100 return 0;
340340 }
341341
342342 GetElementPtrInst *
343 ShadowStackCollector::CreateGEP(IRBuilder &B, Value *BasePtr,
343 ShadowStackCollector::CreateGEP(IRBuilder<> &B, Value *BasePtr,
344344 int Idx, int Idx2, const char *Name) {
345345 Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0),
346346 ConstantInt::get(Type::Int32Ty, Idx),
353353 }
354354
355355 GetElementPtrInst *
356 ShadowStackCollector::CreateGEP(IRBuilder &B, Value *BasePtr,
356 ShadowStackCollector::CreateGEP(IRBuilder<> &B, Value *BasePtr,
357357 int Idx, const char *Name) {
358358 Value *Indices[] = { ConstantInt::get(Type::Int32Ty, 0),
359359 ConstantInt::get(Type::Int32Ty, Idx) };
380380
381381 // Build the shadow stack entry at the very start of the function.
382382 BasicBlock::iterator IP = F.getEntryBlock().begin();
383 IRBuilder AtEntry(IP->getParent(), IP);
383 IRBuilder<> AtEntry(IP->getParent(), IP);
384384
385385 Instruction *StackEntry = AtEntry.CreateAlloca(ConcreteStackEntryTy, 0,
386386 "gc_frame");
418418
419419 // For each instruction that escapes...
420420 EscapeEnumerator EE(F, "gc_cleanup");
421 while (IRBuilder *AtExit = EE.Next()) {
421 while (IRBuilder<> *AtExit = EE.Next()) {
422422 // Pop the entry from the shadow stack. Don't reuse CurrentHead from
423423 // AtEntry, since that would make the value live for the entire function.
424424 Instruction *EntryNextPtr2 = CreateGEP(*AtExit, StackEntry, 0, 0,
5454 /// performed. If it returns CI, then it transformed the call and CI is to be
5555 /// deleted. If it returns something else, replace CI with the new value and
5656 /// delete CI.
57 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) =0;
58
59 Value *OptimizeCall(CallInst *CI, const TargetData &TD, IRBuilder &B) {
57 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B)
58 =0;
59
60 Value *OptimizeCall(CallInst *CI, const TargetData &TD, IRBuilder<> &B) {
6061 Caller = CI->getParent()->getParent();
6162 this->TD = &TD;
6263 return CallOptimizer(CI->getCalledFunction(), CI, B);
6364 }
6465
6566 /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
66 Value *CastToCStr(Value *V, IRBuilder &B);
67 Value *CastToCStr(Value *V, IRBuilder<> &B);
6768
6869 /// EmitStrLen - Emit a call to the strlen function to the builder, for the
6970 /// specified pointer. Ptr is required to be some pointer type, and the
7071 /// return value has 'intptr_t' type.
71 Value *EmitStrLen(Value *Ptr, IRBuilder &B);
72 Value *EmitStrLen(Value *Ptr, IRBuilder<> &B);
7273
7374 /// EmitMemCpy - Emit a call to the memcpy function to the builder. This
7475 /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
7576 Value *EmitMemCpy(Value *Dst, Value *Src, Value *Len,
76 unsigned Align, IRBuilder &B);
77 unsigned Align, IRBuilder<> &B);
7778
7879 /// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
7980 /// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
80 Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder &B);
81 Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B);
8182
8283 /// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name' (e.g.
8384 /// 'floor'). This function is known to take a single of type matching 'Op'
8485 /// and returns one value with the same type. If 'Op' is a long double, 'l'
8586 /// is added as the suffix of name, if 'Op' is a float, we add a 'f' suffix.
86 Value *EmitUnaryFloatFnCall(Value *Op, const char *Name, IRBuilder &B);
87 Value *EmitUnaryFloatFnCall(Value *Op, const char *Name, IRBuilder<> &B);
8788
8889 /// EmitPutChar - Emit a call to the putchar function. This assumes that Char
8990 /// is an integer.
90 void EmitPutChar(Value *Char, IRBuilder &B);
91 void EmitPutChar(Value *Char, IRBuilder<> &B);
9192
9293 /// EmitPutS - Emit a call to the puts function. This assumes that Str is
9394 /// some pointer.
94 void EmitPutS(Value *Str, IRBuilder &B);
95 void EmitPutS(Value *Str, IRBuilder<> &B);
9596
9697 /// EmitFPutC - Emit a call to the fputc function. This assumes that Char is
9798 /// an i32, and File is a pointer to FILE.
98 void EmitFPutC(Value *Char, Value *File, IRBuilder &B);
99 void EmitFPutC(Value *Char, Value *File, IRBuilder<> &B);
99100
100101 /// EmitFPutS - Emit a call to the puts function. Str is required to be a
101102 /// pointer and File is a pointer to FILE.
102 void EmitFPutS(Value *Str, Value *File, IRBuilder &B);
103 void EmitFPutS(Value *Str, Value *File, IRBuilder<> &B);
103104
104105 /// EmitFWrite - Emit a call to the fwrite function. This assumes that Ptr is
105106 /// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
106 void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder &B);
107 void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B);
107108
108109 };
109110 } // End anonymous namespace.
110111
111112 /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
112 Value *LibCallOptimization::CastToCStr(Value *V, IRBuilder &B) {
113 Value *LibCallOptimization::CastToCStr(Value *V, IRBuilder<> &B) {
113114 return B.CreateBitCast(V, PointerType::getUnqual(Type::Int8Ty), "cstr");
114115 }
115116
116117 /// EmitStrLen - Emit a call to the strlen function to the builder, for the
117118 /// specified pointer. This always returns an integer value of size intptr_t.
118 Value *LibCallOptimization::EmitStrLen(Value *Ptr, IRBuilder &B) {
119 Value *LibCallOptimization::EmitStrLen(Value *Ptr, IRBuilder<> &B) {
119120 Module *M = Caller->getParent();
120121 Constant *StrLen =M->getOrInsertFunction("strlen", TD->getIntPtrType(),
121122 PointerType::getUnqual(Type::Int8Ty),
126127 /// EmitMemCpy - Emit a call to the memcpy function to the builder. This always
127128 /// expects that the size has type 'intptr_t' and Dst/Src are pointers.
128129 Value *LibCallOptimization::EmitMemCpy(Value *Dst, Value *Src, Value *Len,
129 unsigned Align, IRBuilder &B) {
130 unsigned Align, IRBuilder<> &B) {
130131 Module *M = Caller->getParent();
131132 Intrinsic::ID IID = Len->getType() == Type::Int32Ty ?
132133 Intrinsic::memcpy_i32 : Intrinsic::memcpy_i64;
138139 /// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
139140 /// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
140141 Value *LibCallOptimization::EmitMemChr(Value *Ptr, Value *Val,
141 Value *Len, IRBuilder &B) {
142 Value *Len, IRBuilder<> &B) {
142143 Module *M = Caller->getParent();
143144 Value *MemChr = M->getOrInsertFunction("memchr",
144145 PointerType::getUnqual(Type::Int8Ty),
153154 /// returns one value with the same type. If 'Op' is a long double, 'l' is
154155 /// added as the suffix of name, if 'Op' is a float, we add a 'f' suffix.
155156 Value *LibCallOptimization::EmitUnaryFloatFnCall(Value *Op, const char *Name,
156 IRBuilder &B) {
157 IRBuilder<> &B) {
157158 char NameBuffer[20];
158159 if (Op->getType() != Type::DoubleTy) {
159160 // If we need to add a suffix, copy into NameBuffer.
176177
177178 /// EmitPutChar - Emit a call to the putchar function. This assumes that Char
178179 /// is an integer.
179 void LibCallOptimization::EmitPutChar(Value *Char, IRBuilder &B) {
180 void LibCallOptimization::EmitPutChar(Value *Char, IRBuilder<> &B) {
180181 Module *M = Caller->getParent();
181182 Value *F = M->getOrInsertFunction("putchar", Type::Int32Ty,
182183 Type::Int32Ty, NULL);
185186
186187 /// EmitPutS - Emit a call to the puts function. This assumes that Str is
187188 /// some pointer.
188 void LibCallOptimization::EmitPutS(Value *Str, IRBuilder &B) {
189 void LibCallOptimization::EmitPutS(Value *Str, IRBuilder<> &B) {
189190 Module *M = Caller->getParent();
190191 Value *F = M->getOrInsertFunction("puts", Type::Int32Ty,
191192 PointerType::getUnqual(Type::Int8Ty), NULL);
194195
195196 /// EmitFPutC - Emit a call to the fputc function. This assumes that Char is
196197 /// an integer and File is a pointer to FILE.
197 void LibCallOptimization::EmitFPutC(Value *Char, Value *File, IRBuilder &B) {
198 void LibCallOptimization::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B) {
198199 Module *M = Caller->getParent();
199200 Constant *F = M->getOrInsertFunction("fputc", Type::Int32Ty, Type::Int32Ty,
200201 File->getType(), NULL);
204205
205206 /// EmitFPutS - Emit a call to the puts function. Str is required to be a
206207 /// pointer and File is a pointer to FILE.
207 void LibCallOptimization::EmitFPutS(Value *Str, Value *File, IRBuilder &B) {
208 void LibCallOptimization::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B) {
208209 Module *M = Caller->getParent();
209210 Constant *F = M->getOrInsertFunction("fputs", Type::Int32Ty,
210211 PointerType::getUnqual(Type::Int8Ty),
215216 /// EmitFWrite - Emit a call to the fwrite function. This assumes that Ptr is
216217 /// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
217218 void LibCallOptimization::EmitFWrite(Value *Ptr, Value *Size, Value *File,
218 IRBuilder &B) {
219 IRBuilder<> &B) {
219220 Module *M = Caller->getParent();
220221 Constant *F = M->getOrInsertFunction("fwrite", TD->getIntPtrType(),
221222 PointerType::getUnqual(Type::Int8Ty),
378379
379380 /// ExitOpt - int main() { exit(4); } --> int main() { return 4; }
380381 struct VISIBILITY_HIDDEN ExitOpt : public LibCallOptimization {
381 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
382 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
382383 // Verify we have a reasonable prototype for exit.
383384 if (Callee->arg_size() == 0 || !CI->use_empty())
384385 return 0;
414415 // 'strcat' Optimizations
415416
416417 struct VISIBILITY_HIDDEN StrCatOpt : public LibCallOptimization {
417 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
418 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
418419 // Verify the "strcat" function prototype.
419420 const FunctionType *FT = Callee->getFunctionType();
420421 if (FT->getNumParams() != 2 ||
456457 // 'strchr' Optimizations
457458
458459 struct VISIBILITY_HIDDEN StrChrOpt : public LibCallOptimization {
459 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
460 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
460461 // Verify the "strchr" function prototype.
461462 const FunctionType *FT = Callee->getFunctionType();
462463 if (FT->getNumParams() != 2 ||
509510 // 'strcmp' Optimizations
510511
511512 struct VISIBILITY_HIDDEN StrCmpOpt : public LibCallOptimization {
512 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
513 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
513514 // Verify the "strcmp" function prototype.
514515 const FunctionType *FT = Callee->getFunctionType();
515516 if (FT->getNumParams() != 2 || FT->getReturnType() != Type::Int32Ty ||
542543 // 'strncmp' Optimizations
543544
544545 struct VISIBILITY_HIDDEN StrNCmpOpt : public LibCallOptimization {
545 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
546 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
546547 // Verify the "strncmp" function prototype.
547548 const FunctionType *FT = Callee->getFunctionType();
548549 if (FT->getNumParams() != 3 || FT->getReturnType() != Type::Int32Ty ||
588589 // 'strcpy' Optimizations
589590
590591 struct VISIBILITY_HIDDEN StrCpyOpt : public LibCallOptimization {
591 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
592 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
592593 // Verify the "strcpy" function prototype.
593594 const FunctionType *FT = Callee->getFunctionType();
594595 if (FT->getNumParams() != 2 || FT->getReturnType() != FT->getParamType(0) ||
617618 // 'strlen' Optimizations
618619
619620 struct VISIBILITY_HIDDEN StrLenOpt : public LibCallOptimization {
620 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
621 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
621622 const FunctionType *FT = Callee->getFunctionType();
622623 if (FT->getNumParams() != 1 ||
623624 FT->getParamType(0) != PointerType::getUnqual(Type::Int8Ty) ||
643644 // 'memcmp' Optimizations
644645
645646 struct VISIBILITY_HIDDEN MemCmpOpt : public LibCallOptimization {
646 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
647 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
647648 const FunctionType *FT = Callee->getFunctionType();
648649 if (FT->getNumParams() != 3 || !isa(FT->getParamType(0)) ||
649650 !isa(FT->getParamType(1)) ||
690691 // 'memcpy' Optimizations
691692
692693 struct VISIBILITY_HIDDEN MemCpyOpt : public LibCallOptimization {
693 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
694 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
694695 const FunctionType *FT = Callee->getFunctionType();
695696 if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
696697 !isa(FT->getParamType(0)) ||
712713 // 'pow*' Optimizations
713714
714715 struct VISIBILITY_HIDDEN PowOpt : public LibCallOptimization {
715 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
716 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
716717 const FunctionType *FT = Callee->getFunctionType();
717718 // Just make sure this has 2 arguments of the same FP type, which match the
718719 // result type.
762763 // 'exp2' Optimizations
763764
764765 struct VISIBILITY_HIDDEN Exp2Opt : public LibCallOptimization {
765 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
766 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
766767 const FunctionType *FT = Callee->getFunctionType();
767768 // Just make sure this has 1 argument of FP type, which matches the
768769 // result type.
809810 // Double -> Float Shrinking Optimizations for Unary Functions like 'floor'
810811
811812 struct VISIBILITY_HIDDEN UnaryDoubleFPOpt : public LibCallOptimization {
812 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
813 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
813814 const FunctionType *FT = Callee->getFunctionType();
814815 if (FT->getNumParams() != 1 || FT->getReturnType() != Type::DoubleTy ||
815816 FT->getParamType(0) != Type::DoubleTy)
835836 // 'ffs*' Optimizations
836837
837838 struct VISIBILITY_HIDDEN FFSOpt : public LibCallOptimization {
838 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
839 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
839840 const FunctionType *FT = Callee->getFunctionType();
840841 // Just make sure this has 2 arguments of the same FP type, which match the
841842 // result type.
870871 // 'isdigit' Optimizations
871872
872873 struct VISIBILITY_HIDDEN IsDigitOpt : public LibCallOptimization {
873 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
874 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
874875 const FunctionType *FT = Callee->getFunctionType();
875876 // We require integer(i32)
876877 if (FT->getNumParams() != 1 || !isa(FT->getReturnType()) ||
889890 // 'isascii' Optimizations
890891
891892 struct VISIBILITY_HIDDEN IsAsciiOpt : public LibCallOptimization {
892 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
893 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
893894 const FunctionType *FT = Callee->getFunctionType();
894895 // We require integer(i32)
895896 if (FT->getNumParams() != 1 || !isa(FT->getReturnType()) ||
907908 // 'abs', 'labs', 'llabs' Optimizations
908909
909910 struct VISIBILITY_HIDDEN AbsOpt : public LibCallOptimization {
910 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
911 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
911912 const FunctionType *FT = Callee->getFunctionType();
912913 // We require integer(integer) where the types agree.
913914 if (FT->getNumParams() != 1 || !isa(FT->getReturnType()) ||
928929 // 'toascii' Optimizations
929930
930931 struct VISIBILITY_HIDDEN ToAsciiOpt : public LibCallOptimization {
931 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
932 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
932933 const FunctionType *FT = Callee->getFunctionType();
933934 // We require i32(i32)
934935 if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
948949 // 'printf' Optimizations
949950
950951 struct VISIBILITY_HIDDEN PrintFOpt : public LibCallOptimization {
951 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
952 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
952953 // Require one fixed pointer argument and an integer/void result.
953954 const FunctionType *FT = Callee->getFunctionType();
954955 if (FT->getNumParams() < 1 || !isa(FT->getParamType(0)) ||
10081009 // 'sprintf' Optimizations
10091010
10101011 struct VISIBILITY_HIDDEN SPrintFOpt : public LibCallOptimization {
1011 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
1012 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
10121013 // Require two fixed pointer arguments and an integer result.
10131014 const FunctionType *FT = Callee->getFunctionType();
10141015 if (FT->getNumParams() != 2 || !isa(FT->getParamType(0)) ||
10731074 // 'fwrite' Optimizations
10741075
10751076 struct VISIBILITY_HIDDEN FWriteOpt : public LibCallOptimization {
1076 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
1077 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
10771078 // Require a pointer, an integer, an integer, a pointer, returning integer.
10781079 const FunctionType *FT = Callee->getFunctionType();
10791080 if (FT->getNumParams() != 4 || !isa(FT->getParamType(0)) ||
11081109 // 'fputs' Optimizations
11091110
11101111 struct VISIBILITY_HIDDEN FPutsOpt : public LibCallOptimization {
1111 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
1112 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
11121113 // Require two pointers. Also, we can't optimize if return value is used.
11131114 const FunctionType *FT = Callee->getFunctionType();
11141115 if (FT->getNumParams() != 2 || !isa(FT->getParamType(0)) ||
11291130 // 'fprintf' Optimizations
11301131
11311132 struct VISIBILITY_HIDDEN FPrintFOpt : public LibCallOptimization {
1132 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder &B) {
1133 virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
11331134 // Require two fixed paramters as pointers and integer result.
11341135 const FunctionType *FT = Callee->getFunctionType();
11351136 if (FT->getNumParams() != 2 || !isa(FT->getParamType(0)) ||
12921293
12931294 const TargetData &TD = getAnalysis();
12941295
1295 IRBuilder Builder;
1296 IRBuilder<> Builder;
12961297
12971298 bool Changed = false;
12981299 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
991991 /*===-- Instruction builders ----------------------------------------------===*/
992992
993993 LLVMBuilderRef LLVMCreateBuilder(void) {
994 return wrap(new IRBuilder());
994 return wrap(new IRBuilder<>());
995995 }
996996
997997 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,