class Alloc(Op):
"""allocates a block of memory.
- It can be specified whether the variable should be allocated to the stack
- or to the heap."""
+ It can be specified whether the memory should be allocated to the stack
+ or to the heap.
+ Allocates memory for one or more objects (depending on value on count input).
+ """
ins = [
("mem", "memory dependency" ),
("count", "number of objects to allocate" ),
dict(
name = "type",
type = "ir_type*",
- comment = "type of the allocated variable",
+ comment = "type of the objects to allocate",
),
dict(
name = "where",
attr_struct = "asm_attr"
attrs_name = "assem"
customSerializer = True
+ ins = [
+ ("mem", "memory dependency"),
+ ]
attrs = [
dict(
name = "input_constraints",
),
dict(
name = "n_output_constraints",
- type = "int",
+ type = "size_t",
noprop = True,
comment = "number of output constraints",
),
),
dict(
name = "n_clobbers",
- type = "int",
+ type = "size_t",
noprop = True,
comment = "number of clobbered registers/memory",
),
flags = [ ]
pinned = "yes"
noconstructor = True
- customSerializer = True
+ customSerializer = True # this has no serializer
class Block(Op):
"""A basic block"""
arity = "variable"
flags = [ "labeled" ]
attr_struct = "block_attr"
+ attrs = [
+ dict(
+ name = "entity",
+ type = "ir_entity*",
+ comment = "entity representing this block",
+ init = "NULL",
+ ),
+ ]
customSerializer = True
init = '''
name = "type",
comment = "type of the call (usually type of the called procedure)",
),
- dict(
- type = "unsigned",
- name = "tail_call",
- # the tail call attribute can only be set by analysis
- init = "0",
- )
]
attr_struct = "call_attr"
pinned = "memory"
attr_struct = "cmp_attr"
class Cond(Op):
- """Conditionally change control flow.
- Input: A value of mode_b
- Output: A tuple of two control flows. The first is taken if the input is
- false, the second if it is true.
- """
+ """Conditionally change control flow."""
ins = [
("selector", "condition parameter"),
]
attr_struct = "conv_attr"
class CopyB(Op):
- """Copies a block of memory"""
+ """Copies a block of memory with statically known size/type."""
ins = [
("mem", "memory dependency"),
("dst", "destination address"),
knownBlock = True
block = "get_irg_end_block(irg)"
singleton = True
- customSerializer = True
class Eor(Binop):
- """returns the result of a bitwise exclusive or operation of its operands"""
+ """returns the result of a bitwise exclusive or operation of its operands.
+
+ This is also known as the Xor operation."""
flags = [ "commutative" ]
class Free(Op):
attr_struct = "free_attr"
class Id(Op):
- """Returns its operand unchanged."""
+ """Returns its operand unchanged.
+
+ This is mainly used when exchanging nodes. Usually you shouldn't see Id
+ nodes since the getters/setters for node inputs skip them automatically."""
ins = [
("pred", "the value which is returned unchanged")
]
name = "volatility",
comment = "volatile loads are a visible side-effect and may not be optimized",
init = "flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile",
+ to_flags = "%s == volatility_is_volatile ? cons_volatile : 0"
),
dict(
type = "ir_align",
name = "unaligned",
comment = "pointers to unaligned loads don't need to respect the load-mode/type alignments",
init = "flags & cons_unaligned ? align_non_aligned : align_is_aligned",
+ to_flags = "%s == align_non_aligned ? cons_unaligned : 0"
),
]
attr_struct = "load_attr"
"""returns the remainder of its operands from an implied division.
Examples:
+
* mod(5,3) produces 2
* mod(5,-3) produces 2
* mod(-5,3) produces -2
singleton = True
class Not(Unop):
- """returns the logical complement of a value. Works for integer values too.
- If the input is false/zero then true/one is returned, otherwise false/zero
- is returned."""
+ """returns the bitwise complement of a value. Works for boolean values, too."""
flags = []
class Or(Binop):
As we can't distinguish these easily we keep all of them alive. */
if (is_Phi(res) && mode == mode_M)
add_End_keepalive(get_irg_end(irg), res);'''
+ customSerializer = True
class Pin(Op):
"""Pin the value of the node node in the current block. No users of the Pin
knownGraph = True
block = "get_nodes_block(irn_pred)"
graph = "get_irn_irg(irn_pred)"
- customSerializer = True
attrs = [
dict(
type = "long",
class Sel(Op):
"""Computes the address of a entity of a compound type given the base
- address of an instance of the compound type."""
+ address of an instance of the compound type.
+
+ Optimisations assume that a Sel node can only produce a NULL pointer if the
+ ptr input was NULL."""
ins = [
("mem", "memory dependency"),
("ptr", "pointer to object to select from"),
flags = [ "cfopcode" ]
singleton = True
knownBlock = True
- customSerializer = True
block = "get_irg_start_block(irg)"
class Store(Op):
name = "volatility",
comment = "volatile stores are a visible side-effect and may not be optimized",
init = "flags & cons_volatile ? volatility_is_volatile : volatility_non_volatile",
+ to_flags = "%s == volatility_is_volatile ? cons_volatile : 0"
),
dict(
type = "ir_align",
name = "unaligned",
comment = "pointers to unaligned stores don't need to respect the load-mode/type alignments",
init = "flags & cons_unaligned ? align_non_aligned : align_is_aligned",
+ to_flags = "%s == align_non_aligned ? cons_unaligned : 0"
),
]
constructor_args = [
class SymConst(Op):
"""A symbolic constant.
- - symconst_type_tag The symbolic constant represents a type tag. The
- type the tag stands for is given explicitly.
- - symconst_type_size The symbolic constant represents the size of a type.
- The type of which the constant represents the size
- is given explicitly.
- - symconst_type_align The symbolic constant represents the alignment of a
- type. The type of which the constant represents the
- size is given explicitly.
- - symconst_addr_ent The symbolic constant represents the address of an
- entity (variable or method). The variable is given
- explicitly by a firm entity.
- - symconst_ofs_ent The symbolic constant represents the offset of an
- entity in its owner type.
- - symconst_enum_const The symbolic constant is a enumeration constant of
- an enumeration type."""
+ - *symconst_type_size* The symbolic constant represents the size of a type.
+ The type of which the constant represents the size
+ is given explicitly.
+ - *symconst_type_align* The symbolic constant represents the alignment of a
+ type. The type of which the constant represents the
+ size is given explicitly.
+ - *symconst_addr_ent* The symbolic constant represents the address of an
+ entity (variable or method). The variable is given
+ explicitly by a firm entity.
+ - *symconst_ofs_ent* The symbolic constant represents the offset of an
+ entity in its owner type.
+ - *symconst_enum_const* The symbolic constant is a enumeration constant of
+ an enumeration type."""
mode = "mode_P"
flags = [ "constlike", "start_block" ]
knownBlock = True