dmd.e2ir
Converts expressions to Intermediate Representation (IR) for the backend.
License
Source: e2ir.d
Documentation: https://dlang.org/phobos/dmd_e2ir.html
-
Declaration
elem*addressElem(elem*e, Typet, boolalwaysCopy= false);Take address of an elem. Accounts for
ebeing an rvalue by assigning the rvalue to a temp.Parameters
elem*eelem to take address of
TypetType of elem
boolalwaysCopywhen
true, always copyeto a tmpReturn Value
the equivalent of &
e -
Declaration
boolelemIsLvalue(elem*e);Return
trueif elem is a an lvalue. Lvalue elems are OPvar and OPind. -
Declaration
elem*array_toPtr(Typet, elem*e);Convert array to a pointer to the data.
Parameters
Typetarray type
elem*earray to convert, it is "consumed" by the function
Return Value
erebuilt into a pointer to the data -
Declaration
elem*array_toDarray(Typet, elem*e);Convert array to a dynamic array.
-
Declaration
elem*sarray_toDarray(ref const Locloc, Typetfrom, Typetto, elem*e); -
Declaration
elem*getTypeInfo(Locloc, Typet, IRState*irs); -
Declaration
StructDeclarationneedsPostblit(Typet);Determine if
tis a struct that has postblit. -
Declaration
StructDeclarationneedsDtor(Typet);Determine if
tis a struct that has destructor. -
Declaration
voidclearStringTab();Reset stringTab[] between object files being emitted, because the symbols are local.
-
Declaration
elem*toElemDtor(Expressione, IRState*irs);Convert Expression to elem, then append destructors for any temporaries created in elem.
Parameters
ExpressioneExpression to convert
IRState*irscontext
Return Value
generated elem tree
-
Declaration
Symbol*toStringSymbol(const(char)*str, size_tlen, size_tsz);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.Parameters
const(char)*strstring
size_tlennumber of code units in string
size_tsznumber of bytes per code unit
Return Value
Symbol
-
Declaration
Symbol*toStringSymbol(StringExpse);Turn StringExp into Symbol.
-
Declaration
elem*buildArrayBoundsError(IRState*irs, ref const Locloc, elem*lwr, elem*upr, elem*elength);Construct elem to run when an array bounds check fails.
Parameters
IRState*irsto get function from
Loclocto get file/line from
elem*lwrlower bound passed, if slice (array[
lwr..upr]).nullotherwise.elem*uprupper bound passed if slice (array[
lwr..upr]), index if not a slice (array[upr])elem*elengthlength of array
Return Value
elem generated
-
Declaration
voidtoTraceGC(IRState*irs, elem*e, ref const Locloc);Replace call to GC allocator with call to tracing GC allocator.
Parameters
IRState*irsto get function from
elem*eelem to modify in place
Loclocto get file/line from
-
Declaration
elem*callCAssert(IRState*irs, ref const Locloc, Expressionexp, Expressionemsg, const(char)*str);Generate call to C's assert failure function. One of
exp,emsg, orstrmust not benull.Parameters
IRState*irscontext
Locloclocation to use for assert message
Expressionexpif not
nullexpression to test (not evaluated, but converted to a string)Expressionemsgif not
nullthen informative message to be computed at run timeconst(char)*strif not
nullthen informative message stringReturn Value
generated call
-
Declaration
elem*genHalt(ref const Locloc);Generate HALT instruction.
Parameters
Locloclocation to use for debug info
Return Value
generated instruction
-
Declaration
booltype_zeroCopy(type*t);Determine if zero bits need to be copied for this backend type
Parameters
type*tbackend type
Return Value
trueif 0 bits -
Declaration
elem*elAssign(elem*e1, elem*e2, Typet, type*tx);Generate a copy from
e2toe1.Parameters
elem*e1lvalue
elem*e2rvalue
Typetvalue type
type*txif !
null, thentconverted to C typeReturn Value
generated elem
-
Declaration
elem*setEthis2(ref const Locloc, IRState*irs, FuncDeclarationfd, elem*ethis2, elem**ethis, elem**eside);Initialize the dual-context array with the context pointers.
Parameters
Loclocline and file of what line to show usage for
IRState*irscurrent context to get the second context from
FuncDeclarationfdthe target function
elem*ethis2dual-context array
elem**ethisthe first context
elem**esidewhere to store the assignment expressions
Return Value
if successful,ethis2nullotherwise