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

- fixed CSE and Combo for Builtin nodes

[r24811]
parent d266f572
......@@ -571,6 +571,11 @@ divmod_attr *get_irn_divmod_attr(ir_node *node) {
return &node->attr.divmod;
}
builtin_attr *get_irn_builtin_attr(ir_node *node) {
assert(is_Builtin(node));
return &node->attr.builtin;
}
void *(get_irn_generic_attr)(ir_node *node) {
assert(is_ir_node(node));
return _get_irn_generic_attr(node);
......
......@@ -58,6 +58,7 @@ load_attr *get_irn_load_attr (ir_node *node);
store_attr *get_irn_store_attr (ir_node *node);
except_attr *get_irn_except_attr (ir_node *node);
divmod_attr *get_irn_divmod_attr (ir_node *node);
builtin_attr *get_irn_builtin_attr (ir_node *node);
/** @} */
/**
......
......@@ -5943,9 +5943,19 @@ static int node_cmp_attr_Quot(ir_node *a, ir_node *b) {
/** Compares the attributes of two Confirm nodes. */
static int node_cmp_attr_Confirm(ir_node *a, ir_node *b) {
/* no need to compare the bound, as this is a input */
return (get_Confirm_cmp(a) != get_Confirm_cmp(b));
} /* node_cmp_attr_Confirm */
/** Compares the attributes of two Builtin nodes. */
static int node_cmp_attr_Builtin(ir_node *a, ir_node *b) {
const builtin_attr *ma = get_irn_builtin_attr(a);
const builtin_attr *mb = get_irn_builtin_attr(b);
/* no need to compare the type, equal kind means equal type */
return ma->kind != mb->kind;
} /* node_cmp_attr_Builtin */
/** Compares the attributes of two ASM nodes. */
static int node_cmp_attr_ASM(ir_node *a, ir_node *b) {
int i, n;
......@@ -6029,6 +6039,7 @@ static ir_op_ops *firm_set_default_node_cmp_attr(ir_opcode code, ir_op_ops *ops)
CASE(Mod);
CASE(Quot);
CASE(Bound);
CASE(Builtin);
/* FIXME CopyB */
default:
/* leave NULL */;
......
......@@ -112,6 +112,7 @@ struct opcode_key_t {
long proj; /**< For Proj nodes, its proj number */
ir_entity *ent; /**< For Sel Nodes, its entity */
int intVal; /**< For Conv/Div Nodes: strict/remainderless */
unsigned uintVal;/**< for Builtin: the kind */
ir_node *block; /**< for Block: itself */
void *ptr; /**< generic pointer for hash/cmp */
} u;
......@@ -295,6 +296,9 @@ static void check_opcode(const partition_t *Z) {
case iro_Load:
key.mode = get_Load_mode(irn);
break;
case iro_Builtin:
key.u.uintVal = get_Builtin_kind(irn);
break;
default:
break;
}
......@@ -323,6 +327,9 @@ static void check_opcode(const partition_t *Z) {
case iro_Load:
assert(key.mode == get_Load_mode(irn));
break;
case iro_Builtin:
assert(key.u.uintVal == get_Builtin_kind(irn));
break;
default:
break;
}
......@@ -578,7 +585,7 @@ static int cmp_opcode(const void *elt, const void *key, size_t size) {
return o1->code != o2->code || o1->mode != o2->mode ||
o1->arity != o2->arity ||
o1->u.proj != o2->u.proj ||
o1->u.intVal != o2->u.intVal ||
o1->u.intVal != o2->u.intVal || /* this already checks uIntVal */
o1->u.ptr != o2->u.ptr;
} /* cmp_opcode */
......@@ -1680,6 +1687,9 @@ static void *lambda_opcode(const node_t *node, environment_t *env) {
case iro_Load:
key.mode = get_Load_mode(irn);
break;
case iro_Builtin:
key.u.uintVal = get_Builtin_kind(irn);
break;
default:
break;
}
......
Markdown is supported
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