module volt.lowerer.callBuilder

Build calls to intrinsic functions and the like.

These calls can differ based on LLVM version etc, so we want to handle that messiness here.

Code Map

//! Build calls to intrinsic functions and the like.
module volt.lowerer.callBuilder;


//! Call buildAndAddMemfoo, wrapping dst in an ExpReference.
fn buildAndAddMemfoo(loc: const(token.Location), bexp: ir.BlockStatement, memcpyFunction: ir.Function, dst: ir.Variable, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo) { }
//! Build a call with buildIntrinsicMemfoo and add it to a BlockStatement.
fn buildAndAddMemfoo(loc: const(token.Location), bexp: ir.BlockStatement, memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo) { }
//! Build a call with buildIntrinsicMemfoo and add it to a StatementExp.
fn buildAndAddMemfoo(loc: const(token.Location), sexp: ir.StatementExp, memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo) { }
//! Build a call to a memcpy/memmove function, or a function that takes
//! the same arguments.
fn buildIntrinsicMemfoo(loc: const(token.Location), memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, target: TargetInfo) ir.Exp { }
//! Build a call to a memset function.
fn buildIntrinsicMemset(loc: const(token.Location), memsetFunction: ir.Function, dst: ir.Exp, val: ir.Exp, len: ir.Exp, target: TargetInfo) ir.Exp { }
fn buildAndAddMemfoo(loc: const(token.Location), bexp: ir.BlockStatement, memcpyFunction: ir.Function, dst: ir.Variable, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo)

Call buildAndAddMemfoo, wrapping dst in an ExpReference.

fn buildAndAddMemfoo(loc: const(token.Location), bexp: ir.BlockStatement, memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo)

Build a call with buildIntrinsicMemfoo and add it to a BlockStatement.

Alterations performed:

  • src will be cast to a void*.
  • The length will be determined by base's size times len.
fn buildAndAddMemfoo(loc: const(token.Location), sexp: ir.StatementExp, memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, base: ir.Type, target: TargetInfo)

Build a call with buildIntrinsicMemfoo and add it to a StatementExp.

Alterations performed:

  • src will be cast to a void*.
  • The length will be determined by base's size times len.
fn buildIntrinsicMemfoo(loc: const(token.Location), memcpyFunction: ir.Function, dst: ir.Exp, src: ir.Exp, len: ir.Exp, target: TargetInfo) ir.Exp

Build a call to a memcpy/memmove function, or a function that takes the same arguments.

memcpyFunction will be wrapped in an ExpReference.
Alignment (if present) will be 0, and volatile will be false.

fn buildIntrinsicMemset(loc: const(token.Location), memsetFunction: ir.Function, dst: ir.Exp, val: ir.Exp, len: ir.Exp, target: TargetInfo) ir.Exp

Build a call to a memset function.

memsetFunction will be wrapped in an ExpReference.
Alignment (if present) will be 0, and volatile will be false.