1 # This is the specification for the IR nodes
2 # Code is generated by scripts/gen_ir.pl
6 $NONE = "#_#_#_#_#_NONE_#_#_#_#_#";
7 $MANUALFROMPARAM = "#_#_#_#_#_MANUALFROMPARAM_#_#_#_#_#";
9 # The IR node description is done as a perl hash with the following structure:
14 # op => use given node type instead of opname
15 # or 0 is this is an abstract node type (default: none)
16 # when present, no ir_op will be created
17 # is_a => name of another IR node description from which all data
18 # except "op" is inherited (default: none),
19 # mode => the mode of the op (default: parameter),
20 # op_flags => "N|L|C|X|I|F|Y|H|c|K|S|M|NB|NI" (default: "N"),
21 # state => "floats|pinned|mem_pinned|exc_pinned" (default: "floats"),
22 # arity => "dynamic|variable"
23 # dynamic allows to add inputs later,
24 # variable means, that the ins are given at construction time
25 # (default: automatically from args)
26 # block => the block for the node (default: parameter)
27 # ins => [ "in1", "in2", ... ] list of node inputs (default: none)
28 # attrs_name => name of the attribute structure
29 # (default if attrs exists: lcfirst(opname)),
30 # attrs_type => type of the attribute structure (default: auto generated),
31 # attrs => ordered list of attributes which will default to parameters
32 # after the ins and the mode parameters
35 # type => the C type of the attribute or "bit",
36 # name => the name of the attribute,
37 # init => an initializer instead of a parameter
38 # or $MANUALFROMPARAM to disable automatic
39 # initialization but still using a parameter
40 # or $NONE to disable initialization completely
41 # by also not using a parameter
42 # (default: parameter),
43 # initname => name to access attribute
44 # when present, attribute will not be added
45 # to the according attribute struct
47 # comment => documentation for the attribute
50 # init => additional initialization code to be emitted after the
51 # attribute initialization (default: none)
52 # optimize => whether optimize_node should be called (0|1, default: 1),
53 # d_pre => code to be inserted at the begining of the new_d_* function
54 # (may include declarations and statements, default: none),
55 # d_post => code to be inserted into the new_d_* function after the call
56 # to the new_rd_* function whose result is stored in the
57 # local variable res (default: none)
62 # ); # close the %nodes initializer
65 # op_flags: flags for the operation corresponding to the firm irop_flags:
68 # C irop_flag_commutative
69 # X irop_flag_cfopcode
70 # I irop_flag_ip_cfopcode
73 # H irop_flag_highlevel
74 # c irop_flag_constlike
76 # S irop_flag_start_block
77 # M irop_flag_uses_memory
78 # NB irop_flag_dump_noblock
79 # NI irop_flag_dump_noinput
105 type => "ir_graph *",
108 comment => "The graph this block belongs to."
111 type => "ir_visited_t",
112 name => "block_visited",
114 comment => "For the walker that walks over all blocks."
118 name => "is_matured",
120 comment => "If set, all in-nodes of the block are fixed."
126 comment => "If set, the block is dead (and could be replace by a Bad."
130 name => "is_mb_head",
132 comment => "Set if this block is a macroblock head."
138 comment => "Set if this block has a label assigned."
143 init => $NONE, # TODO: This is uninitialized!!
144 comment => "Can be set/unset to temporary mark a block."
147 type => "ir_node **",
149 init => $NONE, # TODO: This is uninitialized!!
150 comment => "An array to store all parameters."
153 type => "ir_dom_info",
155 init => $NONE, # TODO: This is uninitialized!!
156 comment => "Datastructure that holds information about dominators.
158 Eventually overlay with graph_arr as only valid
159 in different phases. Eventually inline the whole
163 type => "ir_dom_info",
165 init => $NONE, # TODO: This is uninitialized!!
166 comment => "Datastructure that holds information about post-dominators."
169 type => "ir_node **",
172 comment => "array with predecessors in
173 * interprocedural_view, if they differ
174 * from intraprocedural predecessors"
177 type => "unsigned *",
179 init => "new_backedge_arr(irg->obst, arity)",
180 comment => "Raw Bitfield n set to true if pred n is backedge."
183 type => "unsigned *",
184 name => "cg_backedge",
186 comment => "Raw Bitfield n set to true if pred n is interprocedural backedge."
189 type => "ir_extblk *",
192 comment => "The extended basic block this block belongs to."
195 type => "ir_region *",
197 init => $NONE, # TODO: This is uninitialized!!
198 comment => "The immediate structural region this block belongs to."
204 comment => "The macroblock depth: A distance from the macroblock header."
207 type => "ir_label_t",
210 comment => "The block label if assigned."
215 init => $NONE, # TODO: This is uninitialized!!
216 comment => "The list of Phi nodes in this block."
219 type => "struct list_head",
221 init => $NONE, # TODO: This is uninitialized!!
222 comment => "A list head for all successor edges of a block."
225 init => "\t/* macroblock header */\n".
226 "\tres->in[0] = res;\n\n".
227 "\tset_Block_matured(res, 1);\n".
228 "\tset_Block_block_visited(res, 0);\n",
230 d_pre => "\tint i;\n\tint has_unknown = 0;\n",
231 d_post => "\t/* Create and initialize array for Phi-node construction. */\n".
232 "\tif (get_irg_phase_state(current_ir_graph) == phase_building) {\n".
233 "\t\tres->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst,\n".
234 "\t\t current_ir_graph->n_loc);\n".
235 "\t\tmemset(res->attr.block.graph_arr, 0, sizeof(ir_node *) * current_ir_graph->n_loc);\n".
237 "\tfor (i = arity-1; i >= 0; i--)\n".
238 "\t\tif (is_Unknown(in[i])) {\n".
239 "\t\thas_unknown = 1;\n".
242 "\tif (!has_unknown) res = optimize_node(res);\n".
243 "\tcurrent_ir_graph->current_block = res;\n".
244 "\tIRN_VRFY_IRG(res, current_ir_graph);\n"
250 mode => "get_tarval_mode(tv)",
251 block => "get_irg_start_block(irg)",
261 init => $MANUALFROMPARAM
264 init => "set_Const_type(res, tp);\n"
273 attrs_type => "long",
281 init => "assert(get_Proj_pred(res));\n".
282 "\tassert(get_nodes_block(get_Proj_pred(res)));\n"
292 # comment => "If set, this is a strict Conv that cannot be removed."
299 mode => "get_irn_mode(op)",
305 comment => "Type of the casted node."
308 init => "assert(is_atomic_type(totype));\n"
328 ins => [ "selector" ],
334 comment => "Flavor of Cond."
338 name => "default_proj",
340 comment => "Only for non-binary Conds: biggest Proj number, i.e. the one used for default."
343 type => "cond_jmp_predicate",
345 init => "COND_JMP_PRED_NONE",
346 comment => "Only for binary Conds: The jump predication."
360 ins => [ "left", "right" ]
376 state => "exc_pinned",
377 ins => [ "mem", "left", "right" ],
378 attrs_name => "divmod",
381 type => "except_attr",
390 type => "op_pin_state",
392 initname => ".exc.pin_state"
396 name => "no_remainder",
400 d_post => "\t#if PRECISE_EXC_CONTEXT\n".
401 "\tfirm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr);\n".