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.
-
Declaration
bool
elemIsLvalue
(elem*e
);Return
true
if 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
Type
t
array type
elem*
e
array to convert, it is "consumed" by the function
Return Value
e
rebuilt 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
StructDeclaration
needsPostblit
(Typet
);Determine if
t
is a struct that has postblit. -
Declaration
StructDeclaration
needsDtor
(Typet
);Determine if
t
is a struct that has destructor. -
Declaration
void
clearStringTab
();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
Expression
e
Expression to convert
IRState*
irs
context
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)*
str
string
size_t
len
number of code units in string
size_t
sz
number 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*
irs
to get function from
Loc
loc
to get file/line from
elem*
lwr
lower bound passed, if slice (array[
lwr
..upr
]).null
otherwise.elem*
upr
upper bound passed if slice (array[
lwr
..upr
]), index if not a slice (array[upr
])elem*
elength
length of array
Return Value
elem generated
-
Declaration
void
toTraceGC
(IRState*irs
, elem*e
, ref const Locloc
);Replace call to GC allocator with call to tracing GC allocator.
Parameters
IRState*
irs
to get function from
elem*
e
elem to modify in place
Loc
loc
to 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
, orstr
must not benull
.Parameters
IRState*
irs
context
Loc
loc
location to use for assert message
Expression
exp
if not
null
expression to test (not evaluated, but converted to a string)Expression
emsg
if not
null
then informative message to be computed at run timeconst(char)*
str
if not
null
then informative message stringReturn Value
generated call
-
Declaration
elem*
genHalt
(ref const Locloc
);Generate HALT instruction.
Parameters
Loc
loc
location to use for debug info
Return Value
generated instruction
-
Declaration
bool
type_zeroCopy
(type*t
);Determine if zero bits need to be copied for this backend type
Parameters
type*
t
backend type
Return Value
true
if 0 bits -
Declaration
elem*
elAssign
(elem*e1
, elem*e2
, Typet
, type*tx
);Generate a copy from
e2
toe1
.Parameters
elem*
e1
lvalue
elem*
e2
rvalue
Type
t
value type
type*
tx
if !
null
, thent
converted 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
Loc
loc
line and file of what line to show usage for
IRState*
irs
current context to get the second context from
FuncDeclaration
fd
the target function
elem*
ethis2
dual-context array
elem**
ethis
the first context
elem**
eside
where to store the assignment expressions
Return Value
if successful,ethis2
null
otherwise