summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beuses.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-06-11 12:56:10 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-06-11 12:56:10 +0200
commit9dc759cb897f9dc75b9797abffd34ecb559c45a9 (patch)
treef21a815121128d77c5e98ef563ea59402d88b7a6 /ir/be/beuses.c
parentda0293abd337717ecb63bfb71bc6dee83d048087 (diff)
beuses: Make get_next_use() work when 'from' is the last instruction in a block.
This is necessary when jump instructions also produce normal values, e.g. asm goto. Before it would get the next node in the schedule, i.e. the block. But the block does not have a sensible time step. Now instead of skipping to the next instruction just compare with a larger threshold. Instructions in a block have consecutive time steps.
Diffstat (limited to 'ir/be/beuses.c')
-rw-r--r--ir/be/beuses.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ir/be/beuses.c b/ir/be/beuses.c
index 8e73c04..3b9d18b 100644
--- a/ir/be/beuses.c
+++ b/ir/be/beuses.c
@@ -166,13 +166,9 @@ static inline void set_step(ir_node *node, unsigned step)
* @param def the definition of the value
* @param skip_from_uses if non-zero, ignore from uses
*/
-static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
+static be_next_use_t get_next_use(be_uses_t *const env, ir_node *const from,
const ir_node *def, bool skip_from_uses)
{
- if (skip_from_uses) {
- from = sched_next(from);
- }
-
ir_node *next_use_node = NULL;
unsigned next_use_step = INT_MAX;
unsigned timestep = get_step(from);
@@ -187,7 +183,7 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
continue;
unsigned node_step = get_step(node);
- if (node_step < timestep)
+ if (node_step < timestep + skip_from_uses)
continue;
if (node_step < next_use_step) {
next_use_node = node;
@@ -197,14 +193,14 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from,
if (next_use_node != NULL) {
be_next_use_t result;
- result.time = next_use_step - timestep + skip_from_uses;
+ result.time = next_use_step - timestep;
result.outermost_loop = get_loop_depth(get_irn_loop(block));
result.before = next_use_node;
return result;
}
ir_node *node = sched_last(block);
- unsigned step = get_step(node) + 1 - timestep + skip_from_uses;
+ unsigned step = get_step(node) + 1 - timestep;
if (be_is_phi_argument(block, def)) {
// TODO we really should continue searching the uses of the phi,