Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.


Converts expressions to Intermediate Representation (IR) for the backend.

Source e2ir.d

bool ISX64REF(Declaration var);
If variable var is a value that will actually be passed as a reference
Declaration var parameter variable
true if actually implicitly passed by reference
elem* elAssign(elem* e1, elem* e2, Type t, type* tx);
Generate a copy from e2 to e1.
elem* e1 lvalue
elem* e2 rvalue
Type t value type
type* tx if !null, then t converted to C type
generated elem
bool type_zeroCopy(type* t);
Determine if zero bits need to be copied for this backend type
type* t backend type
true if 0 bits
Symbol* toStringSymbol(const(char)* str, size_t len, size_t sz);
Write read-only string to object file, create a local symbol for it. Makes a copy of str's contents, does not keep a reference to it.
const(char)* str string
size_t len number of code units in string
size_t sz number of bytes per code unit
Symbol* toStringSymbol(StringExp se);
Turn StringExp into Symbol.
void toTraceGC(ref IRState irs, elem* e, const ref Loc loc);
Replace call to GC allocator with call to tracing GC allocator.
IRState irs to get function from
elem* e elem to modify in place
Loc loc to get file/line from
elem* toElemDtor(Expression e, ref IRState irs);
Convert Expression to elem, then append destructors for any temporaries created in elem.
Expression e Expression to convert
IRState irs context
generated elem tree
elem* addressElem(elem* e, Type t, bool alwaysCopy = false);
Take address of an elem. Accounts for e being an rvalue by assigning the rvalue to a temp.
elem* e elem to take address of
Type t Type of elem
bool alwaysCopy when true, always copy e to a tmp
the equivalent of &e
void clearStringTab();
Reset stringTab[] between object files being emitted, because the symbols are local.
bool isDllImported(Dsymbol var);
Figure out whether a data symbol should be dllimported
Dsymbol var declaration of the symbol
true if symbol should be imported from a DLL
Symbol* toExtSymbol(Dsymbol s);
Generate a backend symbol for a frontend symbol
Dsymbol s frontend symbol
the backend symbol or the associated symbol in the import table if it is expected to be imported from a DLL
elem* toElem(Expression e, ref IRState irs);
Convert Expression to backend elem.
Expression e expression tree
IRState irs context
backend elem tree