dmd.toir

Convert to Intermediate Representation (IR) for the back-end.

Members

Aliases

toSymbol
alias toSymbol = dmd.tocsym.toSymbol
Undocumented in source.
toSymbol
alias toSymbol = dmd.glue.toSymbol
Undocumented in source.

Functions

buildCapture
void buildCapture(FuncDeclaration fd)

build a debug info struct for variables captured by nested functions, but not in a closure. must be called after generating the function to fill stack offsets

buildClosure
void buildClosure(FuncDeclaration fd, IRState* irs)

Closures are implemented by taking the local variables that need to survive the scope of the function, and copying them into a gc allocated chuck of memory. That chunk, called the closure here, is inserted into the linked list of stack frames instead of the usual stack frame.

fixEthis2
elem* fixEthis2(elem* ethis, FuncDeclaration fd, bool ctxt2)

Select one context pointer from a dual-context array

getEthis
elem* getEthis(Loc loc, IRState* irs, Dsymbol fd, Dsymbol fdp, Dsymbol origSc)

Return elem that evaluates to the static frame pointer for function fd. If fd is a member function, the returned expression will compute the value of fd's 'this' variable. 'fdp' is the parent of 'fd' if the frame pointer is being used to call 'fd'. 'origSc' is the original scope we inlined from. This routine is critical for implementing nested functions.

getParentClosureType
TYPE* getParentClosureType(Symbol* sthis, FuncDeclaration fd)

for a nested function 'fd' return the type of the closure of an outer function or aggregate. If the function is a member function the 'this' type is expected to be stored in 'sthis.Sthis'. It is always returned if it is not a void pointer. buildClosure() must have been called on the outer function before.

incUsageElem
elem* incUsageElem(IRState* irs, Loc loc)

Produce elem which increments the usage count for a particular line. Sets corresponding bit in bitmap m.covb[linnum]. Used to implement -cov switch (coverage analysis).

intrinsic_op
int intrinsic_op(FuncDeclaration fd)

Convert intrinsic function to operator.

resolveLengthVar
elem* resolveLengthVar(VarDeclaration lengthVar, elem** pe, Type t1)

Given an expression e that is an array, determine and set the 'length' variable. Input: lengthVar Symbol of 'length' variable &e expression that is the array t1 Type of the array Output: e is rewritten to avoid side effects

retStyle
RET retStyle(TypeFunction tf, bool needsThis)

Determine return style of function - whether in registers or through a hidden pointer to the caller's stack.

setClosureVarOffset
void setClosureVarOffset(FuncDeclaration fd)

Go through the variables in function fd that are to be allocated in a closure, and set the .offset fields for those variables to their positions relative to the start of the closure instance. Also turns off nrvo for closure variables.

setEthis
elem* setEthis(Loc loc, IRState* irs, elem* ey, AggregateDeclaration ad, bool setthis2)

Initialize the hidden aggregate member, vthis, with the context pointer.

Manifest constants

NotIntrinsic
enum NotIntrinsic;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.
OPtoPrec
enum OPtoPrec;
Undocumented in source but is binding to C++. You might be able to learn more by searching the web for its name.

Structs

IRState
struct IRState

Collect state variables needed by the intermediate representation (IR)

Label
struct Label

Our label symbol

Meta