module volt.semantic.lifter

Code Map

module volt.semantic.lifter;


//! IR Lifter, aka Liftertron3000, copies and does transformations on IR.
class SemanticLifter : Lifter
{
public:
	lp: LanguagePass;


public:
	this(lp: LanguagePass) { }
	//! Resets the lifter and clears all cached functions and modules.
	fn reset() { }
	//! Completes the module and returns it for consumption.
	fn completeModule() ir.Module { }
	//! Lift or returns a cached copy of the given function.
	fn lift(func: ir.Function) ir.Function { }
	//! Lift or returns a cached copy of the given variable.
	fn lift(var: ir.Variable) ir.Variable { }
	//! Lift or returns a cached copy of the given function.
	fn lift(fp: ir.FunctionParam) ir.FunctionParam { }
	//! Get a lifted node or panic.
	fn liftedOrPanic(node: ir.Node, msg: string) ir.Node { }
	fn lift(old: ir.Class) ir.Class { }
	fn lift(old: ir.Union) ir.Union { }
	fn lift(old: ir.Enum) ir.Enum { }
	fn lift(old: ir.Struct) ir.Struct { }
	fn lift(old: ir._Interface) ir._Interface { }
	fn lift(old: ir.TopLevelBlock) ir.TopLevelBlock { }
	fn lift(old: ir.Alias) ir.Alias { }


protected:
	//! Create a new module to store functions in.
	fn newModule(loc: Location) { }
	//! Implemented by child classes, copies the function or variable into the
	//! current module mMod and applies error checking and transformation
	//! needed for that specific lifter.
	fn doLift(n: ir.Function) ir.Function { }
	fn doLift(n: ir.Variable) ir.Variable { }
	fn doLift(n: ir.FunctionParam) ir.FunctionParam { }
}

class CTFELifter : SemanticLifter
{
public:
	this(lp: LanguagePass) { }


protected:
	fn doLift(old: ir.Function) ir.Function { }
	fn doLift(old: ir.Variable) ir.Variable { }
}
class SemanticLifter : Lifter

IR Lifter, aka Liftertron3000, copies and does transformations on IR.

This is the base class providing utility functions and a common interface for users. One reason for lifting is that the target we are compiling for is not the same as for the compiler is running on, and as such different backend transformations needs to be done on the IR. Extra validation can also be done while copying.

Dost thou even lyft brother.

fn reset()

Resets the lifter and clears all cached functions and modules.

fn completeModule() ir.Module

Completes the module and returns it for consumption.

fn lift(func: ir.Function) ir.Function

Lift or returns a cached copy of the given function.

fn lift(var: ir.Variable) ir.Variable

Lift or returns a cached copy of the given variable.

fn lift(fp: ir.FunctionParam) ir.FunctionParam

Lift or returns a cached copy of the given function.

fn liftedOrPanic(node: ir.Node, msg: string) ir.Node

Get a lifted node or panic.

fn newModule(loc: Location)

Create a new module to store functions in.

Does not clear the function cache, so functions can refer to functions in earlier modules.

fn doLift(n: ir.Function) ir.Function

Implemented by child classes, copies the function or variable into the current module mMod and applies error checking and transformation needed for that specific lifter.