Add a portable strerror*() wrapper, llvm::sys::StrError(). This includes the
[oota-llvm.git] / include / llvm / LLVMContext.h
index 018d777c0140a4e01e2ed46ee6786cb8e64f90fd..1d95502bcd6a5a3de85219e04fad91c8471a0604 100644 (file)
@@ -6,6 +6,11 @@
 // 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
@@ -30,11 +35,18 @@ class PointerType;
 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:
@@ -155,8 +167,39 @@ 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