module volt.llvm.expression
Backend | LLVM Backend

Most of the expression to llvmbitcode generation code is in this module.

Code Map

//! Most of the expression to llvmbitcode generation code is in this
//! module.
module volt.llvm.expression;


//! Returns the value, without doing any checking if it is in reference
//! form or not.
fn getValueAnyForm(state: State, exp: ir.Exp, result: Value) { }
fn getValueAnyForm(state: State, exp: ir.Exp, result: Value)

Returns the value, without doing any checking if it is in reference form or not.

fn handleBinOpNonAssign(state: State, bin: ir.BinOp, result: Value)

Sets up values and calls helper functions to handle BinOp, will leave debug info location set on builder.

fn handleBinOpNonAssignHelper(state: State, loc: Location, binOp: ir.BinOp.Op, left: Value, right: Value, result: Value)

Helper function that does the bin operation, sets debug info location on builder and will not unset it.

fn handleBinOpPointer(state: State, loc: const(Location), binOp: ir.BinOp.Op, ptr: Value, other: Value, result: Value)

Pointer artithmetic, caller have to flip left and right. Assumes debug info location already set.

fn handleBinOpPrimitive(state: State, loc: const(Location), binOp: ir.BinOp.Op, pt: PrimitiveType, left: Value, right: Value, result: Value)

Primitive artithmetic, assumes debug info location already set.

fn handleCastPrimitive(state: State, loc: Location, newType: PrimitiveType, oldType: PrimitiveType, result: Value)

Handle primitive casts, the value to cast is stored in result already.

fn handleCastPointer(state: State, loc: Location, newType: Type, result: Value)

Handle pointer casts. This is really easy. Also casts between function pointers and pointers.

fn handleCastPointerPrim(state: State, loc: Location, newTypePtr: Type, newTypePrim: Type, result: Value)

Handle pointer <-> integer casts.

fn handleCastArray(state: State, loc: Location, newType: ArrayType, result: Value)

Handle all Array casts as bit casts

fn handleComplement(state: State, comp: ir.Unary, result: Value)

Handles bitwise not, the ~ operator.

fn handleDereference(state: State, de: ir.Unary, result: Value)

Handles '*' dereferences.

fn handleAddrOf(state: State, de: ir.Unary, result: Value)

Handles '&' referencing.

fn fromConstantString(state: State, loc: const(Location), str: string) LLVMValueRef

Get an LLVMValueRef from a constant string, known at compile time.

fn handleEnumMembers(state: State, inbuilt: ir.BuiltinExp, result: Value)

Write the EnumMembers builtin.

fn getStructRef(state: State, exp: ir.Exp, result: Value)

Gets the value for the expressions and makes sure that it is a struct reference value. Will handle pointers to structs correctly, setting isPointer to true and dereferencing the type pointer to the actual StructType.

fn getCreateDelegateValues(state: State, postfix: ir.Postfix, instance: Value, func: Value)

Get the value pair needed to call or create a delegate.

fn makeNonPointer(state: State, result: Value)

If the given value isPointer is set build a load function.

fn makePointer(state: State, result: Value)

Ensures that the given Value is a pointer by allocating temp storage for it.

fn makeByValPtrTemp(state: State, result: Value)

Ensures that the given Value is a pointer by allocating temp storage for it.