diff options
| author | Devang Patel <dpatel@apple.com> | 2008-02-26 19:38:17 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2008-02-26 19:38:17 +0000 |
| commit | a736c001b6086d419290fe4decc01dad79b4d37b (patch) | |
| tree | 4edcbab60e152be1d8010944c3d12271d5f54dd3 /llvm/lib | |
| parent | 8af648ac55c03385d633b94709a300a431411a77 (diff) | |
| download | bcm5719-llvm-a736c001b6086d419290fe4decc01dad79b4d37b.tar.gz bcm5719-llvm-a736c001b6086d419290fe4decc01dad79b4d37b.zip | |
Use SmallVector while constructing ReturnInst.
llvm-svn: 47619
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 487a135509c..61e0ab98989 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -21,6 +21,7 @@ #include "llvm/ParamAttrsList.h" #include "llvm/AutoUpgrade.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" using namespace llvm; @@ -1344,7 +1345,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { break; } else { unsigned OpNum = 0; - std::vector<Value *> Vs; + SmallVector<Value *,4> Vs; do { Value *Op = NULL; if (getValueTypePair(Record, OpNum, NextValueNo, Op)) @@ -1352,7 +1353,8 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { Vs.push_back(Op); } while(OpNum != Record.size()); - I = new ReturnInst(Vs); + // SmallVector Vs has at least one element. + I = new ReturnInst(&Vs[0], Vs.size()); break; } } diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index ffd93dbc622..012aad189eb 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -618,6 +618,24 @@ ReturnInst::ReturnInst(const std::vector<Value *> &retVals) init(&retVals[0], retVals.size()); } +ReturnInst::ReturnInst(Value * const* retVals, unsigned N, + Instruction *InsertBefore) + : TerminatorInst(Type::VoidTy, Instruction::Ret, &RetVal, N, InsertBefore) { + if (N != 0) + init(retVals, N); +} +ReturnInst::ReturnInst(Value * const* retVals, unsigned N, + BasicBlock *InsertAtEnd) + : TerminatorInst(Type::VoidTy, Instruction::Ret, &RetVal, N, InsertAtEnd) { + if (N != 0) + init(retVals, N); +} +ReturnInst::ReturnInst(Value * const* retVals, unsigned N) + : TerminatorInst(Type::VoidTy, Instruction::Ret, &RetVal, N) { + if (N != 0) + init(retVals, N); +} + void ReturnInst::init(Value * const* retVals, unsigned N) { assert (N > 0 && "Invalid operands numbers in ReturnInst init"); |

