Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
3fc8ae70
Commit
3fc8ae70
authored
Jul 10, 2007
by
Michael Beck
Browse files
Add ~x + 1 = -x algebraic simplification
[r15014]
parent
05064375
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/libfirm/firmstat.h
View file @
3fc8ae70
...
...
@@ -80,7 +80,8 @@ enum firmstat_optimizations_t {
FS_OPT_MUX_TO_SHR
,
/**< Mux(a > b, a, b) = a >> b */
FS_OPT_IDEM_UNARY
,
/**< Idempotent unary operation */
FS_OPT_MINUS_NOT
,
/**< -(~x) = x + 1 */
FS_OPT_NOT_MINUS_1
,
/**< ~(x-1) = -x */
FS_OPT_NOT_MINUS_1
,
/**< ~(x - 1) = -x */
FS_OPT_NOT_PLUS_1
,
/**< ~x + 1 = -x */
FS_OPT_CONST_PHI
,
/**< Constant evaluation on Phi */
FS_BE_IA32_LEA
,
/**< Lea was created */
FS_BE_IA32_LOAD_LEA
,
/**< Load merged with a Lea */
...
...
ir/ir/iropt.c
View file @
3fc8ae70
...
...
@@ -1993,6 +1993,14 @@ static ir_node *transform_node_Add(ir_node *n) {
DBG_OPT_ALGSIM0
(
oldn
,
n
,
FS_OPT_ADD_MUL_A_X_A
);
}
}
/* Here we rely on constants be on the RIGHT side */
else
if
(
is_Not
(
a
)
&&
classify_Const
(
b
)
==
CNST_ONE
)
{
/* ~x + 1 = -x */
ir_node
*
op
=
get_Not_op
(
a
);
ir_node
*
blk
=
get_irn_n
(
n
,
-
1
);
n
=
new_rd_Minus
(
get_irn_dbg_info
(
n
),
current_ir_graph
,
blk
,
op
,
mode
);
DBG_OPT_ALGSIM0
(
oldn
,
n
,
FS_OPT_NOT_PLUS_1
);
}
}
return
n
;
}
/* transform_node_Add */
...
...
ir/stat/stat_dmp.c
View file @
3fc8ae70
...
...
@@ -98,7 +98,8 @@ static const struct {
{
FS_OPT_MUX_TO_SHR
,
"algebraic simplification: Mux(a > b, a, b) = a >> b"
},
{
FS_OPT_IDEM_UNARY
,
"algebraic simplification: Idempotent unary operation"
},
{
FS_OPT_MINUS_NOT
,
"algebraic simplification: -(~x) = x + 1"
},
{
FS_OPT_NOT_MINUS_1
,
"algebraic simplification: ~(x-1) = -x"
},
{
FS_OPT_NOT_MINUS_1
,
"algebraic simplification: ~(x - 1) = -x"
},
{
FS_OPT_NOT_PLUS_1
,
"algebraic simplification: ~x + 1 = -x"
},
{
FS_OPT_CONST_PHI
,
"constant evaluation on Phi node"
},
{
FS_BE_IA32_LEA
,
"ia32 Backend transformation: Lea was created"
},
{
FS_BE_IA32_LOAD_LEA
,
"ia32 Backend transformation: Load merged with a Lea"
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment