diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-13 02:10:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-13 02:10:56 +0000 |
commit | 93e985f1b17aef62d58e3198a4604f9f6cfe8d19 (patch) | |
tree | 899bcfb30d336050773f4d3e4637c393d8535b61 /lib/Transforms/Utils | |
parent | e433919686aee9c95207d93d85aeaca68a5b2546 (diff) |
Eliminate use of ctors that take vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r-- | lib/Transforms/Utils/CodeExtractor.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/InlineFunction.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Utils/LowerInvoke.cpp | 24 | ||||
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 12 |
4 files changed, 23 insertions, 19 deletions
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 87a286838d..f304df2a93 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -403,7 +403,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, } // Emit the call to the function - CallInst *call = new CallInst(newFunction, params, + CallInst *call = new CallInst(newFunction, ¶ms[0], params.size(), NumExitBlocks > 1 ? "targetBlock" : ""); codeReplacer->getInstList().push_back(call); diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 054c1c7712..07194e38ad 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -19,6 +19,7 @@ #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/CallSite.h" using namespace llvm; @@ -80,9 +81,10 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, // Next, create the new invoke instruction, inserting it at the end // of the old basic block. + SmallVector<Value*, 8> InvokeArgs(CI->op_begin()+1, CI->op_end()); InvokeInst *II = new InvokeInst(CI->getCalledValue(), Split, InvokeDest, - std::vector<Value*>(CI->op_begin()+1, CI->op_end()), + &InvokeArgs[0], InvokeArgs.size(), CI->getName(), BB->getTerminator()); II->setCallingConv(CI->getCallingConv()); diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index 5a4408f802..d89cc95ab1 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -189,21 +189,21 @@ void LowerInvoke::writeAbortMessage(Instruction *IB) { createAbortMessage(IB->getParent()->getParent()->getParent()); // These are the arguments we WANT... - std::vector<Value*> Args; - Args.push_back(ConstantInt::get(Type::Int32Ty, 2)); - Args.push_back(AbortMessage); - Args.push_back(ConstantInt::get(Type::Int32Ty, AbortMessageLength)); - (new CallInst(WriteFn, Args, "", IB))->setTailCall(); + Value* Args[3]; + Args[0] = ConstantInt::get(Type::Int32Ty, 2); + Args[1] = AbortMessage; + Args[2] = ConstantInt::get(Type::Int32Ty, AbortMessageLength); + (new CallInst(WriteFn, Args, 3, "", IB))->setTailCall(); } bool LowerInvoke::insertCheapEHSupport(Function &F) { bool Changed = false; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) { + std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end()); // Insert a normal call instruction... CallInst *NewCall = new CallInst(II->getCalledValue(), - std::vector<Value*>(II->op_begin()+3, - II->op_end()), "", II); + &CallArgs[0], CallArgs.size(), "", II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); II->replaceAllUsesWith(NewCall); @@ -223,7 +223,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) { writeAbortMessage(UI); // Insert a call to abort() - (new CallInst(AbortFn, std::vector<Value*>(), "", UI))->setTailCall(); + (new CallInst(AbortFn, "", UI))->setTailCall(); // Insert a return instruction. This really should be a "barrier", as it // is unreachable. @@ -258,9 +258,9 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo, CatchSwitch->addCase(InvokeNoC, II->getUnwindDest()); // Insert a normal call instruction. + std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end()); CallInst *NewCall = new CallInst(II->getCalledValue(), - std::vector<Value*>(II->op_begin()+3, - II->op_end()), "", + &CallArgs[0], CallArgs.size(), "", II); NewCall->takeName(II); NewCall->setCallingConv(II->getCallingConv()); @@ -533,7 +533,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { Idx.push_back(ConstantInt::get(Type::Int32Ty, 0)); Idx[0] = new GetElementPtrInst(BufPtr, &Idx[0], 2, "JmpBuf", UnwindBlock); Idx[1] = ConstantInt::get(Type::Int32Ty, 1); - new CallInst(LongJmpFn, Idx, "", UnwindBlock); + new CallInst(LongJmpFn, &Idx[0], Idx.size(), "", UnwindBlock); new UnreachableInst(UnwindBlock); // Set up the term block ("throw without a catch"). @@ -543,7 +543,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) { writeAbortMessage(TermBlock->getTerminator()); // Insert a call to abort() - (new CallInst(AbortFn, std::vector<Value*>(), "", + (new CallInst(AbortFn, "", TermBlock->getTerminator()))->setTailCall(); diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index b3a9f1d744..92b0a9d5cd 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -21,6 +21,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/ADT/SmallVector.h" #include <algorithm> #include <functional> #include <set> @@ -1369,9 +1370,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { Pred->getInstList().remove(II); // Take out of symbol table // Insert the call now... - std::vector<Value*> Args(II->op_begin()+3, II->op_end()); - CallInst *CI = new CallInst(II->getCalledValue(), Args, - II->getName(), BI); + SmallVector<Value*,8> Args(II->op_begin()+3, II->op_end()); + CallInst *CI = new CallInst(II->getCalledValue(), + &Args[0], Args.size(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); // If the invoke produced a value, the Call now does instead II->replaceAllUsesWith(CI); @@ -1741,8 +1742,9 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { II->removeFromParent(); // Take out of symbol table // Insert the call now... - std::vector<Value*> Args(II->op_begin()+3, II->op_end()); - CallInst *CI = new CallInst(II->getCalledValue(), Args, + SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end()); + CallInst *CI = new CallInst(II->getCalledValue(), + &Args[0], Args.size(), II->getName(), BI); CI->setCallingConv(II->getCallingConv()); // If the invoke produced a value, the Call does now instead. |