[llvm-commits] [llvm] r74542 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp
Owen Anderson
resistor at mac.com
Tue Jun 30 10:50:55 PDT 2009
Author: resistor
Date: Tue Jun 30 12:50:28 2009
New Revision: 74542
URL: http://llvm.org/viewvc/llvm-project?rev=74542&view=rev
Log:
Add wrappers for type construction to LLVMContext.
Modified:
llvm/trunk/include/llvm/LLVMContext.h
llvm/trunk/lib/VMCore/LLVMContext.cpp
Modified: llvm/trunk/include/llvm/LLVMContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=74542&r1=74541&r2=74542&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LLVMContext.h (original)
+++ llvm/trunk/include/llvm/LLVMContext.h Tue Jun 30 12:50:28 2009
@@ -35,6 +35,8 @@
class StructType;
class ArrayType;
class VectorType;
+class OpaqueType;
+class FunctionType;
class Type;
class APInt;
class APFloat;
@@ -165,6 +167,34 @@
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);
};
}
Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=74542&r1=74541&r2=74542&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContext.cpp (original)
+++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jun 30 12:50:28 2009
@@ -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 @@
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);
+}
More information about the llvm-commits
mailing list