Class Context
Encapsulates an LLVM context
Inherited Members
Namespace: Llvm.NET
Assembly: Llvm.NET.dll
Syntax
public sealed class Context : DisposableObject, IDisposable, IBitcodeModuleFactory
Remarks
A context in LLVM is a container for interning (LLVM refers to this as "uniqueing") various types and values in the system. This allows running multiple LLVM tool transforms etc.. on different threads without causing them to collide namespaces and types even if they use the same name (e.g. module one may have a type Foo, and so does module two but they are completely distinct from each other)
LLVM Debug information is ultimately all parented to a top level DICompileUnit as the scope, and a compilation unit is bound to a BitcodeModule, even though, technically the types are owned by a Context. Thus to keep things simpler and help make working with debug information easier. Llvm.NET encapsulates the native type and the debug type in separate classes that are instances of the IDebugType<TNative, TDebug> interface
note
It is important to be aware of the fact that a Context is not thread safe. The context itself and the object instances it owns are intended for use by a single thread only. Accessing and manipulating LLVM objects from multiple threads may lead to race conditions corrupted state and any number of other undefined issues.
Constructors
Context() | Initializes a new instance of the Context class.Creates a new context |
Properties
BoolType | Gets the LLVM boolean type for this context |
DoubleType | Gets the LLVM double precision floating point type for this context |
Float128Type | Gets the LLVM 128-Bit floating point type |
FloatType | Gets the LLVM single precision floating point type for this context |
HalfFloatType | Gets the LLVM half precision floating point type for this context |
Int16Type | Gets the LLVM 16 bit integer type for this context |
Int32Type | Gets the LLVM 32 bit integer type for this context |
Int64Type | Gets the LLVM 64 bit integer type for this context |
Int8Type | Gets the LLVM 8 bit integer type for this context |
Metadata | Gets an enumerable collection of all the metadata created in this context |
MetadataType | Gets the LLVM Metadata type for this context |
Modules | Gets the modules created in this context |
OdrUniqueDebugTypes | Gets or sets a value indicating whether the context keeps a map for uniqueing debug info identifiers across the context |
PpcFloat128Type | Gets the LLVM PPC 128-bit floating point type |
TokenType | Gets the LLVM token type for this context |
VoidType | Gets the LLVM void type for this context |
X86Float80Type | Gets the LLVM X86 80-bit floating point type for this context |
Methods
CreateAttribute(AttributeKind) | Creates a simple boolean attribute |
CreateAttribute(AttributeKind, UInt64) | Creates an attribute with an integer value parameter |
CreateAttribute(String) | Adds a valueless named attribute |
CreateAttribute(String, String) | Adds a Target specific named attribute with value |
CreateBasicBlock(String) | Create a named BasicBlock without inserting it into a function |
CreateBitcodeModule() | Creates a new instance of the BitcodeModule class in this context |
CreateBitcodeModule(String) | Creates a new instance of the BitcodeModule class in a given context |
CreateBitcodeModule(String, SourceLanguage, String, String, Boolean, String, UInt32) | Initializes a new instance of the BitcodeModule class with a root DICompileUnit to contain debugging information |
CreateConstant(ITypeRef, UInt64, Boolean) | Create a constant value of the specified integer type |
CreateConstant(Boolean) | Creates a new ConstantInt with a bit length of 1 |
CreateConstant(Byte) | Creates a new ConstantInt with a bit length of 8 |
CreateConstant(Double) | Creates a constant floating point value for a given value |
CreateConstant(Int16) | Creates a new ConstantInt with a bit length of 16 |
CreateConstant(Int32) | Creates a new ConstantInt with a bit length of 32 |
CreateConstant(Int64) | Creates a new ConstantInt with a bit length of 64 |
CreateConstant(SByte) | Creates a new ConstantInt with a bit length of 8 |
CreateConstant(Single) | Creates a constant floating point value for a given value |
CreateConstant(UInt16) | Creates a new ConstantInt with a bit length of 16 |
CreateConstant(UInt32) | Creates a new ConstantInt with a bit length of 32 |
CreateConstant(UInt32, UInt64, Boolean) | Creates a new ConstantInt with a bit length of 64 |
CreateConstant(UInt64) | Creates a new ConstantInt with a bit length of 64 |
CreateConstantString(String) | Create a constant data string value |
CreateConstantString(String, Boolean) | Create a constant data string value |
CreateConstantStruct(Boolean, Constant[]) | Creates a constant structure from a set of values |
CreateConstantStruct(Boolean, IEnumerable<Constant>) | Creates a constant structure from a set of values |
CreateFunctionType(DebugInfoBuilder, IDebugType<ITypeRef, DIType>, IDebugType<ITypeRef, DIType>[]) | Creates a FunctionType with Debug information |
CreateFunctionType(DebugInfoBuilder, IDebugType<ITypeRef, DIType>, IEnumerable<IDebugType<ITypeRef, DIType>>) | Creates a FunctionType with Debug information |
CreateFunctionType(DebugInfoBuilder, Boolean, IDebugType<ITypeRef, DIType>, IDebugType<ITypeRef, DIType>[]) | Creates a FunctionType with Debug information |
CreateFunctionType(DebugInfoBuilder, Boolean, IDebugType<ITypeRef, DIType>, IEnumerable<IDebugType<ITypeRef, DIType>>) | Creates a FunctionType with Debug information |
CreateMDNode(String) | Create an MDNode from a string |
CreateMetadataString(String) | Creates a metadata string from the given string |
CreateNamedConstantStruct(IStructType, Constant[]) | Creates a constant instance of a specified structure type from a set of values |
CreateNamedConstantStruct(IStructType, IEnumerable<Constant>) | Creates a constant instance of a specified structure type from a set of values |
CreateStructType(Boolean, ITypeRef, ITypeRef[]) | Create an anonymous structure type (e.g. Tuple) |
CreateStructType(String) | Create an empty structure type |
CreateStructType(String, Boolean, ITypeRef[]) | Creates a new structure type in this Context |
Dispose(Boolean) | |
GetFunctionType(ITypeRef, ITypeRef[]) | Get an LLVM Function type (e.g. signature) |
GetFunctionType(ITypeRef, IEnumerable<ITypeRef>) | Get an LLVM Function type (e.g. signature) |
GetFunctionType(ITypeRef, IEnumerable<ITypeRef>, Boolean) | Get an LLVM Function type (e.g. signature) |
GetIntType(UInt32) | Get's an LLVM integer type of arbitrary bit width |
GetMDKindId(String) | Gets non-zero Metadata kind ID for a given name |
GetPointerTypeFor(ITypeRef) | Get a type that is a pointer to a value of a given type |