projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add assertions if set_cur_block() is tried for a block on a wrong irg.
[libfirm]
/
ir
/
opt
/
cfopt.c
diff --git
a/ir/opt/cfopt.c
b/ir/opt/cfopt.c
index
a6adfe3
..
d01d1a7
100644
(file)
--- a/
ir/opt/cfopt.c
+++ b/
ir/opt/cfopt.c
@@
-137,7
+137,7
@@
static void merge_blocks(ir_node *node, void *ctx)
{
int i;
ir_node *new_block;
{
int i;
ir_node *new_block;
- merge_env *env = ctx;
+ merge_env *env =
(merge_env*)
ctx;
/* clear the link field for ALL nodes first */
set_irn_link(node, NULL);
/* clear the link field for ALL nodes first */
set_irn_link(node, NULL);
@@
-179,7
+179,7
@@
static void merge_blocks(ir_node *node, void *ctx)
}
/* normally, we would create a Bad block here, but this must be
}
/* normally, we would create a Bad block here, but this must be
- * prevented, so just set it
'
s cf to Bad.
+ * prevented, so just set its cf to Bad.
*/
if (is_Block_dead(new_block)) {
ir_graph *irg = get_irn_irg(node);
*/
if (is_Block_dead(new_block)) {
ir_graph *irg = get_irn_irg(node);
@@
-203,7
+203,7
@@
static void merge_blocks(ir_node *node, void *ctx)
static void remove_unreachable_blocks_and_conds(ir_node *block, void *env)
{
int i;
static void remove_unreachable_blocks_and_conds(ir_node *block, void *env)
{
int i;
- int *changed = env;
+ int *changed =
(int*)
env;
/* Check block predecessors and turn control flow into bad.
Beware of Tuple, kill them. */
/* Check block predecessors and turn control flow into bad.
Beware of Tuple, kill them. */
@@
-244,8
+244,8
@@
static void remove_unreachable_blocks_and_conds(ir_node *block, void *env)
*/
static void collect_nodes(ir_node *n, void *ctx)
{
*/
static void collect_nodes(ir_node *n, void *ctx)
{
-
ir_opcode
code = get_irn_opcode(n);
- merge_env *env
=
ctx;
+
unsigned
code = get_irn_opcode(n);
+ merge_env *env
= (merge_env*)
ctx;
if (code == iro_Block) {
/* mark the block as non-removable if it is labeled */
if (code == iro_Block) {
/* mark the block as non-removable if it is labeled */
@@
-416,7
+416,7
@@
static void optimize_blocks(ir_node *b, void *ctx)
int i, j, k, n, max_preds, n_preds, p_preds = -1;
ir_node *pred, *phi, *next;
ir_node **in;
int i, j, k, n, max_preds, n_preds, p_preds = -1;
ir_node *pred, *phi, *next;
ir_node **in;
- merge_env *env = ctx;
+ merge_env *env =
(merge_env*)
ctx;
/* Count the number of predecessor if this block is merged with pred blocks
that are empty. */
/* Count the number of predecessor if this block is merged with pred blocks
that are empty. */
@@
-427,9
+427,9
@@
static void optimize_blocks(ir_node *b, void *ctx)
in = XMALLOCN(ir_node*, max_preds);
/*- Fix the Phi nodes of the current block -*/
in = XMALLOCN(ir_node*, max_preds);
/*- Fix the Phi nodes of the current block -*/
- for (phi =
get_irn_link(b); phi != NULL; phi =
next) {
+ for (phi =
(ir_node*)get_irn_link(b); phi != NULL; phi = (ir_node*)
next) {
assert(is_Phi(phi));
assert(is_Phi(phi));
- next = get_irn_link(phi);
+ next =
(ir_node*)
get_irn_link(phi);
/* Find the new predecessors for the Phi */
p_preds = 0;
/* Find the new predecessors for the Phi */
p_preds = 0;
@@
-483,9
+483,9
@@
static void optimize_blocks(ir_node *b, void *ctx)
ir_node *next_phi;
/* we found a predecessor block at position k that will be removed */
ir_node *next_phi;
/* we found a predecessor block at position k that will be removed */
- for (phi = get_irn_link(predb); phi; phi = next_phi) {
+ for (phi =
(ir_node*)
get_irn_link(predb); phi; phi = next_phi) {
int q_preds = 0;
int q_preds = 0;
- next_phi = get_irn_link(phi);
+ next_phi =
(ir_node*)
get_irn_link(phi);
assert(is_Phi(phi));
assert(is_Phi(phi));
@@
-597,8
+597,8
@@
static void optimize_blocks(ir_node *b, void *ctx)
*/
static void remove_simple_blocks(ir_node *block, void *ctx)
{
*/
static void remove_simple_blocks(ir_node *block, void *ctx)
{
-
ir_node *new_blk = equivalent_node(block)
;
-
merge_env *env = ctx
;
+
merge_env *env = (merge_env*)ctx
;
+
ir_node *new_blk = equivalent_node(block)
;
if (new_blk != block) {
exchange(block, new_blk);
if (new_blk != block) {
exchange(block, new_blk);
@@
-622,8
+622,8
@@
static int handle_switch_cond(ir_node *cond)
{
ir_node *sel = get_Cond_selector(cond);
{
ir_node *sel = get_Cond_selector(cond);
- ir_node *proj1 = get_irn_link(cond);
- ir_node *proj2 = get_irn_link(proj1);
+ ir_node *proj1 =
(ir_node*)
get_irn_link(cond);
+ ir_node *proj2 =
(ir_node*)
get_irn_link(proj1);
ir_node *jmp, *blk;
blk = get_nodes_block(cond);
ir_node *jmp, *blk;
blk = get_nodes_block(cond);
@@
-638,7
+638,7
@@
static int handle_switch_cond(ir_node *cond)
} else if (get_irn_link(proj2) == NULL) {
/* We have two Proj's here. Check if the Cond has
a constant argument */
} else if (get_irn_link(proj2) == NULL) {
/* We have two Proj's here. Check if the Cond has
a constant argument */
- tarval *tv = value_of(sel);
+
ir_
tarval *tv = value_of(sel);
if (tv != tarval_bad) {
/* we have a constant switch */
if (tv != tarval_bad) {
/* we have a constant switch */
@@
-767,7
+767,7
@@
restart:
/* handle all collected switch-Conds */
foreach_plist(env.list, el) {
/* handle all collected switch-Conds */
foreach_plist(env.list, el) {
- cond = plist_element_get_value(el);
+ cond =
(ir_node*)
plist_element_get_value(el);
env.changed |= handle_switch_cond(cond);
}
plist_free(env.list);
env.changed |= handle_switch_cond(cond);
}
plist_free(env.list);