[llvm-commits] [llvm] r47619 - in /llvm/trunk: include/llvm/Instructions.h lib/Bitcode/Reader/BitcodeReader.cpp lib/VMCore/Instructions.cpp
Devang Patel
dpatel at apple.com
Tue Feb 26 11:38:19 PST 2008
Author: dpatel
Date: Tue Feb 26 13:38:17 2008
New Revision: 47619
URL: http://llvm.org/viewvc/llvm-project?rev=47619&view=rev
Log:
Use SmallVector while constructing ReturnInst.
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=47619&r1=47618&r2=47619&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Feb 26 13:38:17 2008
@@ -1400,6 +1400,9 @@
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();
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=47619&r1=47618&r2=47619&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Feb 26 13:38:17 2008
@@ -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 @@
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 @@
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;
}
}
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=47619&r1=47618&r2=47619&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Feb 26 13:38:17 2008
@@ -618,6 +618,24 @@
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");
More information about the llvm-commits
mailing list