aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-29 22:17:13 +0000
committerOwen Anderson <resistor@mac.com>2009-07-29 22:17:13 +0000
commitdebcb01b0f0a15f568ca69e8f288fade4bfc7297 (patch)
tree22a274838cf6c55205a8a3f0a80262b09b63b069 /include
parent37c4a2d6f15ff32c9ae91e333d655a349e195993 (diff)
downloadexternal_llvm-debcb01b0f0a15f568ca69e8f288fade4bfc7297.zip
external_llvm-debcb01b0f0a15f568ca69e8f288fade4bfc7297.tar.gz
external_llvm-debcb01b0f0a15f568ca69e8f288fade4bfc7297.tar.bz2
Move types back to the 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77516 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/ValueTypes.h2
-rw-r--r--include/llvm/InstrTypes.h8
-rw-r--r--include/llvm/Instructions.h13
-rw-r--r--include/llvm/LLVMContext.h34
-rw-r--r--include/llvm/Support/TypeBuilder.h35
5 files changed, 32 insertions, 60 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index 57ca285..5069f9e 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -477,7 +477,7 @@ namespace llvm {
/// getTypeForMVT - This method returns an LLVM type corresponding to the
/// specified MVT. For integer types, this returns an unsigned type. Note
/// that this will abort for types that cannot be represented.
- const Type *getTypeForMVT(LLVMContext &Context) const;
+ const Type *getTypeForMVT() const;
/// getMVT - Return the value type corresponding to the specified type.
/// This returns all pointers as iPTR. If HandleUnknown is true, unknown
diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h
index 43fe664..ddb6ad3 100644
--- a/include/llvm/InstrTypes.h
+++ b/include/llvm/InstrTypes.h
@@ -667,6 +667,14 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
+
+ /// @brief Create a result type for fcmp/icmp
+ static const Type* makeCmpResultType(const Type* opnd_type) {
+ if (const VectorType* vt = dyn_cast<const VectorType>(opnd_type)) {
+ return VectorType::get(Type::Int1Ty, vt->getNumElements());
+ }
+ return Type::Int1Ty;
+ }
};
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 2b53fac..ad5a4a9 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -645,7 +645,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(InsertBefore->getContext().makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::ICmp, pred, LHS, RHS, NameStr,
InsertBefore) {
assert(pred >= CmpInst::FIRST_ICMP_PREDICATE &&
@@ -666,7 +666,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(InsertAtEnd.getContext().makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::ICmp, pred, LHS, RHS, NameStr,
&InsertAtEnd) {
assert(pred >= CmpInst::FIRST_ICMP_PREDICATE &&
@@ -687,7 +687,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(Context.makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::ICmp, pred, LHS, RHS, NameStr) {
assert(pred >= CmpInst::FIRST_ICMP_PREDICATE &&
pred <= CmpInst::LAST_ICMP_PREDICATE &&
@@ -820,7 +820,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(InsertBefore->getContext().makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::FCmp, pred, LHS, RHS, NameStr,
InsertBefore) {
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE &&
@@ -839,7 +839,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(InsertAtEnd.getContext().makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::FCmp, pred, LHS, RHS, NameStr,
&InsertAtEnd) {
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE &&
@@ -858,7 +858,7 @@ public:
Value *LHS, ///< The left-hand-side of the expression
Value *RHS, ///< The right-hand-side of the expression
const Twine &NameStr = "" ///< Name of the instruction
- ) : CmpInst(Context.makeCmpResultType(LHS->getType()),
+ ) : CmpInst(makeCmpResultType(LHS->getType()),
Instruction::FCmp, pred, LHS, RHS, NameStr) {
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE &&
"Invalid FCmp predicate value");
@@ -910,7 +910,6 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
-
};
//===----------------------------------------------------------------------===//
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index 8c3e2ef..00a6581 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -91,40 +91,6 @@ public:
// MDString accessors
MDString* getMDString(const StringRef &Str);
- // FunctionType accessors
- FunctionType* getFunctionType(const Type* Result, bool isVarArg);
- FunctionType* getFunctionType(const Type* Result,
- const std::vector<const Type*>& Params,
- bool isVarArg);
-
- // IntegerType accessors
- const IntegerType* getIntegerType(unsigned NumBits);
-
- // OpaqueType accessors
- OpaqueType* getOpaqueType();
-
- // StructType accessors
- StructType* getStructType(bool isPacked=false);
- StructType* getStructType(const std::vector<const Type*>& Params,
- bool isPacked = false);
- StructType* getStructType(const Type* type, ...);
-
- // ArrayType accessors
- ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements);
-
- // PointerType accessors
- PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace);
- PointerType* getPointerTypeUnqual(const Type* ElementType);
-
- // VectorType accessors
- VectorType* getVectorType(const Type* ElementType, unsigned NumElements);
- VectorType* getVectorTypeInteger(const VectorType* VTy);
- VectorType* getVectorTypeExtendedElement(const VectorType* VTy);
- VectorType* getVectorTypeTruncatedElement(const VectorType* VTy);
-
- // Other helpers
- /// @brief Create a result type for fcmp/icmp
- const Type* makeCmpResultType(const Type* opnd_type);
// Methods for erasing constants
void erase(MDString *M);
diff --git a/include/llvm/Support/TypeBuilder.h b/include/llvm/Support/TypeBuilder.h
index 5ea7f9e..1f85f1d 100644
--- a/include/llvm/Support/TypeBuilder.h
+++ b/include/llvm/Support/TypeBuilder.h
@@ -107,7 +107,7 @@ template<typename T, bool cross> class TypeBuilder<T*, cross> {
public:
static const PointerType *get(LLVMContext &Context) {
static const PointerType *const result =
- Context.getPointerTypeUnqual(TypeBuilder<T,cross>::get(Context));
+ PointerType::getUnqual(TypeBuilder<T,cross>::get(Context));
return result;
}
};
@@ -120,7 +120,7 @@ template<typename T, size_t N, bool cross> class TypeBuilder<T[N], cross> {
public:
static const ArrayType *get(LLVMContext &Context) {
static const ArrayType *const result =
- Context.getArrayType(TypeBuilder<T, cross>::get(Context), N);
+ ArrayType::get(TypeBuilder<T, cross>::get(Context), N);
return result;
}
};
@@ -129,7 +129,7 @@ template<typename T, bool cross> class TypeBuilder<T[], cross> {
public:
static const ArrayType *get(LLVMContext &Context) {
static const ArrayType *const result =
- Context.getArrayType(TypeBuilder<T, cross>::get(Context), 0);
+ ArrayType::get(TypeBuilder<T, cross>::get(Context), 0);
return result;
}
};
@@ -161,7 +161,7 @@ template<> class TypeBuilder<T, false> { \
public: \
static const IntegerType *get(LLVMContext &Context) { \
static const IntegerType *const result = \
- Context.getIntegerType(sizeof(T) * CHAR_BIT); \
+ IntegerType::get(sizeof(T) * CHAR_BIT); \
return result; \
} \
}; \
@@ -191,7 +191,7 @@ template<uint32_t num_bits, bool cross>
class TypeBuilder<types::i<num_bits>, cross> {
public:
static const IntegerType *get(LLVMContext &Context) {
- static const IntegerType *const result = Context.getIntegerType(num_bits);
+ static const IntegerType *const result = IntegerType::get(num_bits);
return result;
}
};
@@ -254,7 +254,7 @@ public:
private:
static const FunctionType *create(LLVMContext &Context) {
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context), false);
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context), false);
}
};
template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
@@ -269,7 +269,7 @@ private:
std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, false);
}
};
@@ -287,7 +287,7 @@ private:
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, false);
}
};
@@ -306,7 +306,7 @@ private:
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
params.push_back(TypeBuilder<A3, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, false);
}
};
@@ -328,7 +328,7 @@ private:
params.push_back(TypeBuilder<A2, cross>::get(Context));
params.push_back(TypeBuilder<A3, cross>::get(Context));
params.push_back(TypeBuilder<A4, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, false);
}
};
@@ -351,7 +351,7 @@ private:
params.push_back(TypeBuilder<A3, cross>::get(Context));
params.push_back(TypeBuilder<A4, cross>::get(Context));
params.push_back(TypeBuilder<A5, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, false);
}
};
@@ -365,7 +365,7 @@ public:
private:
static const FunctionType *create(LLVMContext &Context) {
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context), true);
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context), true);
}
};
template<typename R, typename A1, bool cross>
@@ -381,8 +381,7 @@ private:
std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
- params, true);
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context), params, true);
}
};
template<typename R, typename A1, typename A2, bool cross>
@@ -399,7 +398,7 @@ private:
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, true);
}
};
@@ -418,7 +417,7 @@ private:
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
params.push_back(TypeBuilder<A3, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, true);
}
};
@@ -440,7 +439,7 @@ private:
params.push_back(TypeBuilder<A2, cross>::get(Context));
params.push_back(TypeBuilder<A3, cross>::get(Context));
params.push_back(TypeBuilder<A4, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, true);
}
};
@@ -463,7 +462,7 @@ private:
params.push_back(TypeBuilder<A3, cross>::get(Context));
params.push_back(TypeBuilder<A4, cross>::get(Context));
params.push_back(TypeBuilder<A5, cross>::get(Context));
- return Context.getFunctionType(TypeBuilder<R, cross>::get(Context),
+ return FunctionType::get(TypeBuilder<R, cross>::get(Context),
params, true);
}
};