Commit e1e6b4be authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bespillslots: Use be_get_end_of_block_insertion_point() instead of...

bespillslots: Use be_get_end_of_block_insertion_point() instead of implementing something not entierly unlike it.
parent 30b992a4
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "beintlive_t.h" #include "beintlive_t.h"
#include "beirg.h" #include "beirg.h"
#include "bearch.h" #include "bearch.h"
#include "bespillutil.h"
#define DBG_COALESCING 1 #define DBG_COALESCING 1
#define DBG_INTERFERENCES 2 #define DBG_INTERFERENCES 2
...@@ -599,35 +600,11 @@ static void assign_spillslots(be_fec_env_t *env) ...@@ -599,35 +600,11 @@ static void assign_spillslots(be_fec_env_t *env)
} }
} }
/**
* Returns the last node in a block which is no control flow changing node
*/
static ir_node *get_end_of_block_insertion_point(ir_node* block)
{
ir_node* ins = sched_last(block);
while (is_Proj(ins) && get_irn_mode(ins) == mode_X) {
ins = sched_prev(ins);
assert(ins != NULL);
}
if (is_cfop(ins)) {
for (;;) {
ir_node *prev = sched_prev(ins);
if (!is_cfop(prev))
break;
ins = prev;
}
}
return ins;
}
static void create_memperms(be_fec_env_t *env) static void create_memperms(be_fec_env_t *env)
{ {
foreach_set(env->memperms, memperm_t, memperm) { foreach_set(env->memperms, memperm_t, memperm) {
ir_node **nodes = ALLOCAN(ir_node*, memperm->entrycount); ir_node **nodes = ALLOCAN(ir_node*, memperm->entrycount);
memperm_entry_t *entry; memperm_entry_t *entry;
ir_node *blockend;
ir_node *mempermnode; ir_node *mempermnode;
int i; int i;
...@@ -642,7 +619,7 @@ static void create_memperms(be_fec_env_t *env) ...@@ -642,7 +619,7 @@ static void create_memperms(be_fec_env_t *env)
nodes); nodes);
/* insert node into schedule */ /* insert node into schedule */
blockend = get_end_of_block_insertion_point(memperm->block); ir_node *const blockend = be_get_end_of_block_insertion_point(memperm->block);
sched_add_before(blockend, mempermnode); sched_add_before(blockend, mempermnode);
stat_ev_dbl("mem_perm", memperm->entrycount); stat_ev_dbl("mem_perm", memperm->entrycount);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment