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
6be9d429
Commit
6be9d429
authored
Jul 16, 2007
by
Michael Beck
Browse files
removed the new get_block/set_block stuff; not working; :-(
[r15168]
parent
5e259561
Changes
27
Hide whitespace changes
Inline
Side-by-side
include/libfirm/irgraph.h
View file @
6be9d429
...
...
@@ -513,6 +513,9 @@ static INLINE void clear_using_irn_link(ir_graph *irg) { (void) irg; }
static
INLINE
int
using_irn_link
(
const
ir_graph
*
irg
)
{
(
void
)
irg
;
return
0
;
}
#endif
/** Normalization: Move Proj nodes into the same block as its predecessors */
void
normalize_proj_nodes
(
ir_graph
*
irg
);
/** set a description for local value n */
void
set_irg_loc_description
(
ir_graph
*
irg
,
int
n
,
void
*
description
);
...
...
include/libfirm/irop.h
View file @
6be9d429
...
...
@@ -223,19 +223,6 @@ op_func get_generic_function_ptr(const ir_op *op);
*/
void
set_generic_function_ptr
(
ir_op
*
op
,
op_func
func
);
/**
* The get_nodes_block operation.
* This operation returns the block of a node.
* For block nodes, it returns its Macroblock header.
*/
typedef
ir_node
*
(
*
get_block_func
)(
const
ir_node
*
self
);
/**
* The set_nodes_block operation.
* This operation sets the block of a node.
*/
typedef
void
(
*
set_block_func
)(
ir_node
*
self
,
ir_node
*
block
);
/**
* The compute value operation.
* This operation evaluates an IR node into a tarval if possible,
...
...
@@ -344,21 +331,19 @@ typedef int (*dump_node_func)(ir_node *self, FILE *F, dump_reason_t reason);
* io_op Operations.
*/
typedef
struct
{
get_block_func
get_block
;
/**< Return the block of a node. */
set_block_func
set_block
;
/**< Sets the block of a node. */
computed_value_func
computed_value
;
/**< Evaluates a node into a tarval if possible. */
equivalent_node_func
equivalent_node
;
/**< Optimizes the node by returning an equivalent one. */
transform_node_func
transform_node
;
/**< Optimizes the node by transforming it. */
node_cmp_attr_func
node_cmp_attr
;
/**< Compares two node attributes. */
reassociate_func
reassociate
;
/**< Reassociate a tree. */
copy_attr_func
copy_attr
;
/**< Copy node attributes. */
get_type_func
get_type
;
/**< Return the type of a node. */
get_type_attr_func
get_type_attr
;
/**< Return the type attribute of a node. */
get_entity_attr_func
get_entity_attr
;
/**< Return the entity attribute of a node. */
verify_node_func
verify_node
;
/**< Verify the node. */
verify_proj_node_func
verify_proj_node
;
/**< Verify the Proj node. */
dump_node_func
dump_node
;
/**< Dump a node. */
op_func
generic
;
/**< A generic function. */
computed_value_func
computed_value
;
/**< evaluates a node into a tarval if possible. */
equivalent_node_func
equivalent_node
;
/**< optimizes the node by returning an equivalent one. */
transform_node_func
transform_node
;
/**< optimizes the node by transforming it. */
node_cmp_attr_func
node_cmp_attr
;
/**< compares two node attributes. */
reassociate_func
reassociate
;
/**< reassociate a tree */
copy_attr_func
copy_attr
;
/**< copy node attributes */
get_type_func
get_type
;
/**< return the type of a node */
get_type_attr_func
get_type_attr
;
/**< return the type attribute of a node */
get_entity_attr_func
get_entity_attr
;
/**< return the entity attribute of a node */
verify_node_func
verify_node
;
/**< verify the node */
verify_proj_node_func
verify_proj_node
;
/**< verify the Proj node */
dump_node_func
dump_node
;
/**< dump a node */
op_func
generic
;
/**< a generic function */
}
ir_op_ops
;
/**
...
...
ir/ana/execution_frequency.c
View file @
6be9d429
...
...
@@ -160,7 +160,7 @@ my_irg_walk_2_both(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void
if
(
node
->
op
==
op_Proj
)
pred
=
get_irn_n
(
node
,
0
);
else
pred
=
get_
nodes_block
(
node
);
pred
=
get_
irn_n
(
node
,
-
1
);
if
(
pred
->
visited
<
current_ir_graph
->
visited
)
my_irg_walk_2_both
(
pred
,
pre
,
post
,
env
);
}
...
...
ir/ana/irextbb.c
View file @
6be9d429
...
...
@@ -279,7 +279,7 @@ void free_extbb(ir_graph *irg) {
/* Return the extended block of a node. */
ir_extblk
*
get_nodes_extbb
(
ir_node
*
node
)
{
ir_node
*
block
=
is_Block
(
node
)
?
node
:
get_
nodes_block
(
node
);
ir_node
*
block
=
is_Block
(
node
)
?
node
:
get_
irn_n
(
node
,
-
1
);
return
get_Block_extbb
(
block
);
}
...
...
ir/ana/irouts.c
View file @
6be9d429
...
...
@@ -111,7 +111,7 @@ int get_Block_n_cfg_outs_ka(ir_node *bl) {
if
(
get_irn_mode
(
bl
->
out
[
i
])
==
mode_X
)
{
/* ignore End if we are in the Endblock */
if
(
get_irn_op
(
bl
->
out
[
i
])
==
op_End
&&
get_
nodes_block
(
bl
->
out
[
i
])
==
bl
)
get_
irn_n
(
bl
->
out
[
i
]
,
-
1
)
==
bl
)
continue
;
else
++
n_cfg_outs
;
...
...
@@ -149,13 +149,13 @@ ir_node *get_Block_cfg_out_ka(ir_node *bl, int pos) {
if
(
get_irn_mode
(
bl
->
out
[
i
])
==
mode_X
)
{
/* ignore End if we are in the Endblock */
if
(
get_irn_op
(
bl
->
out
[
i
])
==
op_End
&&
get_
nodes_block
(
bl
->
out
[
i
])
==
bl
)
get_
irn_n
(
bl
->
out
[
i
]
,
-
1
)
==
bl
)
continue
;
if
(
out_pos
==
pos
)
{
ir_node
*
cfop
=
bl
->
out
[
i
];
/* handle keep-alive here */
if
(
get_irn_op
(
cfop
)
==
op_End
)
return
get_
nodes_block
(
cfop
);
return
get_
irn_n
(
cfop
,
-
1
);
return
cfop
->
out
[
1
];
}
else
++
out_pos
;
...
...
@@ -237,7 +237,7 @@ void irg_out_block_walk(ir_node *node,
}
/*--------------------------------------------------------------------*/
/** Building and Removing the out datast
r
ucture **/
/** Building and Removing the out datastu
r
cture **/
/** **/
/** The outs of a graph are allocated in a single, large array. **/
/** This allows to allocate and deallocate the memory for the outs **/
...
...
@@ -258,31 +258,21 @@ void irg_out_block_walk(ir_node *node,
/** Returns the amount of out edges for not yet visited successors. */
static
int
_count_outs
(
ir_node
*
n
)
{
int
i
,
res
,
irn_arity
;
int
start
,
i
,
res
,
irn_arity
;
mark_irn_visited
(
n
);
n
->
out
=
(
ir_node
**
)
1
;
/* Space for array size. */
start
=
is_Block
(
n
)
?
0
:
-
1
;
irn_arity
=
get_irn_arity
(
n
);
res
=
irn_arity
+
1
;
res
=
irn_arity
-
start
+
1
;
/* --1 or --0; 1 for array size. */
if
(
is_no_Block
(
n
))
{
ir_node
*
pred
=
get_nodes_block
(
n
);
/* count outs for predecessors */
if
(
irn_not_visited
(
pred
))
res
+=
_count_outs
(
pred
);
/* Count my outs */
pred
->
out
=
(
ir_node
**
)
INT_TO_PTR
(
PTR_TO_INT
(
pred
->
out
)
+
1
);
++
res
;
}
for
(
i
=
0
;
i
<
irn_arity
;
++
i
)
{
for
(
i
=
start
;
i
<
irn_arity
;
++
i
)
{
/* Optimize Tuples. They annoy if walking the cfg. */
ir_node
*
pred
=
skip_Tuple
(
get_irn_n
(
n
,
i
));
set_irn_n
(
n
,
i
,
pred
);
/* count outs for
prede
cessors */
/* count outs for
suc
cessors */
if
(
irn_not_visited
(
pred
))
res
+=
_count_outs
(
pred
);
...
...
@@ -328,7 +318,7 @@ static int count_outs(ir_graph *irg) {
* @return The next free address
*/
static
ir_node
**
_set_out_edges
(
ir_node
*
n
,
ir_node
**
free
)
{
int
n_outs
,
i
,
irn_arity
;
int
n_outs
,
start
,
i
,
irn_arity
;
ir_node
*
pred
;
set_irn_visited
(
n
,
get_irg_visited
(
current_ir_graph
));
...
...
@@ -345,18 +335,10 @@ static ir_node **_set_out_edges(ir_node *n, ir_node **free) {
edge. */
n
->
out
[
0
]
=
(
ir_node
*
)
0
;
if
(
is_no_Block
(
n
))
{
pred
=
get_nodes_block
(
n
);
/* Recursion */
if
(
get_irn_visited
(
pred
)
<
get_irg_visited
(
current_ir_graph
))
free
=
_set_out_edges
(
pred
,
free
);
/* Remember our back edge */
pred
->
out
[
get_irn_n_outs
(
pred
)
+
1
]
=
n
;
pred
->
out
[
0
]
=
INT_TO_PTR
(
get_irn_n_outs
(
pred
)
+
1
);
}
start
=
is_Block
(
n
)
?
0
:
-
1
;
irn_arity
=
get_irn_arity
(
n
);
for
(
i
=
0
;
i
<
irn_arity
;
++
i
)
{
for
(
i
=
start
;
i
<
irn_arity
;
++
i
)
{
pred
=
get_irn_n
(
n
,
i
);
/* Recursion */
if
(
get_irn_visited
(
pred
)
<
get_irg_visited
(
current_ir_graph
))
...
...
@@ -512,20 +494,16 @@ static void init_count(ir_node * node, void *env) {
* which is saved in "env"
*/
static
void
node_arity_count
(
ir_node
*
node
,
void
*
env
)
{
int
*
anz
=
(
int
*
)
env
,
arity
,
n_outs
,
i
;
int
*
anz
=
(
int
*
)
env
,
arity
,
n_outs
,
i
,
start
;
ir_node
*
succ
;
arity
=
get_irn_arity
(
node
);
n_outs
=
1
+
arity
;
if
(
is_no_Block
(
node
))
{
succ
=
get_nodes_block
(
node
);
succ
->
out
=
(
ir_node
**
)
INT_TO_PTR
(
PTR_TO_INT
(
succ
->
out
)
+
1
);
start
=
(
is_Block
(
node
))
?
0
:
-
1
;
++
n_outs
;
}
n_outs
=
1
+
arity
+
(
-
start
);
// ((is_Block(node)) ? 0 : 1); // Why + 1??
*
anz
+=
n_outs
;
for
(
i
=
0
;
i
<
arity
;
i
++
)
{
for
(
i
=
start
;
i
<
arity
;
i
++
)
{
succ
=
get_irn_n
(
node
,
i
);
succ
->
out
=
(
ir_node
**
)
INT_TO_PTR
(
PTR_TO_INT
(
succ
->
out
)
+
1
);
}
...
...
@@ -575,15 +553,10 @@ static void set_array_pointer(ir_node *node, void *env) {
static
void
set_out_pointer
(
ir_node
*
node
,
void
*
env
)
{
int
i
,
arity
=
get_irn_arity
(
node
);
ir_node
*
succ
;
int
start
=
(
!
is_Block
(
node
))
?
-
1
:
0
;
(
void
)
env
;
if
(
is_no_Block
(
node
))
{
succ
=
get_nodes_block
(
node
);
succ
->
out
[
get_irn_n_outs
(
succ
)
+
1
]
=
node
;
succ
->
out
[
0
]
=
INT_TO_PTR
(
get_irn_n_outs
(
succ
)
+
1
);
}
for
(
i
=
0
;
i
<
arity
;
++
i
)
{
for
(
i
=
start
;
i
<
arity
;
++
i
)
{
succ
=
get_irn_n
(
node
,
i
);
succ
->
out
[
get_irn_n_outs
(
succ
)
+
1
]
=
node
;
succ
->
out
[
0
]
=
INT_TO_PTR
(
get_irn_n_outs
(
succ
)
+
1
);
...
...
ir/be/beabi.c
View file @
6be9d429
...
...
@@ -1971,7 +1971,7 @@ static void modify_irg(be_abi_irg_t *env)
which may be wrong. Add Conv's then. */
mode
=
get_irn_mode
(
args
[
i
]);
if
(
mode
!=
get_irn_mode
(
repl
))
{
repl
=
new_r_Conv
(
irg
,
get_
nodes_block
(
repl
),
repl
,
mode
);
repl
=
new_r_Conv
(
irg
,
get_
irn_n
(
repl
,
-
1
),
repl
,
mode
);
}
exchange
(
args
[
i
],
repl
);
}
...
...
ir/be/bemain.c
View file @
6be9d429
...
...
@@ -310,6 +310,9 @@ static void initialize_birg(be_irg_t *birg, ir_graph *irg, be_main_env_t *env)
/* set the current graph (this is important for several firm functions) */
current_ir_graph
=
irg
;
/* Normalize proj nodes. */
normalize_proj_nodes
(
irg
);
/* we do this before critical edge split. As this produces less returns,
because sometimes (= 164.gzip) multiple returns are slower */
normalize_n_returns
(
irg
);
...
...
ir/be/benode.c
View file @
6be9d429
...
...
@@ -1812,8 +1812,6 @@ static const ir_op_ops be_node_op_ops = {
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
copy_attr
,
NULL
,
NULL
,
...
...
ir/be/bespillremat.c
View file @
6be9d429
...
...
@@ -3466,7 +3466,6 @@ delete_remat(spill_ilp_t * si, ir_node * remat) {
}
}
/* FIXME: is this still correct:? Proj's are neither scheduled anymore nor they have a block ... */
static
void
clean_remat_info
(
spill_ilp_t
*
si
)
{
...
...
ir/be/test/makereport.sh
View file @
6be9d429
...
...
@@ -16,7 +16,7 @@ ECC="eccp"
#ECC="/ben/beck/ipd/bin/eccp -march=arm -bra-chordal-co-algo=heur"
ECC_CFLAGS
=
"
${
ADDCFLAGS
}
-v -O3 -D__builtin_memcpy=memcpy -D__builtin_memset=memset -D__builtin_strlen=strlen -D__builtin_strcpy=strcpy -D__builtin_strcmp=strcmp -DNO_TRAMPOLINES -ffp-strict"
GCC
=
"gcc"
GCC_CFLAGS
=
"-O0 -Itcc"
GCC_CFLAGS
=
"-O0 -Itcc
-m32
"
LINKFLAGS
=
"-lm"
TIMEOUT_COMPILE
=
300
TIMEOUT_RUN
=
30
...
...
ir/ir/irarch.c
View file @
6be9d429
...
...
@@ -124,7 +124,7 @@ ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn) {
return
irn
;
if
(
get_irn_op
(
irn
)
==
op_Mul
&&
mode_is_int
(
mode
))
{
ir_node
*
block
=
get_
nodes_block
(
irn
);
ir_node
*
block
=
get_
irn_n
(
irn
,
-
1
);
ir_node
*
left
=
get_binop_left
(
irn
);
ir_node
*
right
=
get_binop_right
(
irn
);
tarval
*
tv
=
NULL
;
...
...
@@ -563,7 +563,7 @@ static struct mu magicu(tarval *d) {
static
ir_node
*
replace_div_by_mulh
(
ir_node
*
div
,
tarval
*
tv
)
{
dbg_info
*
dbg
=
get_irn_dbg_info
(
div
);
ir_node
*
n
=
get_binop_left
(
div
);
ir_node
*
block
=
get_
nodes_block
(
div
);
ir_node
*
block
=
get_
irn_n
(
div
,
-
1
);
ir_mode
*
mode
=
get_irn_mode
(
n
);
int
bits
=
get_mode_size_bits
(
mode
);
ir_node
*
q
,
*
t
,
*
c
;
...
...
@@ -657,7 +657,7 @@ ir_node *arch_dep_replace_div_by_const(ir_node *irn) {
left
=
get_Div_left
(
irn
);
mode
=
get_irn_mode
(
left
);
block
=
get_
nodes_block
(
irn
);
block
=
get_
irn_n
(
irn
,
-
1
);
dbg
=
get_irn_dbg_info
(
irn
);
bits
=
get_mode_size_bits
(
mode
);
...
...
@@ -748,7 +748,7 @@ ir_node *arch_dep_replace_mod_by_const(ir_node *irn) {
left
=
get_Mod_left
(
irn
);
mode
=
get_irn_mode
(
left
);
block
=
get_
nodes_block
(
irn
);
block
=
get_
irn_n
(
irn
,
-
1
);
dbg
=
get_irn_dbg_info
(
irn
);
bits
=
get_mode_size_bits
(
mode
);
n
=
(
bits
+
7
)
/
8
;
...
...
@@ -842,7 +842,7 @@ void arch_dep_replace_divmod_by_const(ir_node **div, ir_node **mod, ir_node *irn
left
=
get_DivMod_left
(
irn
);
mode
=
get_irn_mode
(
left
);
block
=
get_
nodes_block
(
irn
);
block
=
get_
irn_n
(
irn
,
-
1
);
dbg
=
get_irn_dbg_info
(
irn
);
bits
=
get_mode_size_bits
(
mode
);
...
...
ir/ir/irdump.c
View file @
6be9d429
...
...
@@ -537,7 +537,22 @@ static int node_floats(ir_node *n) {
*/
static
void
ird_walk_graph
(
ir_graph
*
irg
,
irg_walk_func
*
pre
,
irg_walk_func
*
post
,
void
*
env
)
{
if
(
dump_anchors
)
{
irg_walk_anchors
(
irg
,
pre
,
post
,
env
);
int
i
;
if
(
pre
)
pre
(
irg
->
anchor
,
env
);
for
(
i
=
get_irg_n_anchors
(
irg
)
-
1
;
i
>=
0
;
--
i
)
{
ir_node
*
n
=
get_irg_anchor
(
irg
,
i
);
if
(
n
)
{
/* reset the visit flag: will be increase in the walker */
set_irg_visited
(
irg
,
get_irg_visited
(
irg
)
-
1
);
irg_walk
(
n
,
pre
,
post
,
env
);
}
}
if
(
post
)
post
(
irg
->
anchor
,
env
);
}
else
{
irg_walk_graph
(
irg
,
pre
,
post
,
env
);
}
...
...
@@ -1400,7 +1415,7 @@ print_data_edge_vcgattr(FILE *F, ir_node *from, int to) {
* do not use get_nodes_block() here, will fail
* if the irg is not pinned.
*/
if
(
get_
nodes_block
(
from
)
==
get_
nodes_block
(
get_irn_n
(
from
,
to
)))
if
(
get_
irn_n
(
from
,
-
1
)
==
get_
irn_n
(
get_irn_n
(
from
,
to
)
,
-
1
))
fprintf
(
F
,
INTRA_DATA_EDGE_ATTR
);
else
fprintf
(
F
,
INTER_DATA_EDGE_ATTR
);
...
...
@@ -1412,7 +1427,7 @@ print_mem_edge_vcgattr(FILE *F, ir_node *from, int to) {
* do not use get_nodes_block() here, will fail
* if the irg is not pinned.
*/
if
(
get_
nodes_block
(
from
)
==
get_
nodes_block
(
get_irn_n
(
from
,
to
)))
if
(
get_
irn_n
(
from
,
-
1
)
==
get_
irn_n
(
get_irn_n
(
from
,
to
)
,
-
1
))
fprintf
(
F
,
INTRA_MEM_EDGE_ATTR
);
else
fprintf
(
F
,
INTER_MEM_EDGE_ATTR
);
...
...
@@ -1442,9 +1457,6 @@ static void print_edge_vcgattr(FILE *F, ir_node *from, int to) {
fprintf
(
F
,
KEEP_ALIVE_DF_EDGE_ATTR
);
}
break
;
case
iro_Anchor
:
fprintf
(
F
,
ANCHOR_EDGE_ATTR
);
break
;
default:
if
(
is_Proj
(
from
))
{
if
(
get_irn_mode
(
from
)
==
mode_M
)
...
...
ir/ir/irdumptxt.c
View file @
6be9d429
...
...
@@ -121,8 +121,8 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
if
(
get_irn_pinned
(
n
)
==
op_pin_state_floats
&&
get_irg_pinned
(
get_irn_irg
(
n
))
==
op_pin_state_floats
)
{
fprintf
(
F
,
" node was pinned in "
);
dump_node_opcode
(
F
,
get_
nodes_block
(
n
));
fprintf
(
F
,
" %ld
\n
"
,
get_irn_node_nr
(
get_
nodes_block
(
n
)));
dump_node_opcode
(
F
,
get_
irn_n
(
n
,
-
1
));
fprintf
(
F
,
" %ld
\n
"
,
get_irn_node_nr
(
get_
irn_n
(
n
,
-
1
)));
}
fprintf
(
F
,
" arity: %d
\n
"
,
get_irn_intra_arity
(
n
));
...
...
@@ -130,8 +130,8 @@ int dump_irnode_to_file(FILE *F, ir_node *n) {
fprintf
(
F
,
" pred nodes:
\n
"
);
if
(
!
is_Block
(
n
))
{
fprintf
(
F
,
" -1: "
);
dump_node_opcode
(
F
,
get_
nodes_block
(
n
));
fprintf
(
F
,
" %ld
\n
"
,
get_irn_node_nr
(
get_
nodes_block
(
n
)));
dump_node_opcode
(
F
,
get_
irn_n
(
n
,
-
1
));
fprintf
(
F
,
" %ld
\n
"
,
get_irn_node_nr
(
get_
irn_n
(
n
,
-
1
)));
}
for
(
i
=
0
;
i
<
get_irn_intra_arity
(
n
);
++
i
)
{
fprintf
(
F
,
" %d: %s "
,
i
,
is_intra_backedge
(
n
,
i
)
?
"be"
:
" "
);
...
...
ir/ir/iredges.c
View file @
6be9d429
...
...
@@ -397,11 +397,12 @@ void edges_notify_edge(ir_node *src, int pos, ir_node *tgt, ir_node *old_tgt, ir
}
if
(
edges_activated_kind
(
irg
,
EDGE_KIND_BLOCK
)
&&
is_Block
(
src
))
{
ir_node
*
bl_old
=
old_tgt
?
get_nodes_block
(
skip_Proj
(
old_tgt
))
:
NULL
;
/* do not use get_nodes_block() here, it fails when running unpinned */
ir_node
*
bl_old
=
old_tgt
?
get_irn_n
(
skip_Proj
(
old_tgt
),
-
1
)
:
NULL
;
ir_node
*
bl_tgt
=
NULL
;
if
(
tgt
)
bl_tgt
=
is_Bad
(
tgt
)
?
tgt
:
get_
nodes_block
(
skip_Proj
(
tgt
));
bl_tgt
=
is_Bad
(
tgt
)
?
tgt
:
get_
irn_n
(
skip_Proj
(
tgt
)
,
-
1
);
edges_notify_edge_kind
(
src
,
pos
,
bl_tgt
,
bl_old
,
EDGE_KIND_BLOCK
,
irg
);
}
...
...
ir/ir/irgmod.c
View file @
6be9d429
...
...
@@ -52,13 +52,14 @@ void turn_into_tuple(ir_node *node, int arity) {
if
(
get_irn_arity
(
node
)
==
arity
)
{
/* keep old array */
}
else
{
ir_node
*
block
=
get_nodes_block
(
node
);
/* don't use get_nodes_block here, we allow turn_into_tuple for unpinned nodes */
ir_node
*
block
=
get_irn_n
(
node
,
-
1
);
/* Allocate new array, don't free old in_array, it's on the obstack. */
edges_node_deleted
(
node
,
current_ir_graph
);
node
->
in
=
NEW_ARR_D
(
ir_node
*
,
current_ir_graph
->
obst
,
arity
+
1
);
/* clear the new in array, else edge_notify tries to delete garbage */
memset
(
node
->
in
,
0
,
(
arity
+
1
)
*
sizeof
(
node
->
in
[
0
]));
set_
nodes_block
(
node
,
block
);
set_
irn_n
(
node
,
-
1
,
block
);
}
}
...
...
@@ -155,11 +156,20 @@ void collect_phiprojs(ir_graph *irg) {
*/
static
void
move
(
ir_node
*
node
,
ir_node
*
from_bl
,
ir_node
*
to_bl
)
{
int
i
,
arity
;
ir_node
*
pred
;
/* move this node: Projs are moved automagically */
if
(
!
is_Proj
(
node
))
set_nodes_block
(
node
,
to_bl
);
ir_node
*
proj
,
*
pred
;
/* move this node */
set_nodes_block
(
node
,
to_bl
);
/* move its projs */
if
(
get_irn_mode
(
node
)
==
mode_T
)
{
proj
=
get_irn_link
(
node
);
while
(
proj
)
{
if
(
get_nodes_block
(
proj
)
==
from_bl
)
set_nodes_block
(
proj
,
to_bl
);
proj
=
get_irn_link
(
proj
);
}
}
/* recursion ... */
if
(
get_irn_op
(
node
)
==
op_Phi
)
return
;
...
...
ir/ir/irgopt.c
View file @
6be9d429
...
...
@@ -405,7 +405,7 @@ static void copy_preds(ir_node *n, void *env) {
/* Don't copy node if corresponding predecessor in block is Bad.
The Block itself should not be Bad. */
block
=
get_nodes_block
(
n
);
set_
nodes_block
(
nn
,
get_new_node
(
block
));
set_
irn_n
(
nn
,
-
1
,
get_new_node
(
block
));
j
=
0
;
irn_arity
=
get_irn_arity
(
n
);
for
(
i
=
0
;
i
<
irn_arity
;
i
++
)
{
...
...
@@ -1748,16 +1748,9 @@ place_floats_early(ir_node *n, waitq *worklist) {
assert
(
irn_not_visited
(
n
));
mark_irn_visited
(
n
);
#ifndef CAN_PLACE_PROJS
while
(
is_Proj
(
n
))
{
n
=
get_Proj_pred
(
n
);
mark_irn_visited
(
n
);
}
#endif
/* Place floating nodes. */
if
(
get_irn_pinned
(
n
)
==
op_pin_state_floats
)
{
ir_node
*
curr_block
=
get_
nodes_block
(
n
);
ir_node
*
curr_block
=
get_
irn_n
(
n
,
-
1
);
int
in_dead_block
=
is_Block_unreachable
(
curr_block
);
int
depth
=
0
;
ir_node
*
b
=
NULL
;
/* The block to place this node in */
...
...
@@ -1789,7 +1782,7 @@ place_floats_early(ir_node *n, waitq *worklist) {
*/
if
(
!
in_dead_block
)
{
if
(
get_irn_pinned
(
pred
)
==
op_pin_state_floats
&&
is_Block_unreachable
(
get_
nodes_block
(
pred
)))
is_Block_unreachable
(
get_
irn_n
(
pred
,
-
1
)))
set_nodes_block
(
pred
,
curr_block
);
}
place_floats_early
(
pred
,
worklist
);
...
...
@@ -1805,14 +1798,14 @@ place_floats_early(ir_node *n, waitq *worklist) {
/* Because all loops contain at least one op_pin_state_pinned node, now all
our inputs are either op_pin_state_pinned or place_early() has already
been finished on them. We do not have any unfinished inputs! */
pred_block
=
get_
nodes_block
(
pred
);
pred_block
=
get_
irn_n
(
pred
,
-
1
);
if
((
!
is_Block_dead
(
pred_block
))
&&
(
get_Block_dom_depth
(
pred_block
)
>
depth
))
{
b
=
pred_block
;
depth
=
get_Block_dom_depth
(
pred_block
);
}
/* Avoid that the node is placed in the Start block */
if
((
depth
==
1
)
&&
(
get_Block_dom_depth
(
get_
nodes_block
(
n
))
>
1
)
if
((
depth
==
1
)
&&
(
get_Block_dom_depth
(
get_
irn_n
(
n
,
-
1
))
>
1
)
&&
get_irg_phase_state
(
current_ir_graph
)
!=
phase_backend
)
{
b
=
get_Block_cfg_out
(
get_irg_start_block
(
current_ir_graph
),
0
);
assert
(
b
!=
get_irg_start_block
(
current_ir_graph
));
...
...
@@ -1851,14 +1844,14 @@ place_floats_early(ir_node *n, waitq *worklist) {
}
}
else
if
(
is_Phi
(
n
))
{
ir_node
*
pred
;
ir_node
*
curr_block
=
get_
nodes_block
(
n
);
ir_node
*
curr_block
=
get_
irn_n
(
n
,
-
1
);
int
in_dead_block
=
is_Block_unreachable
(
curr_block
);
/*
* Phi nodes: move nodes from dead blocks into the effective use
* of the Phi-input if the Phi is not in a bad block.
*/
pred
=
get_
nodes_block
(
n
);
pred
=
get_
irn_n
(
n
,
-
1
);
if
(
irn_not_visited
(
pred
))
waitq_put
(
worklist
,
pred
);
...
...
@@ -1868,7 +1861,7 @@ place_floats_early(ir_node *n, waitq *worklist) {
if
(
irn_not_visited
(
pred
))
{
if
(
!
in_dead_block
&&
get_irn_pinned
(
pred
)
==
op_pin_state_floats
&&
is_Block_unreachable
(
get_
nodes_block
(
pred
)))
{
is_Block_unreachable
(
get_
irn_n
(
pred
,
-
1
)))
{
set_nodes_block
(
pred
,
get_Block_cfgpred_block
(
curr_block
,
i
));
}
waitq_put
(
worklist
,
pred
);
...
...
@@ -1876,13 +1869,13 @@ place_floats_early(ir_node *n, waitq *worklist) {
}
}
else
{
ir_node
*
pred
;
ir_node
*
curr_block
=
get_
nodes_block
(
n
);
ir_node
*
curr_block
=
get_
irn_n
(
n
,
-
1
);
int
in_dead_block
=
is_Block_unreachable
(
curr_block
);
/*
* All other nodes: move nodes from dead blocks into the same block.
*/
pred
=
get_
nodes_block
(
n
);
pred
=
get_
irn_n
(
n
,
-
1
);
if
(
irn_not_visited
(
pred
))
waitq_put
(
worklist
,
pred
);
...
...
@@ -1892,7 +1885,7 @@ place_floats_early(ir_node *n, waitq *worklist) {
if
(
irn_not_visited
(
pred
))
{
if
(
!
in_dead_block
&&
get_irn_pinned
(
pred
)
==
op_pin_state_floats
&&
is_Block_unreachable
(
get_
nodes_block
(
pred
)))
{
is_Block_unreachable
(
get_
irn_n
(
pred
,
-
1
)))
{
set_nodes_block
(
pred
,
curr_block
);
}
waitq_put
(
worklist
,
pred
);
...
...
@@ -1982,7 +1975,7 @@ consumer_dom_dca(ir_node *dca, ir_node *consumer, ir_node *producer) {
}
if
(
!
block
)
block
=
get_
nodes_block
(
producer
);
block
=
get_
irn_n
(
producer
,
-
1
);
}
else
{
assert
(
is_no_Block
(
consumer
));
block
=
get_nodes_block
(
consumer
);
...
...
@@ -2056,7 +2049,7 @@ static ir_node *get_deepest_common_ancestor(ir_node *node, ir_node *dca)
dca
=
get_deepest_common_ancestor
(
succ
,
dca
);
}
else
{
/* ignore if succ is in dead code */
succ_blk
=
get_
nodes_block
(
succ
);
succ_blk
=
get_
irn_n
(
succ
,
-
1
);
if
(
is_Block_unreachable
(
succ_blk
))
continue
;
dca
=
consumer_dom_dca
(
dca
,
succ
,
node
);
...
...
@@ -2066,7 +2059,6 @@ static ir_node *get_deepest_common_ancestor(ir_node *node, ir_node *dca)
return
dca
;
}
#ifdef CAN_PLACE_PROJS
static
void
set_projs_block
(
ir_node
*
node
,
ir_node
*
block
)
{
int
i
;
...
...
@@ -2082,7 +2074,6 @@ static void set_projs_block(ir_node *node, ir_node *block)
set_nodes_block
(
succ
,
block
);
}
}
#endif
/**
* Find the latest legal block for N and place N into the
...
...
@@ -2110,7 +2101,7 @@ static void place_floats_late(ir_node *n, pdeq *worklist) {
(
get_irn_mode
(
n
)
!=
mode_X
))
{
/* Remember the early_blk placement of this block to move it
out of loop no further than the early_blk placement. */
early_blk
=
get_
nodes_block
(
n
);
early_blk
=
get_
irn_n
(
n
,
-
1
);
/*
* BEWARE: Here we also get code, that is live, but
...
...
@@ -2150,11 +2141,9 @@ static void place_floats_late(ir_node *n, pdeq *worklist) {
if
(
dca
!=
NULL
)
{
set_nodes_block
(
n
,
dca
);
move_out_of_loops
(
n
,
early_blk
);
#ifdef CAN_PLACE_PROJS
if
(
get_irn_mode
(
n
)
==
mode_T
)
{
set_projs_block
(
n
,
get_nodes_block
(
n
));
}
#endif
}
}
}
...
...
ir/ir/irgraph.c