X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=scripts%2Fgen_ir.py;h=c6badca32c50b1b6ef7405698bf9687b1c94e74b;hb=8bced5f492333d7ac6080e8cb313da3aeef431ff;hp=3d06eac90d55ba26f50352730508d861f4c0d9a3;hpb=5f9013339e1d6492a0960bd6a4c470eb29351c7e;p=libfirm diff --git a/scripts/gen_ir.py b/scripts/gen_ir.py index 3d06eac90..c6badca32 100755 --- a/scripts/gen_ir.py +++ b/scripts/gen_ir.py @@ -285,10 +285,12 @@ ir_node *new_rd_{{node.constrname}}( {% endfilter %}) { ir_node *res; - ir_graph *rem = current_ir_graph; + {%- if node.arity == "dynamic" %} + int i; + {%- endif %} {{node|irgassign}} {{node|insdecl}} - current_ir_graph = irg; + res = new_ir_node( {%- filter arguments %} dbgi @@ -298,6 +300,11 @@ ir_node *new_rd_{{node.constrname}}( {{node.mode}} {{node|arity_and_ins}} {% endfilter %}); + {%- if node.arity == "dynamic" %} + for (i = 0; i < arity; ++i) { + add_irn_n(res, in[i]); + } + {%- endif %} {%- for attr in node.attrs %} res->attr.{{node.attrs_name}}{{attr["initname"]}} = {%- if "init" in attr %} {{ attr["init"] -}}; @@ -308,11 +315,8 @@ ir_node *new_rd_{{node.constrname}}( res->attr.{{node.attrs_name}}{{attr["initname"]}} = {{ attr["init"] -}}; {%- endfor %} {{- node.init }} - {%- if node.optimize != False %} res = optimize_node(res); - {%- endif %} - IRN_VERIFY_IRG(res, irg); - current_ir_graph = rem; + irn_verify_irg(res, irg); return res; } @@ -337,15 +341,13 @@ ir_node *new_d_{{node.constrname}}( {% endfilter %}) { ir_node *res; + assert(get_irg_phase_state(current_ir_graph) == phase_building); res = new_rd_{{node.constrname}}( {%- filter parameters %} dbgi {{node|curblock}} {{node|nodearguments}} {% endfilter %}); - {%- if "fragile" in node.flags %} - firm_alloc_frag_arr(res, op_{{node.name}}, &res->attr.except.frag_arr); - {%- endif %} return res; } @@ -573,7 +575,7 @@ def main(argv): gendir2 = argv[2] + "/../../include/libfirm" # List of TODOs - niymap = [ "ASM", "Const", "Phi", "SymConst", "Sync"] + niymap = [ "ASM", "Const", "Phi", "SymConst" ] real_nodes = prepare_nodes() file = open(gendir + "/gen_ir_cons.c.inl", "w") @@ -581,7 +583,7 @@ def main(argv): if node.name in niymap: continue - if not isAbstract(node) and not hasattr(node, "singleton"): + if not isAbstract(node) and not hasattr(node, "noconstructor"): file.write(constructor_template.render(vars())) if hasattr(node, "special_constructors"):