Commit f37b4dbb authored by Michael Beck's avatar Michael Beck
Browse files

- add support for opcode specific hash function

- add hash function for ia32 Immediates
- unified comments for all specifications

[r20629]
parent 688d7e63
......@@ -26,11 +26,16 @@ $arch = "TEMPLATE";
# comment => "any comment for constructor", # optional
# reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
# cmp_attr => "c source code for comparing node attributes", # optional
# outs => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" } # optional, creates n_op_in1, ... consts
# mode => "mode_Iu" # optional, predefines the mode
# outs => { "out1", "out2" },# optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" }, # optional, creates n_op_in1, ... consts
# mode => "mode_Iu", # optional, predefines the mode
# emit => "emit code with templates", # optional for virtual nodes
# rd_constructor => "c source code which constructs an ir_node" # optional
# attr => "attitional attribute arguments for constructor", # optional
# init_attr => "emit attribute initialization template", # optional
# rd_constructor => "c source code which constructs an ir_node", # optional
# hash_func => "name of the hash function for this operation", # optional, get the default hash function else
# latency => "latency of this operation (can be float)" # optional
# attr_type => "name of the attribute struct", # optional
# },
#
# ... # (all nodes you need to describe)
......
......@@ -28,10 +28,14 @@ $new_emit_syntax = 1;
# comment => "any comment for constructor",
# reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
# cmp_attr => "c source code for comparing node attributes",
# outs => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" } # optional, creates n_op_in1, ... consts
# mode => "mode_Iu" # optional, predefines the mode
# emit => "emit code with templates",
# attr => "attitional attribute arguments for constructor"
# init_attr => "emit attribute initialization template"
# attr => "attitional attribute arguments for constructor",
# init_attr => "emit attribute initialization template",
# rd_constructor => "c source code which constructs an ir_node"
# hash_func => "name of the hash function for this operation",
# latency => "latency of this operation (can be float)"
# attr_type => "name of the attribute struct",
# },
......
......@@ -1231,6 +1231,15 @@ int ia32_compare_asm_attr(ir_node *a, ir_node *b)
return 0;
}
/**
* Hash function for Immediates
*/
static unsigned ia32_hash_Immediate(const ir_node *irn) {
const ia32_immediate_attr_t *a = get_ia32_immediate_attr_const(irn);
return HASH_PTR(a->symconst) + (a->sc_sign << 16) + a->offset;
}
/** Compare node attributes for Immediates. */
static
int ia32_compare_immediate_attr(ir_node *a, ir_node *b)
......
......@@ -28,10 +28,15 @@ $arch = "ia32";
# comment => "any comment for constructor",
# reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
# cmp_attr => "c source code for comparing node attributes",
# outs => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" } # optional, creates n_op_in1, ... consts
# mode => "mode_Iu" # optional, predefines the mode
# emit => "emit code with templates",
# attr => "attitional attribute arguments for constructor"
# init_attr => "emit attribute initialization template"
# rd_constructor => "c source code which constructs an ir_node"
# attr => "attitional attribute arguments for constructor",
# init_attr => "emit attribute initialization template",
# rd_constructor => "c source code which constructs an ir_node",
# hash_func => "name of the hash function for this operation",
# latency => "latency of this operation (can be float)"
# attr_type => "name of the attribute struct",
# },
#
......@@ -318,6 +323,7 @@ Immediate => {
reg_req => { out => [ "gp_NOREG" ] },
attr => "ir_entity *symconst, int symconst_sign, long offset",
attr_type => "ia32_immediate_attr_t",
hash_func => "ia32_hash_Immediate",
latency => 0,
mode => $mode_gp,
},
......
......@@ -21,11 +21,19 @@ $new_emit_syntax = 1;
# { "type" => "type 2", "name" => "name 2" },
# ...
# ],
# "comment" => "any comment for constructor",
# comment => "any comment for constructor",
# reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
# "cmp_attr" => "c source code for comparing node attributes",
# cmp_attr => "c source code for comparing node attributes",
# outs => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" } # optional, creates n_op_in1, ... consts
# mode => "mode_Iu" # optional, predefines the mode
# emit => "emit code with templates",
# "rd_constructor" => "c source code which constructs an ir_node"
# attr => "attitional attribute arguments for constructor",
# init_attr => "emit attribute initialization template",
# rd_constructor => "c source code which constructs an ir_node",
# hash_func => "name of the hash function for this operation",
# latency => "latency of this operation (can be float)"
# attr_type => "name of the attribute struct",
# },
#
# ... # (all nodes you need to describe)
......
......@@ -22,11 +22,19 @@ $new_emit_syntax = 1;
# { "type" => "type 2", "name" => "name 2" },
# ...
# ],
# "comment" => "any comment for constructor",
# "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
# "cmp_attr" => "c source code for comparing node attributes",
# "emit" => "emit code with templates",
# "rd_constructor" => "c source code which constructs an ir_node"
# comment => "any comment for constructor",
# reg_req => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
# cmp_attr => "c source code for comparing node attributes",
# outs => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
# ins => { "in1", "in2" } # optional, creates n_op_in1, ... consts
# mode => "mode_Iu" # optional, predefines the mode
# emit => "emit code with templates",
# attr => "attitional attribute arguments for constructor",
# init_attr => "emit attribute initialization template",
# rd_constructor => "c source code which constructs an ir_node",
# hash_func => "name of the hash function for this operation",
# latency => "latency of this operation (can be float)"
# attr_type => "name of the attribute struct",
# },
#
# ... # (all nodes you need to describe)
......
......@@ -265,6 +265,12 @@ foreach my $op (keys(%nodes)) {
$attr_type = $default_attr_type;
}
# determine hash function
my $hash_func;
if (exists($n{"hash_func"})) {
$hash_func = $n{"hash_func"};
}
# determine compare function
my $cmp_attr_func;
if (exists($n{"cmp_attr"})) {
......@@ -575,6 +581,9 @@ foreach my $op (keys(%nodes)) {
if (defined($copy_attr_func)) {
push(@obst_new_irop, "\tops.copy_attr = ${copy_attr_func};\n");
}
if (defined($hash_func)) {
push(@obst_new_irop, "\tops.hash = ${hash_func};\n");
}
$n_opcodes++;
my $n_res = $out_arity;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment