aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-07-14 17:45:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-07-14 17:45:39 +0000
commiteb9a85f09e18b3fe88499710404b38d3a9128f62 (patch)
treed4c525dba91c583de634db5d0b1e2160194db37f /lib/VMCore
parent61afc8820f2bc85f7b7158850a0250f9d8c1ebaa (diff)
Change Intrinsic::getDeclaration and friends to take an ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Function.cpp17
-rw-r--r--lib/VMCore/IRBuilder.cpp6
2 files changed, 10 insertions, 13 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index bde6a6d691..6536bcd0e2 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -333,7 +333,7 @@ unsigned Function::getIntrinsicID() const {
return 0;
}
-std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
+std::string Intrinsic::getName(ID id, ArrayRef<Type*> Tys) {
assert(id < num_intrinsics && "Invalid intrinsic ID!");
static const char * const Table[] = {
"not_intrinsic",
@@ -341,10 +341,10 @@ std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_NAME_TABLE
};
- if (numTys == 0)
+ if (Tys.empty())
return Table[id];
std::string Result(Table[id]);
- for (unsigned i = 0; i < numTys; ++i) {
+ for (unsigned i = 0; i < Tys.size(); ++i) {
if (const PointerType* PTyp = dyn_cast<PointerType>(Tys[i])) {
Result += ".p" + llvm::utostr(PTyp->getAddressSpace()) +
EVT::getEVT(PTyp->getElementType()).getEVTString();
@@ -356,8 +356,7 @@ std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
}
const FunctionType *Intrinsic::getType(LLVMContext &Context,
- ID id, Type **Tys,
- unsigned numTys) {
+ ID id, ArrayRef<Type*> Tys) {
const Type *ResultTy = NULL;
std::vector<Type*> ArgTys;
bool IsVarArg = false;
@@ -384,14 +383,12 @@ bool Intrinsic::isOverloaded(ID id) {
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_ATTRIBUTES
-Function *Intrinsic::getDeclaration(Module *M, ID id, Type **Tys,
- unsigned numTys) {
+Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) {
// There can never be multiple globals with the same name of different types,
// because intrinsics must be a specific type.
return
- cast<Function>(M->getOrInsertFunction(getName(id, Tys, numTys),
- getType(M->getContext(),
- id, Tys, numTys)));
+ cast<Function>(M->getOrInsertFunction(getName(id, Tys),
+ getType(M->getContext(), id, Tys)));
}
// This defines the "Intrinsic::getIntrinsicForGCCBuiltin()" method.
diff --git a/lib/VMCore/IRBuilder.cpp b/lib/VMCore/IRBuilder.cpp
index 647c0b7760..1352018767 100644
--- a/lib/VMCore/IRBuilder.cpp
+++ b/lib/VMCore/IRBuilder.cpp
@@ -67,7 +67,7 @@ CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
Value *Ops[] = { Ptr, Val, Size, getInt32(Align), getInt1(isVolatile) };
Type *Tys[] = { Ptr->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
- Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys, 2);
+ Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys);
CallInst *CI = createCallHelper(TheFn, Ops, 5, this);
@@ -87,7 +87,7 @@ CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align,
Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
- Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys, 3);
+ Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys);
CallInst *CI = createCallHelper(TheFn, Ops, 5, this);
@@ -107,7 +107,7 @@ CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align,
Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
- Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys, 3);
+ Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys);
CallInst *CI = createCallHelper(TheFn, Ops, 5, this);