mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 14:36:34 +00:00
Use SmallVector while constructing ReturnInst.
llvm-svn: 47619
This commit is contained in:
parent
e5766a12da
commit
0be97b2118
@ -1400,6 +1400,9 @@ public:
|
|||||||
ReturnInst(const std::vector<Value *> &retVals);
|
ReturnInst(const std::vector<Value *> &retVals);
|
||||||
ReturnInst(const std::vector<Value *> &retVals, Instruction *InsertBefore);
|
ReturnInst(const std::vector<Value *> &retVals, Instruction *InsertBefore);
|
||||||
ReturnInst(const std::vector<Value *> &retVals, BasicBlock *InsertAtEnd);
|
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);
|
explicit ReturnInst(BasicBlock *InsertAtEnd);
|
||||||
virtual ~ReturnInst();
|
virtual ~ReturnInst();
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "llvm/ParamAttrsList.h"
|
#include "llvm/ParamAttrsList.h"
|
||||||
#include "llvm/AutoUpgrade.h"
|
#include "llvm/AutoUpgrade.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
@ -1344,7 +1345,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
unsigned OpNum = 0;
|
unsigned OpNum = 0;
|
||||||
std::vector<Value *> Vs;
|
SmallVector<Value *,4> Vs;
|
||||||
do {
|
do {
|
||||||
Value *Op = NULL;
|
Value *Op = NULL;
|
||||||
if (getValueTypePair(Record, OpNum, NextValueNo, Op))
|
if (getValueTypePair(Record, OpNum, NextValueNo, Op))
|
||||||
@ -1352,7 +1353,8 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
|||||||
Vs.push_back(Op);
|
Vs.push_back(Op);
|
||||||
} while(OpNum != Record.size());
|
} while(OpNum != Record.size());
|
||||||
|
|
||||||
I = new ReturnInst(Vs);
|
// SmallVector Vs has at least one element.
|
||||||
|
I = new ReturnInst(&Vs[0], Vs.size());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,6 +618,24 @@ ReturnInst::ReturnInst(const std::vector<Value *> &retVals)
|
|||||||
init(&retVals[0], retVals.size());
|
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) {
|
void ReturnInst::init(Value * const* retVals, unsigned N) {
|
||||||
|
|
||||||
assert (N > 0 && "Invalid operands numbers in ReturnInst init");
|
assert (N > 0 && "Invalid operands numbers in ReturnInst init");
|
||||||
|
Loading…
Reference in New Issue
Block a user