projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
must use Lg, not Ne to check for !=
[libfirm]
/
ir
/
opt
/
opt_osr.c
diff --git
a/ir/opt/opt_osr.c
b/ir/opt/opt_osr.c
index
f7af05a
..
7144e18
100644
(file)
--- a/
ir/opt/opt_osr.c
+++ b/
ir/opt/opt_osr.c
@@
-322,24
+322,25
@@
static ir_node *do_apply(ir_opcode code, dbg_info *db, ir_node *op1, ir_node *op
*
* @return the newly created node
*/
*
* @return the newly created node
*/
-static ir_node *apply(ir_node *orig, ir_node *op1, ir_node *op2, iv_env *env) {
+static ir_node *apply(ir_node *
header, ir_node *
orig, ir_node *op1, ir_node *op2, iv_env *env) {
ir_opcode code = get_irn_opcode(orig);
ir_node *result = search(code, op1, op2, env);
ir_opcode code = get_irn_opcode(orig);
ir_node *result = search(code, op1, op2, env);
- if (
! result
) {
+ if (
result == NULL
) {
dbg_info *db = get_irn_dbg_info(orig);
ir_node *op1_header = get_irn_ne(op1, env)->header;
ir_node *op2_header = get_irn_ne(op2, env)->header;
dbg_info *db = get_irn_dbg_info(orig);
ir_node *op1_header = get_irn_ne(op1, env)->header;
ir_node *op2_header = get_irn_ne(op2, env)->header;
- if (op1_header
!= NULL
&& is_rc(op2, op1_header)) {
+ if (op1_header
== header
&& is_rc(op2, op1_header)) {
result = reduce(orig, op1, op2, env);
}
result = reduce(orig, op1, op2, env);
}
- else if (op2_header
!= NULL
&& is_rc(op1, op2_header)) {
+ else if (op2_header
== header
&& is_rc(op1, op2_header)) {
result = reduce(orig, op2, op1, env);
}
else {
result = do_apply(code, db, op1, op2, get_irn_mode(orig));
result = reduce(orig, op2, op1, env);
}
else {
result = do_apply(code, db, op1, op2, get_irn_mode(orig));
- get_irn_ne(result, env)->header = NULL; }
+ get_irn_ne(result, env)->header = NULL;
+ }
}
return result;
}
}
return result;
}
@@
-359,7
+360,7
@@
static ir_node *reduce(ir_node *orig, ir_node *iv, ir_node *rc, iv_env *env) {
ir_opcode code = get_irn_opcode(orig);
ir_node *result = search(code, iv, rc, env);
ir_opcode code = get_irn_opcode(orig);
ir_node *result = search(code, iv, rc, env);
- if (
! result
) {
+ if (
result == NULL
) {
node_entry *e, *iv_e;
int i, n;
ir_mode *mode = get_irn_mode(orig);
node_entry *e, *iv_e;
int i, n;
ir_mode *mode = get_irn_mode(orig);
@@
-390,7
+391,7
@@
static ir_node *reduce(ir_node *orig, ir_node *iv, ir_node *rc, iv_env *env) {
if (e->header == iv_e->header)
o = reduce(orig, o, rc, env);
else if (is_Phi(result) || code == iro_Mul)
if (e->header == iv_e->header)
o = reduce(orig, o, rc, env);
else if (is_Phi(result) || code == iro_Mul)
- o = apply(orig, o, rc, env);
+ o = apply(
iv_e->header,
orig, o, rc, env);
set_irn_n(result, i, o);
}
}
set_irn_n(result, i, o);
}
}
@@
-427,7
+428,7
@@
static void update_scc(ir_node *iv, node_entry *e, iv_env *env) {
node_entry *pe = get_irn_ne(pred, env);
if (pe->header == header && pe->pscc == NULL) {
node_entry *pe = get_irn_ne(pred, env);
if (pe->header == header && pe->pscc == NULL) {
- /* set the psc here to ensure that the node is NOT enqueued another time */
+ /* set the psc
c
here to ensure that the node is NOT enqueued another time */
pe->pscc = pscc;
waitq_put(wq, pred);
}
pe->pscc = pscc;
waitq_put(wq, pred);
}
@@
-468,6
+469,7
@@
static int replace(ir_node *irn, ir_node *iv, ir_node *rc, iv_env *env) {
return 0;
}
return 0;
}
+#if 0
/**
* check if a given node is a mul with 2, 4, 8
*/
/**
* check if a given node is a mul with 2, 4, 8
*/
@@
-493,6
+495,7
@@
static int is_x86_shift_const(ir_node *mul) {
}
return 0;
}
}
return 0;
}
+#endif
/**
* Check if an IV represents a counter with constant limits.
/**
* Check if an IV represents a counter with constant limits.
@@
-661,11
+664,6
@@
static int check_replace(ir_node *irn, iv_env *env) {
if (! check_users_for_reg_pressure(iv, env))
return 0;
}
if (! check_users_for_reg_pressure(iv, env))
return 0;
}
- /* check for x86 constants */
- if (env->flags & osr_flag_ignore_x86_shift)
- if (is_x86_shift_const(irn))
- return 0;
-
return replace(irn, iv, rc, env);
}
break;
return replace(irn, iv, rc, env);
}
break;
@@
-1299,7
+1297,8
@@
void opt_osr(ir_graph *irg, unsigned flags) {
if (env.replaced) {
/* try linear function test replacements */
if (env.replaced) {
/* try linear function test replacements */
- lftr(irg, &env);
+ //lftr(irg, &env); // currently buggy :-(
+ (void) lftr;
set_irg_outs_inconsistent(irg);
DB((dbg, LEVEL_1, "Replacements: %u + %u (lftr)\n\n", env.replaced, env.lftr_replaced));
set_irg_outs_inconsistent(irg);
DB((dbg, LEVEL_1, "Replacements: %u + %u (lftr)\n\n", env.replaced, env.lftr_replaced));