projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a ;
[libfirm]
/
ir
/
be
/
belistsched.c
diff --git
a/ir/be/belistsched.c
b/ir/be/belistsched.c
index
bffc885
..
20642a7
100644
(file)
--- a/
ir/be/belistsched.c
+++ b/
ir/be/belistsched.c
@@
-28,6
+28,7
@@
#include "irprintf_t.h"
#include "array.h"
#include "debug.h"
#include "irprintf_t.h"
#include "array.h"
#include "debug.h"
+#include "irtools.h"
#include "besched_t.h"
#include "beutil.h"
#include "besched_t.h"
#include "beutil.h"
@@
-37,9
+38,6
@@
#include "bearch.h"
#include "bestat.h"
#include "bearch.h"
#include "bestat.h"
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-
/**
* All scheduling info needed per node.
*/
/**
* All scheduling info needed per node.
*/
@@
-140,12
+138,12
@@
static void *trivial_init_block(void *graph_env, ir_node *bl)
static INLINE int must_appear_in_schedule(const list_sched_selector_t *sel, void *block_env, const ir_node *irn)
{
static INLINE int must_appear_in_schedule(const list_sched_selector_t *sel, void *block_env, const ir_node *irn)
{
- int res =
0
;
+ int res =
-1
;
if(sel->to_appear_in_schedule)
res = sel->to_appear_in_schedule(block_env, irn);
if(sel->to_appear_in_schedule)
res = sel->to_appear_in_schedule(block_env, irn);
- return res
|| to_appear_in_schedule(irn) || be_is_Keep(irn) || be_is_RegParams(irn
);
+ return res
>= 0 ? res : (to_appear_in_schedule(irn) || be_is_Keep(irn) || be_is_RegParams(irn)
);
}
static const list_sched_selector_t trivial_selector_struct = {
}
static const list_sched_selector_t trivial_selector_struct = {
@@
-656,6
+654,9
@@
static void add_tuple_projs(block_sched_env_t *env, ir_node *irn)
assert(get_irn_mode(irn) == mode_T && "Mode of node must be tuple");
assert(get_irn_mode(irn) == mode_T && "Mode of node must be tuple");
+ if(is_Bad(irn))
+ return;
+
foreach_out_edge(irn, edge) {
ir_node *out = edge->src;
foreach_out_edge(irn, edge) {
ir_node *out = edge->src;
@@
-698,6
+699,9
@@
static int is_root(ir_node *root, ir_node *block) {
if (is_Block(succ))
continue;
if (is_Block(succ))
continue;
+ /* Phi nodes are always in "another block */
+ if (is_Phi(succ))
+ continue;
if (get_nodes_block(succ) == block)
return 0;
}
if (get_nodes_block(succ) == block)
return 0;
}
@@
-708,6
+712,8
@@
static int is_root(ir_node *root, ir_node *block) {
static char _mark;
#define MARK &_mark
static char _mark;
#define MARK &_mark
+static firm_dbg_module_t *xxxdbg;
+
/**
* descent into a dag and create a pre-order list.
*/
/**
* descent into a dag and create a pre-order list.
*/
@@
-719,6
+725,7
@@
static void descent(ir_node *root, ir_node *block, ir_node **list) {
for (i = get_irn_arity(root) - 1; i >= 0; --i) {
ir_node *pred = get_irn_n(root, i);
for (i = get_irn_arity(root) - 1; i >= 0; --i) {
ir_node *pred = get_irn_n(root, i);
+ DBG((xxxdbg, LEVEL_3, " node %+F\n", pred));
/* Blocks may happen as predecessors of End nodes */
if (is_Block(pred))
continue;
/* Blocks may happen as predecessors of End nodes */
if (is_Block(pred))
continue;
@@
-731,6
+738,8
@@
static void descent(ir_node *root, ir_node *block, ir_node **list) {
if (get_nodes_block(pred) != block)
continue;
if (get_nodes_block(pred) != block)
continue;
+ set_irn_link(pred, NULL);
+
descent(pred, block, list);
}
}
descent(pred, block, list);
}
}
@@
-775,6
+784,7
@@
static void list_sched_block(ir_node *block, void *env_ptr)
be.selector = selector;
be.sched_env = env;
FIRM_DBG_REGISTER(be.dbg, "firm.be.sched");
be.selector = selector;
be.sched_env = env;
FIRM_DBG_REGISTER(be.dbg, "firm.be.sched");
+ FIRM_DBG_REGISTER(xxxdbg, "firm.be.sched");
// firm_dbg_set_mask(be.dbg, SET_LEVEL_3);
// firm_dbg_set_mask(be.dbg, SET_LEVEL_3);
@@
-800,6
+810,7
@@
static void list_sched_block(ir_node *block, void *env_ptr)
preord = NULL;
for (curr = root; curr; curr = irn) {
irn = get_irn_link(curr);
preord = NULL;
for (curr = root; curr; curr = irn) {
irn = get_irn_link(curr);
+ DBG((be.dbg, LEVEL_2, " DAG root %+F\n", curr));
descent(curr, block, &preord);
}
root = preord;
descent(curr, block, &preord);
}
root = preord;
@@
-993,7
+1004,7
@@
static const list_sched_selector_t reg_pressure_selector_struct = {
const list_sched_selector_t *reg_pressure_selector = ®_pressure_selector_struct;
/* List schedule a graph. */
const list_sched_selector_t *reg_pressure_selector = ®_pressure_selector_struct;
/* List schedule a graph. */
-void list_sched(const be_irg_t *birg, int
dis
able_mris)
+void list_sched(const be_irg_t *birg, int
en
able_mris)
{
const arch_env_t *arch_env = birg->main_env->arch_env;
ir_graph *irg = birg->irg;
{
const arch_env_t *arch_env = birg->main_env->arch_env;
ir_graph *irg = birg->irg;
@@
-1005,7
+1016,7
@@
void list_sched(const be_irg_t *birg, int disable_mris)
/* Assure, that the out edges are computed */
edges_assure(irg);
/* Assure, that the out edges are computed */
edges_assure(irg);
- if(
!dis
able_mris)
+ if(
en
able_mris)
mris = be_sched_mris_preprocess(birg);
num_nodes = get_irg_last_idx(irg);
mris = be_sched_mris_preprocess(birg);
num_nodes = get_irg_last_idx(irg);
@@
-1027,7
+1038,7
@@
void list_sched(const be_irg_t *birg, int disable_mris)
if (env.selector->finish_graph)
env.selector->finish_graph(env.selector_env);
if (env.selector->finish_graph)
env.selector->finish_graph(env.selector_env);
- if(
!dis
able_mris)
+ if(
en
able_mris)
be_sched_mris_free(mris);
DEL_ARR_F(env.sched_info);
be_sched_mris_free(mris);
DEL_ARR_F(env.sched_info);