From 799d89c9a3af71d26c257a1bf4b1ca029f1ff675 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 13 Sep 2011 16:50:59 +0200 Subject: [PATCH] some cleanups for middleend node creation in backends Some backends create nodes in their lower_for_target phases already. These nodes are placeholders for real backend nodes later, in contrast they do not have register requirements or backend attributes. Simplified this by allowing custom dumpers for them and leaving out the backend node structs. --- ir/be/ia32/ia32_spec.pl | 45 ++++++++++++++------------- ir/be/scripts/generate_new_opcodes.pl | 8 +++-- ir/be/sparc/sparc_new_nodes.c | 3 -- ir/be/sparc/sparc_spec.pl | 4 +++ 4 files changed, 33 insertions(+), 27 deletions(-) diff --git a/ir/be/ia32/ia32_spec.pl b/ir/be/ia32/ia32_spec.pl index 6715190e0..acaffc12a 100644 --- a/ir/be/ia32/ia32_spec.pl +++ b/ir/be/ia32/ia32_spec.pl @@ -309,14 +309,15 @@ Adc => { }, l_Add => { - op_flags => [ "constlike" ], - reg_req => { in => [ "none", "none" ], out => [ "none" ] }, ins => [ "left", "right" ], + attr_type => "", + dump_func => "NULL", }, l_Adc => { - reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] }, ins => [ "left", "right", "eflags" ], + attr_type => "", + dump_func => "NULL", }, Mul => { @@ -335,14 +336,10 @@ Mul => { }, l_Mul => { - # we should not rematrialize this node. It produces 2 results and has - # very strict constraints - op_flags => [ "constlike" ], - cmp_attr => "return 1;", - reg_req => { in => [ "none", "none" ], - out => [ "none", "none", "none", "none" ] }, ins => [ "left", "right" ], outs => [ "res_low", "flags", "M", "res_high" ], + attr_type => "", + dump_func => "NULL", }, IMul => { @@ -376,12 +373,10 @@ IMul1OP => { }, l_IMul => { - op_flags => [ "constlike" ], - cmp_attr => "return 1;", - reg_req => { in => [ "none", "none" ], - out => [ "none", "none", "none", "none" ] }, ins => [ "left", "right" ], outs => [ "res_low", "flags", "M", "res_high" ], + attr_type => "", + dump_func => "NULL", }, And => { @@ -579,13 +574,15 @@ Sbb0 => { }, l_Sub => { - reg_req => { in => [ "none", "none" ], out => [ "none" ] }, ins => [ "minuend", "subtrahend" ], + attr_type => "", + dump_func => "NULL", }, l_Sbb => { - reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] }, ins => [ "minuend", "subtrahend", "eflags" ], + attr_type => "", + dump_func => "NULL", }, IDiv => { @@ -977,6 +974,14 @@ Test8Bit => { modified_flags => $status_flags }, +l_Setcc => { + ins => [ "cond" ], + outs => [ "res" ], + mode => "mode_Bu", + attr_type => "", + dump_func => "NULL", +}, + Setcc => { #irn_flags => [ "rematerializable" ], reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] }, @@ -1919,18 +1924,16 @@ CvtSI2SD => { l_LLtoFloat => { - op_flags => [ "labeled" ], - cmp_attr => "return 1;", ins => [ "val_high", "val_low" ], - reg_req => { in => [ "none", "none" ], out => [ "none" ] } + attr_type => "", + dump_func => "NULL", }, l_FloattoLL => { - op_flags => [ "labeled" ], - cmp_attr => "return 1;", ins => [ "val" ], outs => [ "res_high", "res_low" ], - reg_req => { in => [ "none" ], out => [ "none", "none" ] } + attr_type => "", + dump_func => "NULL", }, CopyB => { diff --git a/ir/be/scripts/generate_new_opcodes.pl b/ir/be/scripts/generate_new_opcodes.pl index 08ce0c977..af8e2f94b 100755 --- a/ir/be/scripts/generate_new_opcodes.pl +++ b/ir/be/scripts/generate_new_opcodes.pl @@ -655,12 +655,14 @@ EOF } # set default values for state and flags if not given - $n{"state"} = "floats" if (! exists($n{"state"})); - $n{"op_flags"} = ["none"] if (! exists($n{"op_flags"})); + $n{"state"} = "floats" if (! exists($n{"state"})); + $n{"op_flags"} = ["none"] if (! exists($n{"op_flags"})); + $n{"dump_func"} = "${arch}_dump_node" if (!exists($n{"dump_func"})); + my $dump_func = $n{"dump_func"}; push(@obst_new_irop, "\n\tmemset(&ops, 0, sizeof(ops));\n"); push(@obst_new_irop, "\tops.be_ops = be_ops;\n"); - push(@obst_new_irop, "\tops.dump_node = $arch\_dump_node;\n"); + push(@obst_new_irop, "\tops.dump_node = ${dump_func};\n"); if (defined($cmp_attr_func)) { push(@obst_new_irop, "\tops.node_cmp_attr = ${cmp_attr_func};\n"); diff --git a/ir/be/sparc/sparc_new_nodes.c b/ir/be/sparc/sparc_new_nodes.c index 558872e28..20db725f3 100644 --- a/ir/be/sparc/sparc_new_nodes.c +++ b/ir/be/sparc/sparc_new_nodes.c @@ -93,9 +93,6 @@ static void sparc_dump_node(FILE *F, ir_node *n, dump_reason_t reason) break; case dump_node_info_txt: - if (is_sparc_AddX_t(n) || is_sparc_AddCC_t(n)) - break; - arch_dump_reqs_and_registers(F, n); sparc_attr = get_sparc_attr_const(n); if (sparc_attr->immediate_value_entity) { diff --git a/ir/be/sparc/sparc_spec.pl b/ir/be/sparc/sparc_spec.pl index 005dc2e48..6c1df1f7e 100644 --- a/ir/be/sparc/sparc_spec.pl +++ b/ir/be/sparc/sparc_spec.pl @@ -284,11 +284,13 @@ AddCC_t => { ins => [ "left", "right" ], outs => [ "res", "flags" ], attr_type => "", + dump_node => "NULL", }, AddX_t => { ins => [ "left", "right", "flags_input" ], attr_type => "", + dump_node => "NULL", }, Sub => { @@ -316,11 +318,13 @@ SubCC_t => { ins => [ "left", "right" ], outs => [ "res", "flags" ], attr_type => "", + dump_node => "NULL", }, SubX_t => { ins => [ "left", "right", "flags_input" ], attr_type => "", + dump_node => "NULL", }, # Load / Store -- 2.20.1