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
48f89387
Commit
48f89387
authored
Jul 31, 2006
by
Sebastian Hack
Browse files
Adapted to new liveness
Added becopyheur3 (need to compile firm with --enable-jvm)
parent
92aa0dde
Changes
36
Hide whitespace changes
Inline
Side-by-side
ir/be/Makefile.in
View file @
48f89387
...
...
@@ -31,10 +31,9 @@ SOURCES += Makefile.in besched.h belistsched.h belistsched.c \
beabi.c beabi.h beabi_t.h benodesets.c benodesets.h
\
bemachnode.c bemachnode.h beinsn.c bestat.h bestat.c
\
beschedmris.h beschedmris.c bespillmorgan.c bespillmorgan.h
\
beverify.h beverify.c
bespillremat.c
bepressurestat.c bepressurestat.h
\
beverify.h beverify.c bepressurestat.c bepressurestat.h
\
bessadestrsimple.c beifg_clique.c beifg_list.c beifg_pointer.c
\
bespillcost.c
bejavacoal.c becopyheur3.c bespillcost.c
include
$(topdir)/MakeRules
...
...
@@ -43,7 +42,8 @@ CPPFLAGS += -I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/
-I
$(top_srcdir)
/ir/ident
-I
$(top_srcdir)
/ir/tr
-I
$(top_srcdir)
/ir/tv
\
-I
$(top_srcdir)
/ir/debug
-I
$(top_srcdir)
/ir/ana
-I
$(top_srcdir)
/ir/st
\
-I
$(top_srcdir)
/ir/stat
-I
$(top_srcdir)
/ir/external
-I
$(top_srcdir)
/ir/ana2
\
-I
$(top_srcdir)
/ir/opt
-I
$(topdir)
/ir/config
-I
$(top_srcdir)
/ir/arch
-I
$(top_srcdir)
/ir/lower
-I
$(top_srcdir)
/ir/opt
-I
$(topdir)
/ir/config
-I
$(top_srcdir)
/ir/arch
-I
$(top_srcdir)
/ir/lower
\
-I
$(JAVA_HOME)
/include
-I
$(JAVA_HOME)
/include/linux
include
$(top_srcdir)/MakeTargets
...
...
ir/be/beabi.c
View file @
48f89387
...
...
@@ -1728,7 +1728,6 @@ be_abi_irg_t *be_abi_introduce(be_irg_t *birg)
arch_env_push_irn_handler
(
env
->
birg
->
main_env
->
arch_env
,
&
env
->
irn_handler
);
env
->
call
->
cb
->
done
(
env
->
cb
);
be_liveness
(
irg
);
return
env
;
}
...
...
@@ -1779,7 +1778,7 @@ static void collect_stack_nodes_walker(ir_node *irn, void *data)
pset_insert_ptr
(
info
->
nodes
,
irn
);
}
void
be_abi_fix_stack_nodes
(
be_abi_irg_t
*
env
)
void
be_abi_fix_stack_nodes
(
be_abi_irg_t
*
env
,
be_lv_t
*
lv
)
{
dom_front_info_t
*
df
;
pset
*
stack_nodes
=
pset_new_ptr
(
16
);
...
...
@@ -1792,12 +1791,9 @@ void be_abi_fix_stack_nodes(be_abi_irg_t *env)
df
=
be_compute_dominance_frontiers
(
env
->
birg
->
irg
);
irg_walk_graph
(
env
->
birg
->
irg
,
collect_stack_nodes_walker
,
NULL
,
&
info
);
pset_insert_ptr
(
stack_nodes
,
env
->
init_sp
);
be_ssa_constr_set_phis
(
df
,
stack_nodes
,
env
->
stack_phis
);
be_ssa_constr_set_phis
(
df
,
lv
,
stack_nodes
,
env
->
stack_phis
);
del_pset
(
stack_nodes
);
/* Liveness could have changed due to Phi nodes. */
be_liveness
(
env
->
birg
->
irg
);
/* free these dominance frontiers */
be_free_dominance_frontiers
(
df
);
}
...
...
ir/be/beabi.h
View file @
48f89387
...
...
@@ -118,7 +118,7 @@ ir_type *be_abi_call_get_method_type(const be_abi_call_t *call);
be_abi_irg_t
*
be_abi_introduce
(
be_irg_t
*
bi
);
void
be_abi_fix_stack_bias
(
be_abi_irg_t
*
env
);
void
be_abi_fix_stack_nodes
(
be_abi_irg_t
*
env
);
void
be_abi_fix_stack_nodes
(
be_abi_irg_t
*
env
,
be_lv_t
*
lv
);
void
be_abi_free
(
be_abi_irg_t
*
abi
);
void
be_abi_put_ignore_regs
(
be_abi_irg_t
*
abi
,
const
arch_register_class_t
*
cls
,
bitset_t
*
bs
);
...
...
ir/be/bechordal.c
View file @
48f89387
...
...
@@ -251,7 +251,7 @@ static void pair_up_operands(const be_chordal_alloc_env_t *alloc_env, be_insn_t
of one are a subset of the other's. We record the operand whose constraints
count in the decisive array.
*/
if
(
!
values_interfere
(
op
->
irn
,
op
->
carrier
))
{
if
(
!
values_interfere
(
env
->
lv
,
op
->
irn
,
op
->
carrier
))
{
if
(
get_decisive_partner_regs
(
bs
,
out_op
,
op
))
bipartite_add
(
bp
,
j
,
i
-
insn
->
use_start
);
}
...
...
@@ -307,7 +307,7 @@ static ir_node *pre_process_constraints(be_chordal_alloc_env_t *alloc_env, be_in
*/
for
(
i
=
insn
->
use_start
;
i
<
insn
->
n_ops
;
++
i
)
{
be_operand_t
*
op
=
&
insn
->
ops
[
i
];
if
(
op
->
has_constraints
&&
(
values_interfere
(
op
->
carrier
,
insn
->
irn
)
||
arch_irn_is
(
aenv
,
op
->
carrier
,
ignore
)))
{
if
(
op
->
has_constraints
&&
(
values_interfere
(
env
->
lv
,
op
->
carrier
,
insn
->
irn
)
||
arch_irn_is
(
aenv
,
op
->
carrier
,
ignore
)))
{
bitset_copy
(
bs
,
op
->
regs
);
bitset_and
(
bs
,
out_constr
);
...
...
@@ -330,7 +330,7 @@ static ir_node *pre_process_constraints(be_chordal_alloc_env_t *alloc_env, be_in
Make the Perm, recompute liveness and re-scan the insn since the
in operands are now the Projs of the Perm.
*/
perm
=
insert_Perm_after
(
aenv
,
env
->
cls
,
env
->
dom_front
,
sched_prev
(
insn
->
irn
));
perm
=
insert_Perm_after
(
aenv
,
env
->
lv
,
env
->
cls
,
env
->
dom_front
,
sched_prev
(
insn
->
irn
));
/* Registers are propagated by insert_Perm_after(). Clean them here! */
if
(
perm
)
{
...
...
@@ -346,7 +346,7 @@ static ir_node *pre_process_constraints(be_chordal_alloc_env_t *alloc_env, be_in
the Perm. Recomputing liveness is also a good idea if a Perm is inserted, since
the live sets may change.
*/
be_liveness
(
env
->
irg
);
//
be_liveness
_recompute
(env->
lv
);
obstack_free
(
&
env
->
obst
,
insn
);
*
the_insn
=
insn
=
chordal_scan_insn
(
alloc_env
,
insn
->
irn
);
...
...
@@ -468,7 +468,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env, ir_node *i
assert
(
is_Proj
(
proj
));
if
(
values_interfere
(
proj
,
irn
)
&&
!
pmap_contains
(
partners
,
proj
))
{
if
(
values_interfere
(
env
->
lv
,
proj
,
irn
)
&&
!
pmap_contains
(
partners
,
proj
))
{
assert
(
n_alloc
<
n_regs
);
alloc_nodes
[
n_alloc
]
=
proj
;
pmap_insert
(
partners
,
proj
,
NULL
);
...
...
@@ -605,8 +605,8 @@ static void pressure(ir_node *block, void *env_ptr)
unsigned
step
=
0
;
unsigned
pressure
=
0
;
struct
list_head
*
head
;
pset
*
live_in
=
put_live_in
(
block
,
pset_new_ptr_default
());
pset
*
live_end
=
put_live_end
(
block
,
pset_new_ptr_default
());
pset
*
live_in
=
be_lv_pset_put_in
(
env
->
lv
,
block
,
pset_new_ptr_default
());
pset
*
live_end
=
be_lv_pset_put_end
(
env
->
lv
,
block
,
pset_new_ptr_default
());
DBG
((
dbg
,
LEVEL_1
,
"Computing pressure in block %+F
\n
"
,
block
));
bitset_clear_all
(
live
);
...
...
@@ -700,7 +700,7 @@ static void assign(ir_node *block, void *env_ptr)
bitset_t
*
in_colors
=
alloc_env
->
in_colors
;
const
arch_env_t
*
arch_env
=
env
->
birg
->
main_env
->
arch_env
;
struct
list_head
*
head
=
get_block_border_head
(
env
,
block
);
pset
*
live_in
=
put_live_in
(
block
,
pset_new_ptr_default
());
pset
*
live_in
=
be_lv_pset_put_in
(
env
->
lv
,
block
,
pset_new_ptr_default
());
const
ir_node
*
irn
;
border_t
*
b
;
...
...
@@ -756,7 +756,7 @@ static void assign(ir_node *block, void *env_ptr)
* Assign a color, if it is a local def. Global defs already have a
* color.
*/
if
(
b
->
is_def
&&
!
is_live_in
(
block
,
irn
))
{
if
(
b
->
is_def
&&
!
be_
is_live_in
(
env
->
lv
,
block
,
irn
))
{
const
arch_register_t
*
reg
;
int
col
=
NO_COLOR
;
...
...
ir/be/bechordal_draw.c
View file @
48f89387
...
...
@@ -374,7 +374,7 @@ static void draw_block(ir_node *bl, void *data)
static
const
color_t
black
=
{
0
,
0
,
0
};
const
draw_chordal_env_t
*
env
=
data
;
pset
*
live_in
=
put_live_in
(
bl
,
pset_new_ptr_default
());
pset
*
live_in
=
be_lv_pset_put_in
(
env
->
chordal_env
->
lv
,
bl
,
pset_new_ptr_default
());
ir_node
*
irn
;
border_t
*
b
;
struct
list_head
*
head
=
get_block_border_head
(
env
->
chordal_env
,
bl
);
...
...
@@ -396,7 +396,7 @@ static void draw_block(ir_node *bl, void *data)
if
(
b
->
is_def
)
{
const
arch_register_t
*
reg
=
arch_get_irn_register
(
env
->
arch_env
,
b
->
irn
);
int
col
=
arch_register_get_index
(
reg
);
int
live_out
=
is_live_out
(
bl
,
b
->
irn
);
int
live_out
=
be_
is_live_out
(
env
->
chordal_env
->
lv
,
bl
,
b
->
irn
);
int
x
=
(
col
+
1
)
*
opts
->
h_inter_gap
;
int
ystart
=
(
b
->
step
)
*
opts
->
v_inter_gap
;
int
ystop
=
(
b
->
other_end
->
step
)
...
...
ir/be/bechordal_main.c
View file @
48f89387
...
...
@@ -39,6 +39,7 @@
#include "bechordal_t.h"
#include "beabi.h"
#include "bejavacoal.h"
#include "beutil.h"
#include "besched.h"
#include "benumb_t.h"
...
...
@@ -94,7 +95,7 @@ void be_ra_chordal_check(be_chordal_env_t *chordal_env) {
}
for
(
o
=
i
+
1
,
n2
=
nodes
[
o
];
n2
;
n2
=
nodes
[
++
o
])
{
n2_reg
=
arch_get_irn_register
(
arch_env
,
n2
);
if
(
values_interfere
(
n1
,
n2
)
&&
n1_reg
==
n2_reg
)
{
if
(
values_interfere
(
chordal_env
->
lv
,
n1
,
n2
)
&&
n1_reg
==
n2_reg
)
{
DBG
((
dbg
,
0
,
"Values %+F and %+F interfere and have the same register assigned: %s
\n
"
,
n1
,
n2
,
n1_reg
->
name
));
assert
(
0
&&
"Interfering values have the same color!"
);
}
...
...
@@ -108,7 +109,7 @@ int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node
if
(
env
->
ifg
)
return
be_ifg_connected
(
env
->
ifg
,
a
,
b
);
else
return
values_interfere
(
a
,
b
);
return
values_interfere
(
env
->
lv
,
a
,
b
);
}
...
...
@@ -148,11 +149,11 @@ static const lc_opt_enum_int_items_t copymin_items[] = {
{
"none"
,
BE_CH_COPYMIN_NONE
},
{
"heur1"
,
BE_CH_COPYMIN_HEUR1
},
{
"heur2"
,
BE_CH_COPYMIN_HEUR2
},
{
"heur3"
,
BE_CH_COPYMIN_HEUR3
},
{
"stat"
,
BE_CH_COPYMIN_STAT
},
{
"park"
,
BE_CH_COPYMIN_PARK_MOON
},
#ifdef WITH_ILP
{
"ilp1"
,
BE_CH_COPYMIN_ILP1
},
{
"ilp2"
,
BE_CH_COPYMIN_ILP2
},
{
"ilp"
,
BE_CH_COPYMIN_ILP
},
#endif
/* WITH_ILP */
{
NULL
,
0
}
};
...
...
@@ -186,6 +187,7 @@ static const lc_opt_enum_int_items_t dump_items[] = {
{
"tree"
,
BE_CH_DUMP_TREE_INTV
},
{
"constr"
,
BE_CH_DUMP_CONSTR
},
{
"lower"
,
BE_CH_DUMP_LOWER
},
{
"appel"
,
BE_CH_DUMP_APPEL
},
{
"all"
,
BE_CH_DUMP_ALL
},
{
NULL
,
0
}
};
...
...
@@ -221,8 +223,12 @@ static lc_opt_enum_int_var_t be_ch_vrfy_var = {
&
options
.
vrfy_option
,
be_ch_vrfy_items
};
/** Dump copy minimization statistics. */
static
int
be_copymin_stats
=
0
;
/** Enable extreme live range splitting. */
static
int
be_elr_split
=
0
;
/** Assumed loop iteration count for execution frequency estimation. */
static
int
be_loop_weight
=
9
;
...
...
@@ -234,6 +240,7 @@ static const lc_opt_table_entry_t be_chordal_options[] = {
LC_OPT_ENT_ENUM_MASK
(
"dump"
,
"select dump phases"
,
&
dump_var
),
LC_OPT_ENT_ENUM_PTR
(
"vrfy"
,
"verify options (off, warn, assert)"
,
&
be_ch_vrfy_var
),
LC_OPT_ENT_BOOL
(
"copymin_stats"
,
"dump statistics of copy minimization"
,
&
be_copymin_stats
),
LC_OPT_ENT_BOOL
(
"elrsplit"
,
"enable extreme live range splitting"
,
&
be_elr_split
),
LC_OPT_ENT_INT
(
"loop_weight"
,
"assumed amount of loop iterations for guessing the execution frequency"
,
&
be_loop_weight
),
{
NULL
}
};
...
...
@@ -251,6 +258,7 @@ static void be_ra_chordal_register_options(lc_opt_entry_t *grp)
}
co_register_options
(
chordal_grp
);
java_coal_register_options
(
chordal_grp
);
}
#endif
/* WITH_LIBCORE */
...
...
@@ -374,6 +382,8 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
const
arch_isa_t
*
isa
=
arch_env_get_isa
(
main_env
->
arch_env
);
ir_graph
*
irg
=
bi
->
irg
;
be_options_t
*
main_opts
=
main_env
->
options
;
int
splitted
=
0
;
copy_opt_t
*
co
;
int
j
,
m
;
be_chordal_env_t
chordal_env
;
...
...
@@ -432,6 +442,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
chordal_env
.
birg
=
bi
;
chordal_env
.
dom_front
=
be_compute_dominance_frontiers
(
irg
);
chordal_env
.
exec_freq
=
compute_execfreq
(
irg
,
be_loop_weight
);
chordal_env
.
lv
=
be_liveness
(
irg
);
FIRM_DBG_REGISTER
(
chordal_env
.
dbg
,
"firm.be.chordal"
);
obstack_init
(
&
chordal_env
.
obst
);
...
...
@@ -447,13 +458,11 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
chordal_env
.
border_heads
=
pmap_create
();
chordal_env
.
ignore_colors
=
bitset_malloc
(
chordal_env
.
cls
->
n_regs
);
BE_TIMER_PUSH
(
ra_timer
.
t_live
);
/* put all ignore registers into the ignore register set. */
put_ignore_colors
(
&
chordal_env
);
be_liveness
(
irg
);
BE_TIMER_PUSH
(
ra_timer
.
t_live
);
be_liveness_recompute
(
chordal_env
.
lv
);
BE_TIMER_POP
(
ra_timer
.
t_live
);
dump
(
BE_CH_DUMP_LIVE
,
irg
,
chordal_env
.
cls
,
"-live"
,
dump_ir_block_graph_sched
);
...
...
@@ -470,8 +479,10 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
break
;
#ifdef WITH_ILP
case
BE_CH_SPILL_REMAT
:
/*
be_spill_remat(&chordal_env);
break;
*/
#endif
/* WITH_ILP */
default:
fprintf
(
stderr
,
"no valid spiller selected. falling back to belady
\n
"
);
...
...
@@ -487,7 +498,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
);
dump
(
BE_CH_DUMP_SPILL
,
irg
,
chordal_env
.
cls
,
"-spill"
,
dump_ir_block_graph_sched
);
be_abi_fix_stack_nodes
(
bi
->
abi
);
be_abi_fix_stack_nodes
(
bi
->
abi
,
chordal_env
.
lv
);
be_compute_spill_offsets
(
&
chordal_env
);
check_for_memory_operands
(
&
chordal_env
);
...
...
@@ -503,23 +514,23 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
assert
(
be_verify_register_pressure
(
chordal_env
.
birg
->
main_env
->
arch_env
,
chordal_env
.
cls
,
irg
)
&&
"Register pressure verification failed"
);
}
BE_TIMER_POP
(
ra_timer
.
t_verify
);
BE_TIMER_PUSH
(
ra_timer
.
t_live
);
be_liveness
(
irg
);
BE_TIMER_POP
(
ra_timer
.
t_live
);
BE_TIMER_PUSH
(
ra_timer
.
t_color
);
if
(
be_elr_split
&&
!
splitted
)
{
extreme_liverange_splitting
(
&
chordal_env
);
splitted
=
1
;
}
/* Color the graph. */
BE_TIMER_PUSH
(
ra_timer
.
t_color
);
be_ra_chordal_color
(
&
chordal_env
);
BE_TIMER_POP
(
ra_timer
.
t_color
);
dump
(
BE_CH_DUMP_CONSTR
,
irg
,
chordal_env
.
cls
,
"-color"
,
dump_ir_block_graph_sched
);
BE_TIMER_PUSH
(
ra_timer
.
t_ifg
);
/* Create the ifg with the selected flavor */
BE_TIMER_PUSH
(
ra_timer
.
t_ifg
);
switch
(
options
.
ifg_flavor
)
{
default:
fprintf
(
stderr
,
"no valid ifg flavour selected. falling back to std
\n
"
);
...
...
@@ -542,36 +553,19 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
chordal_env
.
ifg
=
be_ifg_std_new
(
&
chordal_env
);
break
;
}
#if 0
{
be_ifg_t *std = be_ifg_std_new(&chordal_env);
f = be_chordal_open(&chordal_env, "std", "csv");
be_ifg_check_sorted_to_file(std, f);
be_ifg_free(std);
fclose(f);
}
f = be_chordal_open(&chordal_env, "clique", "csv");
be_ifg_check_sorted_to_file(chordal_env.ifg, f);
fclose(f);
#endif
BE_TIMER_POP
(
ra_timer
.
t_ifg
);
BE_TIMER_PUSH
(
ra_timer
.
t_verify
);
if
(
options
.
vrfy_option
!=
BE_CH_VRFY_OFF
)
be_ra_chordal_check
(
&
chordal_env
);
// be_ifg_check_sorted(chordal_env.ifg);
BE_TIMER_POP
(
ra_timer
.
t_verify
);
BE_TIMER_PUSH
(
ra_timer
.
t_copymin
);
/* copy minimization */
BE_TIMER_PUSH
(
ra_timer
.
t_copymin
);
co
=
NULL
;
if
(
options
.
copymin_method
!=
BE_CH_COPYMIN_NONE
&&
options
.
copymin_method
!=
BE_CH_COPYMIN_STAT
)
{
FILE
*
f
;
co
=
new_copy_opt
(
&
chordal_env
,
co_get_costs_loop_depth
);
co
=
new_copy_opt
(
&
chordal_env
,
co_get_costs_exec_freq
);
co_build_ou_structure
(
co
);
co_build_graph_structure
(
co
);
if
(
be_copymin_stats
)
{
...
...
@@ -582,14 +576,12 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
printf
(
"copy costs lower bound: %d
\n
"
,
co_get_lower_bound
(
co
));
}
#if 0
f = be_chordal_open(&chordal_env, "appel-", "apl");
co_dump_appel_graph(co, f);
fclose(f);
f = be_chordal_open(&chordal_env, "appel-clique-", "p");
co_dump_appel_graph_cliques(co, f);
fclose(f);
#endif
/* Dump the interference graph in Appel's format. */
if
(
options
.
dump_flags
&
BE_CH_DUMP_APPEL
)
{
FILE
*
f
=
be_chordal_open
(
&
chordal_env
,
"appel-"
,
"apl"
);
co_dump_appel_graph
(
co
,
f
);
fclose
(
f
);
}
}
switch
(
options
.
copymin_method
)
{
...
...
@@ -599,6 +591,9 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
case
BE_CH_COPYMIN_HEUR2
:
co_solve_heuristic_new
(
co
);
break
;
case
BE_CH_COPYMIN_HEUR3
:
co_solve_heuristic_java
(
co
);
break
;
case
BE_CH_COPYMIN_PARK_MOON
:
co_solve_park_moon
(
co
);
break
;
...
...
@@ -606,11 +601,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
co_compare_solvers
(
&
chordal_env
);
break
;
#ifdef WITH_ILP
case
BE_CH_COPYMIN_ILP1
:
printf
(
"FIXME: %s:%d ILP1 not yet implemented!
\n
"
,
__FILE__
,
__LINE__
);
co_solve_ilp1
(
co
,
60
.
0
);
break
;
case
BE_CH_COPYMIN_ILP2
:
case
BE_CH_COPYMIN_ILP
:
co_solve_ilp2
(
co
,
60
.
0
);
break
;
#endif
/* WITH_ILP */
...
...
@@ -627,7 +618,6 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
co_free_ou_structure
(
co
);
free_copy_opt
(
co
);
}
BE_TIMER_POP
(
ra_timer
.
t_copymin
);
dump
(
BE_CH_DUMP_COPYMIN
,
irg
,
chordal_env
.
cls
,
"-copymin"
,
dump_ir_block_graph_sched
);
...
...
@@ -671,6 +661,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
obstack_free
(
&
chordal_env
.
obst
,
NULL
);
be_free_dominance_frontiers
(
chordal_env
.
dom_front
);
be_liveness_free
(
chordal_env
.
lv
);
free_execfreq
(
chordal_env
.
exec_freq
);
BE_TIMER_POP
(
ra_timer
.
t_epilog
);
...
...
ir/be/bechordal_t.h
View file @
48f89387
...
...
@@ -28,6 +28,7 @@
#include "bearch.h"
#include "bechordal.h"
#include "beirgmod.h"
#include "belive.h"
typedef
struct
_be_ra_chordal_opts_t
be_ra_chordal_opts_t
;
...
...
@@ -61,6 +62,7 @@ struct _be_chordal_env_t {
ir_graph
*
irg
;
/**< The graph under examination. */
const
arch_register_class_t
*
cls
;
/**< The current register class. */
exec_freq_t
*
exec_freq
;
/**< Adam's execution frequencies. */
be_lv_t
*
lv
;
/**< Liveness information. */
pmap
*
border_heads
;
/**< Maps blocks to border heads. */
be_ifg_t
*
ifg
;
/**< The interference graph. */
void
*
data
;
/**< Some pointer, to which different phases can attach data to. */
...
...
@@ -107,15 +109,16 @@ enum {
BE_CH_DUMP_TREE_INTV
=
(
1
<<
6
),
BE_CH_DUMP_CONSTR
=
(
1
<<
7
),
BE_CH_DUMP_LOWER
=
(
1
<<
8
),
BE_CH_DUMP_APPEL
=
(
1
<<
9
),
BE_CH_DUMP_ALL
=
2
*
BE_CH_DUMP_LOWER
-
1
,
/* copymin method */
BE_CH_COPYMIN_NONE
=
0
,
BE_CH_COPYMIN_HEUR1
=
1
,
BE_CH_COPYMIN_HEUR2
=
2
,
BE_CH_COPYMIN_
STAT
=
3
,
BE_CH_COPYMIN_
ILP1
=
4
,
BE_CH_COPYMIN_ILP
2
=
5
,
BE_CH_COPYMIN_
HEUR3
=
3
,
BE_CH_COPYMIN_
STAT
=
4
,
BE_CH_COPYMIN_ILP
=
5
,
BE_CH_COPYMIN_PARK_MOON
=
6
,
/* ifg flavor */
...
...
ir/be/becopyheur2.c
View file @
48f89387
...
...
@@ -43,7 +43,7 @@
static
int
dump_flags
=
0
;
static
int
subtree_iter
=
4
;
static
int
max_depth
=
1
0
;
static
int
max_depth
=
2
0
;
static
double
constr_factor
=
0
.
9
;
/* Options using libcore */
...
...
@@ -843,7 +843,7 @@ static void apply_coloring(co2_cloud_irn_t *ci, col_t col, int depth)
DBG
((
ci
->
cloud
->
env
->
dbg
,
LEVEL_2
,
"%2{firm:indent}setting %+F to %d
\n
"
,
depth
,
irn
,
col
));
ok
=
change_color_single
(
ci
->
cloud
->
env
,
irn
,
col
,
&
changed
,
depth
);
assert
(
ok
&&
"Color changing may not fail while committing the coloring"
);
//
assert(ok && "Color changing may not fail while committing the coloring");
materialize_coloring
(
&
changed
);
for
(
i
=
0
;
i
<
ci
->
mst_n_childs
;
++
i
)
{
...
...
ir/be/becopyopt.c
View file @
48f89387
...
...
@@ -41,10 +41,12 @@
/* Insert additional options registration functions here. */
extern
void
be_co2_register_options
(
lc_opt_entry_t
*
grp
);
extern
void
be_co3_register_options
(
lc_opt_entry_t
*
grp
);
void
co_register_options
(
lc_opt_entry_t
*
grp
)
{
be_co2_register_options
(
grp
);
be_co3_register_options
(
grp
);
}
#endif
...
...
@@ -166,7 +168,8 @@ int co_get_costs_loop_depth(const copy_opt_t *co, ir_node *root, ir_node* arg, i
int
co_get_costs_exec_freq
(
const
copy_opt_t
*
co
,
ir_node
*
root
,
ir_node
*
arg
,
int
pos
)
{
ir_node
*
root_bl
=
get_nodes_block
(
root
);
ir_node
*
copy_bl
=
is_Phi
(
root
)
?
get_Block_cfgpred_block
(
root_bl
,
pos
)
:
root_bl
;
return
(
int
)
get_block_execfreq
(
co
->
cenv
->
exec_freq
,
copy_bl
);
unsigned
long
freq
=
get_block_execfreq_ulong
(
co
->
cenv
->
exec_freq
,
copy_bl
);
return
freq
>
0
?
(
int
)
freq
:
1
;
}
...
...
@@ -896,7 +899,7 @@ static void appel_walker(ir_node *bl, void *data)
}
DBG
((
env
->
co
->
cenv
->
dbg
,
LEVEL_2
,
"%+F
\n
"
,
bl
));
be_liveness_end_of_block
(
env
->
co
->
aenv
,
env
->
co
->
cls
,
bl
,
live
);
be_liveness_end_of_block
(
env
->
co
->
cenv
->
lv
,
env
->
co
->
aenv
,
env
->
co
->
cls
,
bl
,
live
);
/* Generate the bad and ugly. */
for
(
i
=
n_insns
-
1
;
i
>=
0
;
--
i
)
{
...
...
@@ -1021,7 +1024,7 @@ void co_dump_appel_graph_cliques(const copy_opt_t *co, FILE *f)
appel_clique_walker_t
env
;
bitset_t
*
adm
=
bitset_alloca
(
co
->
cls
->
n_regs
);
be_liveness
(
co
->
irg
);
be_liveness
_recompute
(
co
->
cenv
->
lv
);
obstack_init
(
&
env
.
obst
);
phase_init
(
&
env
.
ph
,
"appel_clique_dumper"
,
co
->
irg
,
PHASE_DEFAULT_GROWTH
,
appel_clique_walker_irn_init
);
env
.
curr_nr
=
co
->
cls
->
n_regs
;
...
...
ir/be/becopyopt.h
View file @
48f89387
...
...
@@ -99,6 +99,7 @@ int co_solve_heuristic(copy_opt_t *co);
void
co_solve_heuristic_new
(
copy_opt_t
*
co
);
void
co_solve_heuristic_java
(
copy_opt_t
*
co
);
/**
* Apply Park/Moon coalescing to the graph.
...
...
ir/be/becopystat.c
View file @
48f89387
...
...
@@ -486,12 +486,11 @@ void co_compare_solvers(be_chordal_env_t *chordal_env) {
copystat_add_init_costs
(
costs_init
);
copystat_add_max_costs
(
co_get_max_copy_costs
(
co
));
/* heuristic 1 (Daniel Grund) */
timer
=
lc_timer_register
(
"heur1"
,
NULL
);
lc_timer_reset_and_start
(
timer
);
co_solve_heuristic
_new
(
co
);
co_solve_heuristic
(
co
);
lc_timer_stop
(
timer
);
...
...
@@ -517,6 +516,21 @@ void co_compare_solvers(be_chordal_env_t *chordal_env) {
copystat_add_heur_costs
(
costs_solved
);
assert
(
lower_bound
<=
costs_solved
);
/* Park & Moon register coalescing (Kimon Hoffmann) */
timer
=
lc_timer_register
(
"park"
,
NULL
);
lc_timer_reset_and_start
(
timer
);
co_solve_park_moon
(
co
);
lc_timer_stop
(
timer
);
be_ra_chordal_check
(
co
->
cenv
);
costs_solved
=
co_get_copy_costs
(
co
);
DBG
((
dbg
,
LEVEL_1
,
"Park/Moon costs: %3d
\n
"
,
costs_solved
));
copystat_add_heur_time
(
lc_timer_elapsed_msec
(
timer
));
copystat_add_heur_costs
(
costs_solved
);
assert
(
lower_bound
<=
costs_solved
);
#ifdef WITH_ILP
...
...
ir/be/beifg_std.c
View file @
48f89387
...
...
@@ -41,7 +41,8 @@ static void ifg_std_free(void *self)
static
int
ifg_std_connected
(
const
void
*
self
,
const
ir_node
*
a
,
const
ir_node
*
b
)
{
return
values_interfere
(
a
,
b
);
const
ifg_std_t
*
ifg
=
self
;
return
values_interfere
(
ifg
->
env
->
lv
,
a
,
b
);
}
typedef
struct
_nodes_iter_t
{
...
...
@@ -77,6 +78,7 @@ static void find_nodes(const void *self, void *iter) {
it
->
env
=
ifg
->
env
;
irg_block_walk_graph
(
ifg
->
env
->
irg
,
nodes_walker
,
NULL
,
iter
);
obstack_ptr_grow
(
&
it
->
obst
,
NULL
);
it
->
nodes
=
obstack_finish
(
&
it
->
obst
);
}
...
...
@@ -132,7 +134,7 @@ static void find_neighbour_walker(ir_node *block, void *data)
border_t
*
b
;
int
has_started
=
0
;
if
(
!
is_live_in
(
block
,
it
->
irn
)
&&
block
!=
get_nodes_block
(
it
->
irn
))
if
(
!
be_
is_live_in
(
it
->
env
->
lv
,
block
,
it
->
irn
)
&&
block
!=
get_nodes_block
(
it
->
irn
))
return
;
foreach_border_head
(
head
,
b
)
{
...
...
ir/be/beirgmod.c
View file @
48f89387
...
...
@@ -26,13 +26,17 @@
#include "irdom_t.h"
#include "iredges_t.h"
#include "irgopt.h"
#include "irprintf_t.h"
#include "irgwalk.h"
#include "be_t.h"
#include "bechordal_t.h"
#include "bearch.h"
#include "besched_t.h"
#include "belive_t.h"
#include "benode_t.h"
#include "beutil.h"
#include "beinsn_t.h"
#include "beirgmod.h"
...
...
@@ -383,39 +387,46 @@ static void remove_odd_phis(pset *copies, pset *unused_copies)
}
}
void
be_ssa_constr_phis_ignore
(
dom_front_info_t
*
info
,
int
n
,
ir_node
*
nodes
[],
pset
*
phis
,
pset
*
ignore_uses
)
void
be_ssa_constr_phis_ignore
(
dom_front_info_t
*
info
,
be_lv_t
*
lv
,
int
n
,
ir_node
*
nodes
[],
pset
*
phis
,
pset
*
ignore_uses
)
{
pset
*
irns
=
pset_new_ptr
(
n
);
int
i
;
for
(
i
=
0
;
i
<
n
;
++
i
)
pset_insert_ptr
(
irns
,
nodes
[
i
]);
be_ssa_constr_set_phis_ignore
(
info
,
irns
,
phis
,
ignore_uses
);
be_ssa_constr_set_phis_ignore
(
info
,
lv
,
irns
,
phis
,
ignore_uses
);
del_pset
(
irns
);
}
void
be_ssa_constr_ignore
(
dom_front_info_t
*
info
,
int
n
,
ir_node
*
nodes
[],
pset
*
ignore_uses
)
void
be_ssa_constr_ignore
(
dom_front_info_t
*
info
,
be_lv_t
*
lv
,
int
n
,
ir_node
*
nodes
[],
pset
*
ignore_uses
)
{
be_ssa_constr_phis_ignore
(
info
,
n
,
nodes
,
NULL
,
ignore_uses
);
be_ssa_constr_phis_ignore
(
info
,
lv
,
n
,
nodes
,
NULL
,
ignore_uses
);
}
void
be_ssa_constr
(
dom_front_info_t
*
info
,
int
n
,
ir_node
*
nodes
[])
void
be_ssa_constr
(
dom_front_info_t
*
info
,
be_lv_t
*
lv
,
int
n
,
ir_node
*
nodes
[])
{
pset
*
empty_set
=
be_empty_set
();
be_ssa_constr_ignore
(
info
,
n
,
nodes
,
empty_set
);