diff options
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r-- | lib/Transforms/Utils/CodeExtractor.cpp | 14 | ||||
-rw-r--r-- | lib/Transforms/Utils/InlineFunction.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerAllocations.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerInvoke.cpp | 12 | ||||
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 2a91b0e..ab10baa 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -306,7 +306,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs, if (AggregateArgs) { Value *Idx[2]; Idx[0] = Context.getNullValue(Type::Int32Ty); - Idx[1] = Context.getConstantInt(Type::Int32Ty, i); + Idx[1] = ConstantInt::get(Type::Int32Ty, i); TerminatorInst *TI = newFunction->begin()->getTerminator(); GetElementPtrInst *GEP = GetElementPtrInst::Create(AI, Idx, Idx+2, @@ -396,7 +396,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, for (unsigned i = 0, e = inputs.size(); i != e; ++i) { Value *Idx[2]; Idx[0] = Context.getNullValue(Type::Int32Ty); - Idx[1] = Context.getConstantInt(Type::Int32Ty, i); + Idx[1] = ConstantInt::get(Type::Int32Ty, i); GetElementPtrInst *GEP = GetElementPtrInst::Create(Struct, Idx, Idx + 2, "gep_" + StructValues[i]->getName()); @@ -422,7 +422,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, if (AggregateArgs) { Value *Idx[2]; Idx[0] = Context.getNullValue(Type::Int32Ty); - Idx[1] = Context.getConstantInt(Type::Int32Ty, FirstOut + i); + Idx[1] = ConstantInt::get(Type::Int32Ty, FirstOut + i); GetElementPtrInst *GEP = GetElementPtrInst::Create(Struct, Idx, Idx + 2, "gep_reload_" + outputs[i]->getName()); @@ -474,17 +474,17 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, case 0: case 1: break; // No value needed. case 2: // Conditional branch, return a bool - brVal = Context.getConstantInt(Type::Int1Ty, !SuccNum); + brVal = ConstantInt::get(Type::Int1Ty, !SuccNum); break; default: - brVal = Context.getConstantInt(Type::Int16Ty, SuccNum); + brVal = ConstantInt::get(Type::Int16Ty, SuccNum); break; } ReturnInst *NTRet = ReturnInst::Create(brVal, NewTarget); // Update the switch instruction. - TheSwitch->addCase(Context.getConstantInt(Type::Int16Ty, SuccNum), + TheSwitch->addCase(ConstantInt::get(Type::Int16Ty, SuccNum), OldTarget); // Restore values just before we exit @@ -523,7 +523,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, if (AggregateArgs) { Value *Idx[2]; Idx[0] = Context.getNullValue(Type::Int32Ty); - Idx[1] = Context.getConstantInt(Type::Int32Ty,FirstOut+out); + Idx[1] = ConstantInt::get(Type::Int32Ty,FirstOut+out); GetElementPtrInst *GEP = GetElementPtrInst::Create(OAI, Idx, Idx + 2, "gep_" + outputs[out]->getName(), diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index ae0b5ee..16d8879 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -324,14 +324,14 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { if (TD == 0) Size = Context.getConstantExprSizeOf(AggTy); else - Size = Context.getConstantInt(Type::Int64Ty, + Size = ConstantInt::get(Type::Int64Ty, TD->getTypeStoreSize(AggTy)); // Always generate a memcpy of alignment 1 here because we don't know // the alignment of the src pointer. Other optimizations can infer // better alignment. Value *CallArgs[] = { - DestCast, SrcCast, Size, Context.getConstantInt(Type::Int32Ty, 1) + DestCast, SrcCast, Size, ConstantInt::get(Type::Int32Ty, 1) }; CallInst *TheMemCpy = CallInst::Create(MemCpyFn, CallArgs, CallArgs+4, "", TheCall); diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp index 8f61d88..68108fa 100644 --- a/lib/Transforms/Utils/LowerAllocations.cpp +++ b/lib/Transforms/Utils/LowerAllocations.cpp @@ -118,7 +118,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) { // malloc(type) becomes i8 *malloc(size) Value *MallocArg; if (LowerMallocArgToInteger) - MallocArg = Context.getConstantInt(Type::Int64Ty, + MallocArg = ConstantInt::get(Type::Int64Ty, TD.getTypeAllocSize(AllocTy)); else MallocArg = Context.getConstantExprSizeOf(AllocTy); diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 9f20f39..6a56bbe 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -272,7 +272,7 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo, AllocaInst *InvokeNum, SwitchInst *CatchSwitch) { LLVMContext &Context = II->getContext(); - ConstantInt *InvokeNoC = Context.getConstantInt(Type::Int32Ty, InvokeNo); + ConstantInt *InvokeNoC = ConstantInt::get(Type::Int32Ty, InvokeNo); // If the unwind edge has phi nodes, split the edge. if (isa<PHINode>(II->getUnwindDest()->begin())) { @@ -483,7 +483,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { std::vector<Value*> Idx; Idx.push_back(Context.getNullValue(Type::Int32Ty)); - Idx.push_back(Context.getConstantInt(Type::Int32Ty, 1)); + Idx.push_back(ConstantInt::get(Type::Int32Ty, 1)); OldJmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(), "OldBuf", EntryBB->getTerminator()); @@ -504,7 +504,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { // executing. For normal calls it contains zero. AllocaInst *InvokeNum = new AllocaInst(Type::Int32Ty, 0, "invokenum",EntryBB->begin()); - new StoreInst(Context.getConstantInt(Type::Int32Ty, 0), InvokeNum, true, + new StoreInst(ConstantInt::get(Type::Int32Ty, 0), InvokeNum, true, EntryBB->getTerminator()); // Insert a load in the Catch block, and a switch on its value. By default, @@ -523,7 +523,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { BasicBlock *ContBlock = EntryBB->splitBasicBlock(EntryBB->getTerminator(), "setjmp.cont"); - Idx[1] = Context.getConstantInt(Type::Int32Ty, 0); + Idx[1] = ConstantInt::get(Type::Int32Ty, 0); Value *JmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(), "TheJmpBuf", EntryBB->getTerminator()); @@ -577,12 +577,12 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { // Get a pointer to the jmpbuf and longjmp. std::vector<Value*> Idx; Idx.push_back(Context.getNullValue(Type::Int32Ty)); - Idx.push_back(Context.getConstantInt(Type::Int32Ty, 0)); + Idx.push_back(ConstantInt::get(Type::Int32Ty, 0)); Idx[0] = GetElementPtrInst::Create(BufPtr, Idx.begin(), Idx.end(), "JmpBuf", UnwindBlock); Idx[0] = new BitCastInst(Idx[0], PointerType::getUnqual(Type::Int8Ty), "tmp", UnwindBlock); - Idx[1] = Context.getConstantInt(Type::Int32Ty, 1); + Idx[1] = ConstantInt::get(Type::Int32Ty, 1); CallInst::Create(LongJmpFn, Idx.begin(), Idx.end(), "", UnwindBlock); new UnreachableInst(UnwindBlock); diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index e155c29..f63c4fd 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1611,7 +1611,7 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) { if (BB->getSinglePredecessor()) { // Turn this into a branch on constant. bool CondIsTrue = PBI->getSuccessor(0) == BB; - BI->setCondition(Context.getConstantInt(Type::Int1Ty, CondIsTrue)); + BI->setCondition(ConstantInt::get(Type::Int1Ty, CondIsTrue)); return true; // Nuke the branch on constant. } @@ -1631,7 +1631,7 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) { PBI->getCondition() == BI->getCondition() && PBI->getSuccessor(0) != PBI->getSuccessor(1)) { bool CondIsTrue = PBI->getSuccessor(0) == BB; - NewPN->addIncoming(Context.getConstantInt(Type::Int1Ty, + NewPN->addIncoming(ConstantInt::get(Type::Int1Ty, CondIsTrue), *PI); } else { NewPN->addIncoming(BI->getCondition(), *PI); |