// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// This file declares LLVMContext, a container of "global" state in LLVM, such
+// as the global type and constant uniquing tables.
+//
+//===----------------------------------------------------------------------===//
#ifndef LLVM_LLVMCONTEXT_H
#define LLVM_LLVMCONTEXT_H
class StructType;
class ArrayType;
class VectorType;
+class OpaqueType;
+class FunctionType;
class Type;
class APInt;
class APFloat;
class Value;
+/// This is an important class for using LLVM in a threaded context. It
+/// (opaquely) owns and manages the core "global" data of LLVM's core
+/// infrastructure, including the type and constant uniquing tables.
+/// LLVMContext itself provides no locking guarantees, so you should be careful
+/// to have one context per thread.
class LLVMContext {
LLVMContextImpl* pImpl;
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);
};
+/// FOR BACKWARDS COMPATIBILITY - Returns a global context.
+LLVMContext* getGlobalContext();
+
}
#endif