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
17f1b654
Commit
17f1b654
authored
Jan 10, 2015
by
Christoph Mallon
Browse files
besched: Add be_move_after_schedule_first() to place nodes after schedule_first nodes.
parent
58e07445
Changes
6
Hide whitespace changes
Inline
Side-by-side
ir/be/arm/arm_finish.c
View file @
17f1b654
...
...
@@ -81,15 +81,12 @@ static void introduce_prolog_epilog(ir_graph *irg)
ir_node
*
start
=
get_irg_start
(
irg
);
ir_node
*
block
=
get_nodes_block
(
start
);
ir_node
*
initial_sp
=
be_get_initial_reg_value
(
irg
,
sp_reg
);
ir_node
*
schedpoint
=
start
;
ir_type
*
frame_type
=
get_irg_frame_type
(
irg
);
unsigned
frame_size
=
get_type_size_bytes
(
frame_type
);
while
(
be_is_Keep
(
sched_next
(
schedpoint
)))
schedpoint
=
sched_next
(
schedpoint
);
ir_node
*
const
incsp
=
be_new_IncSP
(
sp_reg
,
block
,
initial_sp
,
frame_size
,
0
);
edges_reroute_except
(
initial_sp
,
incsp
,
incsp
);
ir_node
*
const
schedpoint
=
be_move_after_schedule_first
(
start
);
sched_add_after
(
schedpoint
,
incsp
);
}
...
...
ir/be/besched.c
View file @
17f1b654
...
...
@@ -166,3 +166,13 @@ void be_init_sched(void)
be_add_module_list_opt
(
be_grp
,
"scheduler"
,
"scheduling algorithm"
,
&
schedulers
,
(
void
**
)
&
scheduler
);
}
ir_node
*
be_move_after_schedule_first
(
ir_node
*
node
)
{
for
(;;)
{
ir_node
*
const
next
=
sched_next
(
node
);
if
(
!
arch_irn_is
(
next
,
schedule_first
))
return
node
;
node
=
next
;
}
}
ir/be/besched.h
View file @
17f1b654
...
...
@@ -229,4 +229,10 @@ void be_register_scheduler(const char *name, schedule_func func);
*/
void
be_schedule_graph
(
ir_graph
*
irg
);
/**
* Return the last schedule_first node following node, if there is any, node
* otherwise.
*/
ir_node
*
be_move_after_schedule_first
(
ir_node
*
node
);
#endif
ir/be/bespillutil.c
View file @
17f1b654
...
...
@@ -210,22 +210,6 @@ ir_node *be_get_end_of_block_insertion_point(const ir_node *block)
return
last
;
}
/**
* determine final spill position: it should be after all phis, keep nodes
* and behind nodes marked as prolog
*/
static
ir_node
*
determine_spill_point
(
ir_node
*
const
node
)
{
ir_node
*
n
=
skip_Proj
(
node
);
while
(
true
)
{
ir_node
*
next
=
sched_next
(
n
);
if
(
!
is_Phi
(
next
)
&&
!
be_is_Keep
(
next
)
&&
!
be_is_CopyKeep
(
next
))
break
;
n
=
next
;
}
return
n
;
}
/**
* Returns the point at which you can insert a node that should be executed
* before block @p block when coming from pred @p pos.
...
...
@@ -272,7 +256,7 @@ void be_spill_phi(spill_env_t *env, ir_node *node)
insert
=
be_get_end_of_block_insertion_point
(
pred_block
);
insert
=
sched_prev
(
insert
);
}
else
{
insert
=
determine_spill_poin
t
(
arg
);
insert
=
be_move_after_schedule_firs
t
(
arg
);
}
be_add_spill
(
env
,
arg
,
insert
);
}
...
...
@@ -308,9 +292,7 @@ static void spill_irn(spill_env_t *env, spill_info_t *spillinfo)
DBG
((
dbg
,
LEVEL_1
,
"spilling %+F ...
\n
"
,
to_spill
));
for
(
spill_t
*
spill
=
spillinfo
->
spills
;
spill
!=
NULL
;
spill
=
spill
->
next
)
{
ir_node
*
after
=
spill
->
after
;
after
=
determine_spill_point
(
after
);
ir_node
*
const
after
=
be_move_after_schedule_first
(
spill
->
after
);
spill
->
spill
=
arch_env_new_spill
(
env
->
arch_env
,
to_spill
,
after
);
DB
((
dbg
,
LEVEL_1
,
"
\t
%+F after %+F
\n
"
,
spill
->
spill
,
after
));
env
->
spill_count
++
;
...
...
@@ -348,7 +330,7 @@ static void spill_phi(spill_env_t *env, spill_info_t *spillinfo)
/* override or replace spills list... */
ir_node
*
block
=
get_nodes_block
(
phi
);
spill_t
*
spill
=
OALLOC
(
&
env
->
obst
,
spill_t
);
spill
->
after
=
determine_spill_poin
t
(
phi
);
spill
->
after
=
be_move_after_schedule_firs
t
(
phi
);
spill
->
spill
=
be_new_Phi
(
block
,
arity
,
ins
,
mode_M
,
arch_no_register_req
);
spill
->
next
=
NULL
;
sched_add_after
(
block
,
spill
->
spill
);
...
...
@@ -612,7 +594,7 @@ static void determine_spill_costs(spill_env_t *env, spill_info_t *spillinfo)
/* override spillinfos or create a new one */
spill_t
*
spill
=
OALLOC
(
&
env
->
obst
,
spill_t
);
spill
->
after
=
determine_spill_point
(
to_spill
);
spill
->
after
=
be_move_after_schedule_first
(
skip_Proj
(
to_spill
)
)
;
spill
->
next
=
NULL
;
spill
->
spill
=
NULL
;
...
...
@@ -1186,13 +1168,8 @@ static void melt_copykeeps(constraint_env_t *cenv)
ir_nodeset_insert
(
&
entry
->
copies
,
new_ck
);
/* find scheduling point */
ir_node
*
sched_pt
=
ref_mode_T
;
do
{
/* just walk along the schedule until a non-Keep/CopyKeep node is found */
sched_pt
=
sched_next
(
sched_pt
);
}
while
(
be_is_Keep
(
sched_pt
)
||
be_is_CopyKeep
(
sched_pt
));
sched_add_before
(
sched_pt
,
new_ck
);
ir_node
*
const
sched_pt
=
be_move_after_schedule_first
(
ref_mode_T
);
sched_add_after
(
sched_pt
,
new_ck
);
DB
((
dbg_constr
,
LEVEL_1
,
"created %+F, scheduled before %+F
\n
"
,
new_ck
,
sched_pt
));
/* finally: kill the reference copykeep */
...
...
ir/be/bestate.c
View file @
17f1b654
...
...
@@ -110,11 +110,7 @@ static spill_info_t *create_spill(minibelady_env_t *env, ir_node *state,
ir_node
*
after
;
if
(
sched_is_scheduled
(
state
))
{
ir_node
*
next
=
state
;
do
{
after
=
next
;
next
=
sched_next
(
after
);
}
while
(
is_Phi
(
next
)
||
be_is_Keep
(
next
));
after
=
be_move_after_schedule_first
(
state
);
}
else
{
after
=
state
;
}
...
...
ir/be/sparc/sparc_finish.c
View file @
17f1b654
...
...
@@ -173,7 +173,6 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
be_stack_layout_t
*
layout
=
be_get_irg_stack_layout
(
irg
);
ir_node
*
block
=
get_nodes_block
(
start
);
ir_node
*
initial_sp
=
be_get_initial_reg_value
(
irg
,
sp_reg
);
ir_node
*
schedpoint
=
start
;
ir_type
*
frame_type
=
get_irg_frame_type
(
irg
);
unsigned
frame_size
=
get_type_size_bytes
(
frame_type
);
...
...
@@ -183,14 +182,11 @@ static void sparc_introduce_prolog_epilog(ir_graph *irg)
introduce_epilog
(
ret
);
}
while
(
be_is_Keep
(
sched_next
(
schedpoint
)))
schedpoint
=
sched_next
(
schedpoint
);
ir_node
*
const
schedpoint
=
be_move_after_schedule_first
(
start
);
if
(
!
layout
->
sp_relative
)
{
ir_node
*
const
save
=
new_bd_sparc_Save_imm
(
NULL
,
block
,
initial_sp
,
NULL
,
-
(
SPARC_MIN_STACKSIZE
+
frame_size
));
arch_set_irn_register
(
save
,
sp_reg
);
sched_add_after
(
schedpoint
,
save
);
schedpoint
=
save
;
edges_reroute_except
(
initial_sp
,
save
,
save
);
...
...
Write
Preview
Markdown
is supported
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