[llvm-commits] [llvm] r117441 - in /llvm/trunk/include/llvm: Instructions.h Support/IRBuilder.h
Mikhail Glushenkov
foldr at codedgers.com
Wed Oct 27 00:39:54 PDT 2010
Author: foldr
Date: Wed Oct 27 02:39:54 2010
New Revision: 117441
URL: http://llvm.org/viewvc/llvm-project?rev=117441&view=rev
Log:
It is confusing to call a random-access iterator 'InputIterator'.
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/Support/IRBuilder.h
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=117441&r1=117440&r2=117441&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Wed Oct 27 02:39:54 2010
@@ -289,8 +289,10 @@
const Twine &NameStr);
void init(Value *Ptr, Value *Idx, const Twine &NameStr);
- template<typename InputIterator>
- void init(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ void init(Value *Ptr,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
@@ -313,10 +315,10 @@
/// Null is returned if the indices are invalid for the specified
/// pointer type.
///
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
// This argument ensures that we
// have an iterator we can do
// arithmetic on in constant time
@@ -331,18 +333,19 @@
}
/// Constructors - Create a getelementptr instruction with a base pointer an
- /// list of indices. The first ctor can optionally insert before an existing
+ /// list of indices. The first ctor can optionally insert before an existing
/// instruction, the second appends the new instruction to the specified
/// BasicBlock.
- template<typename InputIterator>
- inline GetElementPtrInst(Value *Ptr, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ inline GetElementPtrInst(Value *Ptr, RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
unsigned Values,
const Twine &NameStr,
Instruction *InsertBefore);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
inline GetElementPtrInst(Value *Ptr,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
@@ -355,23 +358,24 @@
protected:
virtual GetElementPtrInst *clone_impl() const;
public:
- template<typename InputIterator>
- static GetElementPtrInst *Create(Value *Ptr, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ static GetElementPtrInst *Create(Value *Ptr, RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
- typename std::iterator_traits<InputIterator>::difference_type Values =
- 1 + std::distance(IdxBegin, IdxEnd);
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ Values = 1 + std::distance(IdxBegin, IdxEnd);
return new(Values)
GetElementPtrInst(Ptr, IdxBegin, IdxEnd, Values, NameStr, InsertBefore);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static GetElementPtrInst *Create(Value *Ptr,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
- typename std::iterator_traits<InputIterator>::difference_type Values =
- 1 + std::distance(IdxBegin, IdxEnd);
+ typename std::iterator_traits<RandomAccessIterator>::difference_type
+ Values = 1 + std::distance(IdxBegin, IdxEnd);
return new(Values)
GetElementPtrInst(Ptr, IdxBegin, IdxEnd, Values, NameStr, InsertAtEnd);
}
@@ -391,9 +395,10 @@
/// Create an "inbounds" getelementptr. See the documentation for the
/// "inbounds" flag in LangRef.html for details.
- template<typename InputIterator>
- static GetElementPtrInst *CreateInBounds(Value *Ptr, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ static GetElementPtrInst *CreateInBounds(Value *Ptr,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
GetElementPtrInst *GEP = Create(Ptr, IdxBegin, IdxEnd,
@@ -401,10 +406,10 @@
GEP->setIsInBounds(true);
return GEP;
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static GetElementPtrInst *CreateInBounds(Value *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
GetElementPtrInst *GEP = Create(Ptr, IdxBegin, IdxEnd,
@@ -441,12 +446,12 @@
/// Null is returned if the indices are invalid for the specified
/// pointer type.
///
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd) {
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd) {
return getIndexedType(Ptr, IdxBegin, IdxEnd,
- typename std::iterator_traits<InputIterator>::
+ typename std::iterator_traits<RandomAccessIterator>::
iterator_category());
}
@@ -523,10 +528,10 @@
struct OperandTraits<GetElementPtrInst> : public VariadicOperandTraits<1> {
};
-template<typename InputIterator>
+template<typename RandomAccessIterator>
GetElementPtrInst::GetElementPtrInst(Value *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
unsigned Values,
const Twine &NameStr,
Instruction *InsertBefore)
@@ -539,12 +544,13 @@
OperandTraits<GetElementPtrInst>::op_end(this) - Values,
Values, InsertBefore) {
init(Ptr, IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
-template<typename InputIterator>
+template<typename RandomAccessIterator>
GetElementPtrInst::GetElementPtrInst(Value *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
unsigned Values,
const Twine &NameStr,
BasicBlock *InsertAtEnd)
@@ -557,7 +563,8 @@
OperandTraits<GetElementPtrInst>::op_end(this) - Values,
Values, InsertAtEnd) {
init(Ptr, IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
@@ -838,8 +845,10 @@
void init(Value *Func, Value *Actual);
void init(Value *Func);
- template<typename InputIterator>
- void init(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
+ template<typename RandomAccessIterator>
+ void init(Value *Func,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
const Twine &NameStr,
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
@@ -851,24 +860,26 @@
setName(NameStr);
}
- /// Construct a CallInst given a range of arguments. InputIterator
+ /// Construct a CallInst given a range of arguments. RandomAccessIterator
/// must be a random-access iterator pointing to contiguous storage
- /// (e.g. a std::vector<>::iterator). Checks are made for
+ /// (e.g. a std::vector<>::iterator). Checks are made for
/// random-accessness but not for contiguous storage as that would
/// incur runtime overhead.
/// @brief Construct a CallInst from a range of arguments
- template<typename InputIterator>
- CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
+ template<typename RandomAccessIterator>
+ CallInst(Value *Func,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
const Twine &NameStr, Instruction *InsertBefore);
- /// Construct a CallInst given a range of arguments. InputIterator
+ /// Construct a CallInst given a range of arguments. RandomAccessIterator
/// must be a random-access iterator pointing to contiguous storage
/// (e.g. a std::vector<>::iterator). Checks are made for
/// random-accessness but not for contiguous storage as that would
/// incur runtime overhead.
/// @brief Construct a CallInst from a range of arguments
- template<typename InputIterator>
- inline CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
+ template<typename RandomAccessIterator>
+ inline CallInst(Value *Func,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd);
CallInst(Value *F, Value *Actual, const Twine &NameStr,
@@ -881,17 +892,19 @@
protected:
virtual CallInst *clone_impl() const;
public:
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static CallInst *Create(Value *Func,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
return new(unsigned(ArgEnd - ArgBegin + 1))
CallInst(Func, ArgBegin, ArgEnd, NameStr, InsertBefore);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static CallInst *Create(Value *Func,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd) {
return new(unsigned(ArgEnd - ArgBegin + 1))
CallInst(Func, ArgBegin, ArgEnd, NameStr, InsertAtEnd);
@@ -1078,8 +1091,9 @@
struct OperandTraits<CallInst> : public VariadicOperandTraits<1> {
};
-template<typename InputIterator>
-CallInst::CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
+template<typename RandomAccessIterator>
+CallInst::CallInst(Value *Func,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd)
: Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
->getElementType())->getReturnType(),
@@ -1087,11 +1101,13 @@
OperandTraits<CallInst>::op_end(this) - (ArgEnd - ArgBegin + 1),
unsigned(ArgEnd - ArgBegin + 1), InsertAtEnd) {
init(Func, ArgBegin, ArgEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
-template<typename InputIterator>
-CallInst::CallInst(Value *Func, InputIterator ArgBegin, InputIterator ArgEnd,
+template<typename RandomAccessIterator>
+CallInst::CallInst(Value *Func,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
const Twine &NameStr, Instruction *InsertBefore)
: Instruction(cast<FunctionType>(cast<PointerType>(Func->getType())
->getElementType())->getReturnType(),
@@ -1099,7 +1115,8 @@
OperandTraits<CallInst>::op_end(this) - (ArgEnd - ArgBegin + 1),
unsigned(ArgEnd - ArgBegin + 1), InsertBefore) {
init(Func, ArgBegin, ArgEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
@@ -1411,8 +1428,9 @@
const Twine &NameStr);
void init(unsigned Idx, const Twine &NameStr);
- template<typename InputIterator>
- void init(InputIterator IdxBegin, InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ void init(RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
@@ -1439,10 +1457,10 @@
static const Type *getIndexedType(const Type *Agg,
const unsigned *Idx, unsigned NumIdx);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
// This argument ensures that we
// have an iterator we can do
// arithmetic on in constant time
@@ -1460,14 +1478,16 @@
/// value and a list of indices. The first ctor can optionally insert before
/// an existing instruction, the second appends the new instruction to the
/// specified BasicBlock.
- template<typename InputIterator>
- inline ExtractValueInst(Value *Agg, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ inline ExtractValueInst(Value *Agg,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
Instruction *InsertBefore);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
inline ExtractValueInst(Value *Agg,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd);
// allocate space for exactly one operand
@@ -1478,17 +1498,19 @@
virtual ExtractValueInst *clone_impl() const;
public:
- template<typename InputIterator>
- static ExtractValueInst *Create(Value *Agg, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ static ExtractValueInst *Create(Value *Agg,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
return new
ExtractValueInst(Agg, IdxBegin, IdxEnd, NameStr, InsertBefore);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static ExtractValueInst *Create(Value *Agg,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
return new ExtractValueInst(Agg, IdxBegin, IdxEnd, NameStr, InsertAtEnd);
@@ -1516,12 +1538,12 @@
/// Null is returned if the indices are invalid for the specified
/// pointer type.
///
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
- InputIterator IdxEnd) {
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd) {
return getIndexedType(Ptr, IdxBegin, IdxEnd,
- typename std::iterator_traits<InputIterator>::
+ typename std::iterator_traits<RandomAccessIterator>::
iterator_category());
}
static const Type *getIndexedType(const Type *Ptr, unsigned Idx);
@@ -1558,29 +1580,31 @@
}
};
-template<typename InputIterator>
+template<typename RandomAccessIterator>
ExtractValueInst::ExtractValueInst(Value *Agg,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
Instruction *InsertBefore)
: UnaryInstruction(checkType(getIndexedType(Agg->getType(),
IdxBegin, IdxEnd)),
ExtractValue, Agg, InsertBefore) {
init(IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
-template<typename InputIterator>
+template<typename RandomAccessIterator>
ExtractValueInst::ExtractValueInst(Value *Agg,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd)
: UnaryInstruction(checkType(getIndexedType(Agg->getType(),
IdxBegin, IdxEnd)),
ExtractValue, Agg, InsertAtEnd) {
init(IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
@@ -1600,9 +1624,9 @@
const Twine &NameStr);
void init(Value *Agg, Value *Val, unsigned Idx, const Twine &NameStr);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
void init(Value *Agg, Value *Val,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin, RandomAccessIterator IdxEnd,
const Twine &NameStr,
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
@@ -1624,14 +1648,16 @@
/// value, a value to insert, and a list of indices. The first ctor can
/// optionally insert before an existing instruction, the second appends
/// the new instruction to the specified BasicBlock.
- template<typename InputIterator>
- inline InsertValueInst(Value *Agg, Value *Val, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ inline InsertValueInst(Value *Agg, Value *Val,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
Instruction *InsertBefore);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
inline InsertValueInst(Value *Agg, Value *Val,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr, BasicBlock *InsertAtEnd);
/// Constructors - These two constructors are convenience methods because one
@@ -1649,17 +1675,19 @@
return User::operator new(s, 2);
}
- template<typename InputIterator>
- static InsertValueInst *Create(Value *Agg, Value *Val, InputIterator IdxBegin,
- InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ static InsertValueInst *Create(Value *Agg, Value *Val,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
return new InsertValueInst(Agg, Val, IdxBegin, IdxEnd,
NameStr, InsertBefore);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static InsertValueInst *Create(Value *Agg, Value *Val,
- InputIterator IdxBegin, InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
return new InsertValueInst(Agg, Val, IdxBegin, IdxEnd,
@@ -1729,31 +1757,33 @@
struct OperandTraits<InsertValueInst> : public FixedNumOperandTraits<2> {
};
-template<typename InputIterator>
+template<typename RandomAccessIterator>
InsertValueInst::InsertValueInst(Value *Agg,
Value *Val,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
Instruction *InsertBefore)
: Instruction(Agg->getType(), InsertValue,
OperandTraits<InsertValueInst>::op_begin(this),
2, InsertBefore) {
init(Agg, Val, IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
-template<typename InputIterator>
+template<typename RandomAccessIterator>
InsertValueInst::InsertValueInst(Value *Agg,
Value *Val,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd)
: Instruction(Agg->getType(), InsertValue,
OperandTraits<InsertValueInst>::op_begin(this),
2, InsertAtEnd) {
init(Agg, Val, IdxBegin, IdxEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueInst, Value)
@@ -2386,9 +2416,9 @@
void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
Value* const *Args, unsigned NumArgs);
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
void init(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
const Twine &NameStr,
// This argument ensures that we have an iterator we can
// do arithmetic on in constant time
@@ -2401,47 +2431,49 @@
}
/// Construct an InvokeInst given a range of arguments.
- /// InputIterator must be a random-access iterator pointing to
+ /// RandomAccessIterator must be a random-access iterator pointing to
/// contiguous storage (e.g. a std::vector<>::iterator). Checks are
/// made for random-accessness but not for contiguous storage as
/// that would incur runtime overhead.
///
/// @brief Construct an InvokeInst from a range of arguments
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
unsigned Values,
const Twine &NameStr, Instruction *InsertBefore);
/// Construct an InvokeInst given a range of arguments.
- /// InputIterator must be a random-access iterator pointing to
+ /// RandomAccessIterator must be a random-access iterator pointing to
/// contiguous storage (e.g. a std::vector<>::iterator). Checks are
/// made for random-accessness but not for contiguous storage as
/// that would incur runtime overhead.
///
/// @brief Construct an InvokeInst from a range of arguments
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
inline InvokeInst(Value *Func, BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin, RandomAccessIterator ArgEnd,
unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
virtual InvokeInst *clone_impl() const;
public:
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static InvokeInst *Create(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
unsigned Values(ArgEnd - ArgBegin + 3);
return new(Values) InvokeInst(Func, IfNormal, IfException, ArgBegin, ArgEnd,
Values, NameStr, InsertBefore);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
static InvokeInst *Create(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
const Twine &NameStr,
BasicBlock *InsertAtEnd) {
unsigned Values(ArgEnd - ArgBegin + 3);
@@ -2611,10 +2643,11 @@
struct OperandTraits<InvokeInst> : public VariadicOperandTraits<3> {
};
-template<typename InputIterator>
+template<typename RandomAccessIterator>
InvokeInst::InvokeInst(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
unsigned Values,
const Twine &NameStr, Instruction *InsertBefore)
: TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
@@ -2623,12 +2656,14 @@
OperandTraits<InvokeInst>::op_end(this) - Values,
Values, InsertBefore) {
init(Func, IfNormal, IfException, ArgBegin, ArgEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
-template<typename InputIterator>
+template<typename RandomAccessIterator>
InvokeInst::InvokeInst(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
- InputIterator ArgBegin, InputIterator ArgEnd,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd)
: TerminatorInst(cast<FunctionType>(cast<PointerType>(Func->getType())
@@ -2637,7 +2672,8 @@
OperandTraits<InvokeInst>::op_end(this) - Values,
Values, InsertAtEnd) {
init(Func, IfNormal, IfException, ArgBegin, ArgEnd, NameStr,
- typename std::iterator_traits<InputIterator>::iterator_category());
+ typename std::iterator_traits<RandomAccessIterator>
+ ::iterator_category());
}
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InvokeInst, Value)
Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=117441&r1=117440&r2=117441&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Oct 27 02:39:54 2010
@@ -375,10 +375,12 @@
Args+3), Name);
}
/// CreateInvoke - Create an invoke instruction.
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
- BasicBlock *UnwindDest, InputIterator ArgBegin,
- InputIterator ArgEnd, const Twine &Name = "") {
+ BasicBlock *UnwindDest,
+ RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd,
+ const Twine &Name = "") {
return Insert(InvokeInst::Create(Callee, NormalDest, UnwindDest,
ArgBegin, ArgEnd), Name);
}
@@ -686,12 +688,14 @@
StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) {
return Insert(new StoreInst(Val, Ptr, isVolatile));
}
- template<typename InputIterator>
- Value *CreateGEP(Value *Ptr, InputIterator IdxBegin, InputIterator IdxEnd,
+ template<typename RandomAccessIterator>
+ Value *CreateGEP(Value *Ptr,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &Name = "") {
if (Constant *PC = dyn_cast<Constant>(Ptr)) {
// Every index must be constant.
- InputIterator i;
+ RandomAccessIterator i;
for (i = IdxBegin; i < IdxEnd; ++i)
if (!isa<Constant>(*i))
break;
@@ -700,12 +704,13 @@
}
return Insert(GetElementPtrInst::Create(Ptr, IdxBegin, IdxEnd), Name);
}
- template<typename InputIterator>
- Value *CreateInBoundsGEP(Value *Ptr, InputIterator IdxBegin,
- InputIterator IdxEnd, const Twine &Name = "") {
+ template<typename RandomAccessIterator>
+ Value *CreateInBoundsGEP(Value *Ptr, RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
+ const Twine &Name = "") {
if (Constant *PC = dyn_cast<Constant>(Ptr)) {
// Every index must be constant.
- InputIterator i;
+ RandomAccessIterator i;
for (i = IdxBegin; i < IdxEnd; ++i)
if (!isa<Constant>(*i))
break;
@@ -1057,9 +1062,9 @@
return Insert(CallInst::Create(Callee, Args, Args+5), Name);
}
- template<typename InputIterator>
- CallInst *CreateCall(Value *Callee, InputIterator ArgBegin,
- InputIterator ArgEnd, const Twine &Name = "") {
+ template<typename RandomAccessIterator>
+ CallInst *CreateCall(Value *Callee, RandomAccessIterator ArgBegin,
+ RandomAccessIterator ArgEnd, const Twine &Name = "") {
return Insert(CallInst::Create(Callee, ArgBegin, ArgEnd), Name);
}
@@ -1109,10 +1114,10 @@
return Insert(ExtractValueInst::Create(Agg, Idx), Name);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
Value *CreateExtractValue(Value *Agg,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &Name = "") {
if (Constant *AggC = dyn_cast<Constant>(Agg))
return Folder.CreateExtractValue(AggC, IdxBegin, IdxEnd - IdxBegin);
@@ -1127,10 +1132,10 @@
return Insert(InsertValueInst::Create(Agg, Val, Idx), Name);
}
- template<typename InputIterator>
+ template<typename RandomAccessIterator>
Value *CreateInsertValue(Value *Agg, Value *Val,
- InputIterator IdxBegin,
- InputIterator IdxEnd,
+ RandomAccessIterator IdxBegin,
+ RandomAccessIterator IdxEnd,
const Twine &Name = "") {
if (Constant *AggC = dyn_cast<Constant>(Agg))
if (Constant *ValC = dyn_cast<Constant>(Val))
More information about the llvm-commits
mailing list