Click or drag to resize
Llvm.NET LogoContext Class

[This is preliminary documentation and is subject to change.]

Encapsulates an LLVM context
Inheritance Hierarchy
SystemObject
  Llvm.NETContext

Namespace:  Llvm.NET
Assembly:  Llvm.NET (in Llvm.NET.dll) Version: 3.8.6158
Syntax
C#
public sealed class Context : IDisposable

The Context type exposes the following members.

Constructors
  NameDescription
Public methodContext
Creates a new context
Top
Properties
  NameDescription
Public propertyBoolType
Get's the LLVM boolean type for this context
Public propertyStatic memberCurrentContext
Current context for the current thread
Public propertyDoubleType
Get's the LLVM double precision floating point type for this context
Public propertyFloatType
Get's the LLVM single precision floating point type for this context
Public propertyHalfFloatType
Get's the LLVM half precision floating point type for this context
Public propertyInt16Type
Get's the LLVM 16 bit integer type for this context
Public propertyInt32Type
Get's the LLVM 32 bit integer type for this context
Public propertyInt64Type
Get's the LLVM 64 bit integer type for this context
Public propertyInt8Type
Get's the LLVM 8 bit integer type for this context
Public propertyIsDisposed
Flag to indicate if this instance is still valid
Public propertyMetadata
Gets an enumerable collection of all the metadata created in this context
Public propertyVoidType
Get's the LLVM void type for this context
Top
Methods
  NameDescription
Public methodCreateConstant(Boolean)
Creates a new ConstantInt with a bit length of 1
Public methodCreateConstant(Byte)
Creates a new ConstantInt with a bit length of 8
Public methodCreateConstant(Double)
Creates a constant floating point value for a given value
Public methodCreateConstant(Int16)
Creates a new ConstantInt with a bit length of 16
Public methodCreateConstant(Int32)
Creates a new ConstantInt with a bit length of 32
Public methodCreateConstant(Int64)
Creates a new ConstantInt with a bit length of 64
Public methodCreateConstant(SByte)
Creates a new ConstantInt with a bit length of 8
Public methodCreateConstant(Single)
Creates a constant floating point value for a given value
Public methodCreateConstant(UInt16)
Creates a new ConstantInt with a bit length of 16
Public methodCreateConstant(UInt32)
Creates a new ConstantInt with a bit length of 32
Public methodCreateConstant(UInt64)
Creates a new ConstantInt with a bit length of 64
Public methodCreateConstant(UInt32, UInt64, Boolean)
Creates a new ConstantInt with a bit length of 64
Public methodCreateConstant(ITypeRef, UInt64, Boolean)
Create a constant value of the specified integer type
Public methodCreateConstantString(String)
Create a constant data string value
Public methodCreateConstantString(String, Boolean)
Create a constant data string value
Public methodCreateConstantStruct(Boolean, Constant)
Creates a constant structure from a set of values
Public methodCreateConstantStruct(Boolean, IEnumerableConstant)
Creates a constant structure from a set of values
Public methodCreateFunctionType(DebugInfoBuilder, IDebugTypeITypeRef, DIType, IDebugTypeITypeRef, DIType)
Creates a FunctionType with Debug information
Public methodCreateFunctionType(DebugInfoBuilder, IDebugTypeITypeRef, DIType, IEnumerableIDebugTypeITypeRef, DIType)
Creates a FunctionType with Debug information
Public methodCreateFunctionType(DebugInfoBuilder, Boolean, IDebugTypeITypeRef, DIType, IDebugTypeITypeRef, DIType)
Creates a FunctionType with Debug information
Public methodCreateFunctionType(DebugInfoBuilder, Boolean, IDebugTypeITypeRef, DIType, IEnumerableIDebugTypeITypeRef, DIType)
Creates a FunctionType with Debug information
Public methodCreateMetadataString
Creates a metadata string from the given string
Public methodCreateNamedConstantStruct(IStructType, Constant)
Creates a constant instance of a specified structure type from a set of values
Public methodCreateNamedConstantStruct(IStructType, IEnumerableConstant)
Creates a constant instance of a specified structure type from a set of values
Public methodCreateStructType(String)
Create an empty structure type
Public methodCreateStructType(Boolean, ITypeRef, ITypeRef)
Create an anonymous structure type (e.g. Tuple)
Public methodCreateStructType(String, Boolean, ITypeRef)
Creates a new structure type in this Context
Public methodDispose
Releases all resources used by the Context
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize (Overrides ObjectFinalize.)
Public methodGetFunctionType(ITypeRef, ITypeRef)
Get an LLVM Function type (e.g. signature)
Public methodGetFunctionType(ITypeRef, IEnumerableITypeRef)
Get an LLVM Function type (e.g. signature)
Public methodGetFunctionType(ITypeRef, IEnumerableITypeRef, Boolean)
Get an LLVM Function type (e.g. signature)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetIntType
Get's an LLVM integer type of arbitrary bit width
Public methodGetPointerTypeFor
Get a type that is a pointer to a value of a given type
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodVerify
Execute a given action if the Context is or is disposed
(Defined by ContextValidator.)
Public Extension MethodVerifyAsArg(String)Overloaded.
Throw an ArgumentException if the Context is or is disposed
(Defined by ContextValidator.)
Public Extension MethodVerifyAsArg(String, String)Overloaded.
Throw an ArgumentException if the Context is or is disposed
(Defined by ContextValidator.)
Public Extension MethodVerifyOperationOverloaded.
Throw an InvalidOperationException if the Context is or is disposed
(Defined by ContextValidator.)
Public Extension MethodVerifyOperation(String)Overloaded.
Throw an InvalidOperationException if the Context is or is disposed
(Defined by ContextValidator.)
Top
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 NativeModule, even though, technically the types are owned by a Context. Thus to keep things simpler and help make working with debug information easier. Lllvm.NET encapsulates the native type and the debug type in separate classes that are instances of the IDebugTypeTNative, TDebug interface

Note 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.
See Also