Holds ImageGatherer and various code for dealing with per image things.
Code Map
//! Holds ImageGatherer and various code for dealing with per image
//! things.
module volt.lowerer.image;
//! Collects various things that needs to emitted per image.
class ImageGatherer : NullVisitor, Pass
{
public:
lp: LanguagePass;
thisModule: ir.Module;
thisModuleTorNum: u32;
emittedMain: bool;
mainVolt: ir.Function;
mainC: ir.Function;
prefix: string;
//! Array literals to be assigned to the global variables.
globalConstructors: ir.ArrayLiteral;
//! Array literals to be assigned to the global variables.
globalDestructors: ir.ArrayLiteral;
//! Array literals to be assigned to the global variables.
localConstructors: ir.ArrayLiteral;
//! Array literals to be assigned to the global variables.
localDestructors: ir.ArrayLiteral;
public:
this(lp: LanguagePass) { }
//! Collect the tors from m and emit extern(C) main if needed.
fn transform(m: ir.Module) { }
//! Nothing to do.
fn close() { }
//! The emitting code is run on leave.
fn leave(m: ir.Module) Status { }
//! Collect any local/global constructors and find main function.
fn enter(func: ir.Function) Status { }
//! Helper function that creates a variable and adds it to thisModule.
fn emitVariable(arr: ir.ArrayLiteral, name: string) { }
//! Sets the correct mangled name on the tor and adds it to the
//! ArrayLiteral.
fn handleTor(arr: ir.ArrayLiteral, name: string, func: ir.Function) { }
fn setLocations(loc: Location) { }
}
//! If func is the main function, add a C main next to it.
fn lowerCMain(lp: LanguagePass, mod: ir.Module, func: ir.Function) { }
If func is the main function, add a C main next to it.
This class collects global & local constructors and destructors and builds arrays that the runtime loops over. It also emits stub code need for the native volt main to work, this is done by calling into the runtime.
Array literals to be assigned to the global variables.
Array literals to be assigned to the global variables.
Array literals to be assigned to the global variables.
Array literals to be assigned to the global variables.
Collect the tors from m
and emit extern(C) main if needed.
Nothing to do.
The emitting code is run on leave.
Collect any local/global constructors and find main function.
Helper function that creates a variable and adds it to thisModule.
Sets the correct mangled name on the tor and adds it to the ArrayLiteral.