ReturnInst(const std::vector<Value *> &retVals);
ReturnInst(const std::vector<Value *> &retVals, Instruction *InsertBefore);
ReturnInst(const std::vector<Value *> &retVals, BasicBlock *InsertAtEnd);
+ ReturnInst(Value * const* retVals, unsigned N);
+ ReturnInst(Value * const* retVals, unsigned N, Instruction *InsertBefore);
+ ReturnInst(Value * const* retVals, unsigned N, BasicBlock *InsertAtEnd);
explicit ReturnInst(BasicBlock *InsertAtEnd);
virtual ~ReturnInst();
#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;
break;
} else {
unsigned OpNum = 0;
- std::vector<Value *> Vs;
+ SmallVector<Value *,4> Vs;
do {
Value *Op = NULL;
if (getValueTypePair(Record, OpNum, NextValueNo, Op))
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;
}
}
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");