aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-30 17:50:28 +0000
committerOwen Anderson <resistor@mac.com>2009-06-30 17:50:28 +0000
commitf07c8d9b14e2b7872df64ed728f7b3fc584b938c (patch)
treea04bada03b42a39d85dbc864ad456a1b85b49fcc
parent20178a039ad065f31f90fda92373f2ee8b512569 (diff)
downloadexternal_llvm-f07c8d9b14e2b7872df64ed728f7b3fc584b938c.zip
external_llvm-f07c8d9b14e2b7872df64ed728f7b3fc584b938c.tar.gz
external_llvm-f07c8d9b14e2b7872df64ed728f7b3fc584b938c.tar.bz2
Add wrappers for type construction to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74542 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/LLVMContext.h30
-rw-r--r--lib/VMCore/LLVMContext.cpp58
2 files changed, 88 insertions, 0 deletions
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index 398fae2..01c64a8 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -35,6 +35,8 @@ class PointerType;
class StructType;
class ArrayType;
class VectorType;
+class OpaqueType;
+class FunctionType;
class Type;
class APInt;
class APFloat;
@@ -165,6 +167,34 @@ public:
Constant* getConstantVector(const std::vector<Constant*>& V);
Constant* getConstantVector(Constant* const* Vals, unsigned NumVals);
ConstantVector* getConstantVectorAllOnes(const VectorType* Ty);
+
+ // FunctionType accessors
+ 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(const std::vector<const Type*>& Params,
+ bool isPacked = false);
+
+ // ArrayType accessors
+ ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements);
+
+ // PointerType accessors
+ PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace);
+ PointerType* getPointerTypeUnqualified(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);
};
}
diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp
index c2aa432..e0fe6ab 100644
--- a/lib/VMCore/LLVMContext.cpp
+++ b/lib/VMCore/LLVMContext.cpp
@@ -14,6 +14,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
#include "LLVMContextImpl.h"
using namespace llvm;
@@ -382,3 +383,60 @@ Constant* LLVMContext::getConstantVector(Constant* const* Vals,
ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) {
return ConstantVector::getAllOnesValue(Ty);
}
+
+// FunctionType accessors
+FunctionType* LLVMContext::getFunctionType(const Type* Result,
+ const std::vector<const Type*>& Params,
+ bool isVarArg) {
+ return FunctionType::get(Result, Params, isVarArg);
+}
+
+// IntegerType accessors
+const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) {
+ return IntegerType::get(NumBits);
+}
+
+// OpaqueType accessors
+OpaqueType* LLVMContext::getOpaqueType() {
+ return OpaqueType::get();
+}
+
+// StructType accessors
+StructType* LLVMContext::getStructType(const std::vector<const Type*>& Params,
+ bool isPacked) {
+ return StructType::get(Params, isPacked);
+}
+
+// ArrayType accessors
+ArrayType* LLVMContext::getArrayType(const Type* ElementType,
+ uint64_t NumElements) {
+ return ArrayType::get(ElementType, NumElements);
+}
+
+// PointerType accessors
+PointerType* LLVMContext::getPointerType(const Type* ElementType,
+ unsigned AddressSpace) {
+ return PointerType::get(ElementType, AddressSpace);
+}
+
+PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) {
+ return PointerType::getUnqual(ElementType);
+}
+
+// VectorType accessors
+VectorType* LLVMContext::getVectorType(const Type* ElementType,
+ unsigned NumElements) {
+ return VectorType::get(ElementType, NumElements);
+}
+
+VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) {
+ return VectorType::getInteger(VTy);
+}
+
+VectorType* LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) {
+ return VectorType::getExtendedElementVectorType(VTy);
+}
+
+VectorType* LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) {
+ return VectorType::getTruncatedElementVectorType(VTy);
+}