Struct gccjit::Context [] [src]

pub struct Context<'ctx> { /* fields omitted */ }

Wrapper around a GCC JIT context object that keeps the state of the JIT compiler. In GCCJIT, this object is responsible for all memory management of JIT data structures, and as such anything made from this context must have a lifetime strictly less than this object.

It's possible to create a child context from a parent context. In that case, the child context must have a lifetime strictly less than the parent context.

Methods

impl<'ctx> Context<'ctx>
[src]

Sets the program name reported by the JIT.

Sets the optimization level that the JIT compiler will use. The higher the optimization level, the longer compilation will take.

When set to true, dumps the code that the JIT generates to standard out during compilation.

Compiles the context and returns a CompileResult that contains the means to access functions and globals that have currently been JIT compiled.

Compiles the context and saves the result to a file. The type of the file is controlled by the OutputKind parameter.

Creates a new child context from this context. The child context is a fully-featured context, but it has a lifetime that is strictly less than the lifetime that spawned it.

Creates a new location for use by gdb when debugging a JIT compiled program. The filename, line, and col are used by gdb to "show" your source when in a debugger.

Constructs a new type for any type that implements the Typeable trait. This library only provides a handful of implementations of Typeable for some primitive types - utilizers of this library are encouraged to provide their own types that implement Typeable for ease of type creation.

Constructs a new field with an optional source location, type, and name. This field can be used to compose unions or structs.

Constructs a new array type with a given base element type and a size.

Constructs a new struct type with the given name, optional source location, and a list of fields. The returned struct is concrete and new fields cannot be added to it.

Constructs a new struct type whose fields are not known. Fields can be added to this struct later, but only once.

Creates a new union type from a set of fields.

Creates a new function pointer type with the given return type parameter types, and an optional location. The last flag can make the function variadic, although Rust can't really handle the varargs calling convention.

Creates a new function with the given function kind, return type, parameters, name, and whether or not the function is variadic.

Creates a new binary operation between two RValues and produces a new RValue.

Creates a unary operation on one RValue and produces a result RValue.

Creates a function call to a function object with a given number of parameters. The RValue that is returned is the result of the function call. Note that due to the way that Rust's generics work, it is currently not possible to be generic over different types of arguments (RValues together with LValues and Parameters, for example), so in order to mix the types of the arguments it may be necessary to call to_rvalue() before calling this function.

Creates an indirect function call that dereferences a function pointer and attempts to invoke it with the given arguments. The RValue that is returned is the result of the function call.

Cast an RValue to a specific type. I don't know what happens when the cast fails yet.

Creates an LValue from an array pointer and an offset. The LValue can be the target of an assignment, or it can be converted into an RValue (i.e. loaded).

Creates a new RValue from a given long value.

Creates a new RValue from a given int value.

Creates a new RValue from a given double value.

Creates a zero element for a given type.

Creates a one element for a given type.

Creates an RValue for a raw pointer. This function requires that the lifetime of the pointer be greater than that of the jitted program.

Creates a null RValue.

Creates a string literal RValue.

Dumps a small C file to the path that can be used to reproduce a series of API calls. You should only ever need to call this if you are debugging an issue in gccjit itself or this library.

Creates a new parameter with a given type, name, and location.

Get a builtin function from gcc. It's not clear what functions are builtin and you'll likely need to consult the GCC internal docs for a full list.

Trait Implementations

impl Default for Context<'static>
[src]

Returns the "default value" for a type. Read more

impl<'ctx> Drop for Context<'ctx>
[src]

A method called when the value goes out of scope. Read more