Class Context
Encapsulates an LLVM context
public sealed class Context : IContext, IEquatable<IContext>, IDisposable, IEquatable<Context>
- Inheritance
-
Context
- Implements
- Inherited Members
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 Module, even though, technically the types are owned by a Context. Thus to keep things simpler and help make working with debug information easier. Ubiquity.NET.Llvm 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
Properties
- BoolType
Gets the LLVM boolean type for this context
- DiscardValueNames
Gets or sets a value indicating whether this context is configured to discard value names
- 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
- Int128Type
Gets the LLVM 128 bit integer 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
- IsDisposed
Gets a value indicating whether this instance is already disposed
- MetadataType
Gets the LLVM IrMetadata type for 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(LazyEncodedString)
Creates a simple attribute without arguments
- CreateAttribute(LazyEncodedString, uint, ulong[], ulong[])
Create an attribute that accepts a constant range value
- CreateAttribute(LazyEncodedString, ulong)
Creates an attribute with an integer value parameter
- CreateAttribute(LazyEncodedString, LazyEncodedString)
Creates a string attribute with a value
- CreateAttribute(LazyEncodedString, ITypeRef)
Create an attribute that accepts a type value
- CreateBasicBlock(LazyEncodedString)
Create a named BasicBlock without inserting it into a function
- CreateBitcodeModule()
Creates a new instance of the Module class in this context
- CreateBitcodeModule(LazyEncodedString)
Creates a new instance of the Module class in a given context
- CreateConstant(bool)
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(short)
Creates a new ConstantInt with a bit length of 16
- CreateConstant(int)
Creates a new ConstantInt with a bit length of 32
- CreateConstant(long)
Creates a new ConstantInt with a bit length of 64
- CreateConstant(sbyte)
Creates a new ConstantInt with a bit length of 8
- CreateConstant(float)
Creates a constant floating point value for a given value
- CreateConstant(ushort)
Creates a new ConstantInt with a bit length of 16
- CreateConstant(uint)
Creates a new ConstantInt with a bit length of 32
- CreateConstant(uint, ulong, bool)
Creates a new ConstantInt with a bit length of 64
- CreateConstant(ulong)
Creates a new ConstantInt with a bit length of 64
- CreateConstant(ITypeRef, ulong, bool)
Create a constant value of the specified integer type
- CreateConstantString(LazyEncodedString)
Create a constant data string value
- CreateConstantString(LazyEncodedString, bool)
Create a constant data string value
- CreateConstantStruct(bool, params IEnumerable<Constant>)
Creates a constant structure from a set of values
- CreateFunctionType(IDIBuilder, bool, IDebugType<ITypeRef, DIType>, params IEnumerable<IDebugType<ITypeRef, DIType>>)
Creates a FunctionType with Debug information
- CreateFunctionType(IDIBuilder, IDebugType<ITypeRef, DIType>, params IEnumerable<IDebugType<ITypeRef, DIType>>)
Creates a FunctionType with Debug information
- CreateMDNode(LazyEncodedString)
Create an MDNode from a string
- CreateMetadataString(LazyEncodedString?)
Creates a metadata string from the given string
- CreateNamedConstantStruct(IStructType, params IEnumerable<Constant>)
Creates a constant instance of a specified structure type from a set of values
- CreateStructType(bool, params IEnumerable<ITypeRef>)
Create an anonymous structure type (e.g. Tuple)
- CreateStructType(LazyEncodedString)
Create an opaque structure type (e.g. a forward reference)
- CreateStructType(LazyEncodedString, bool, params IEnumerable<ITypeRef>)
Creates a new structure type in this Ubiquity.NET.Llvm.ContextAlias
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- Equals(object?)
Determines whether the specified object is equal to the current object.
- Equals(Context?)
Indicates whether the current object is equal to another object of the same type.
- Equals(IContext?)
Indicates whether the current object is equal to another object of the same type.
- GetFunctionType(bool, ITypeRef, params IEnumerable<ITypeRef>)
Get an LLVM Function type (e.g. signature)
- GetFunctionType(ITypeRef, params IEnumerable<ITypeRef>)
Get an LLVM Function type (e.g. signature)
- GetHashCode()
Serves as the default hash function.
- GetIntType(uint)
Get's an LLVM integer type of arbitrary bit width
- GetMDKindId(LazyEncodedString)
Gets non-zero IrMetadata kind ID for a given name
- OpenBinary(LazyEncodedString)
Opens a TargetBinary from a path
- ParseModule(LazyEncodedString, LazyEncodedString)
Parse LLVM IR source for a module, into this context
- SetDiagnosticHandler(DiagnosticInfoCallbackAction)
Set a custom diagnostic handler