projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libcore: Check, that a pointer to a char array is passed to LC_OPT_ENT_STR().
[libfirm]
/
ir
/
be
/
beschednormal.c
diff --git
a/ir/be/beschednormal.c
b/ir/be/beschednormal.c
index
777bfe8
..
c23a2b7
100644
(file)
--- a/
ir/be/beschednormal.c
+++ b/
ir/be/beschednormal.c
@@
-20,7
+20,6
@@
/**
* @brief Use the strong normal form theorem (though it does not hold)
* @author Christoph Mallon
/**
* @brief Use the strong normal form theorem (though it does not hold)
* @author Christoph Mallon
- * @version $Id$
*/
#include "config.h"
*/
#include "config.h"
@@
-50,7
+49,7
@@
typedef struct instance_t {
static int must_be_scheduled(const ir_node* const irn)
{
static int must_be_scheduled(const ir_node* const irn)
{
- return !is_Proj(irn) && !
is_Sync(irn
);
+ return !is_Proj(irn) && !
arch_irn_is(irn, not_scheduled
);
}
}
@@
-60,7
+59,6
@@
static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set)
ir_node* irn;
ir_node* next;
ir_node* last = NULL;
ir_node* irn;
ir_node* next;
ir_node* last = NULL;
- ir_nodeset_iterator_t iter;
for (irn = inst->curr_list; irn != NULL; last = irn, irn = next) {
next = (ir_node*)get_irn_link(irn);
for (irn = inst->curr_list; irn != NULL; last = irn, irn = next) {
next = (ir_node*)get_irn_link(irn);
@@
-76,9
+74,7
@@
static ir_node *normal_select(void *block_env, ir_nodeset_t *ready_set)
}
}
}
}
- ir_nodeset_iterator_init(&iter, ready_set);
- irn = ir_nodeset_iterator_next(&iter);
- return irn;
+ return ir_nodeset_first(ready_set);
}
}
@@
-120,7
+116,8
@@
static int count_result(const ir_node* irn)
if (mode == mode_T)
return 1;
if (mode == mode_T)
return 1;
- if (arch_get_irn_register_req(irn)->type & arch_register_req_type_ignore)
+ arch_register_req_t const *const req = arch_get_irn_register_req(irn);
+ if (arch_register_req_is(req, ignore))
return 0;
return 1;
return 0;
return 1;
@@
-161,7
+158,7
@@
static int normal_tree_cost(ir_node* irn, instance_t *inst)
for (i = 0; i < arity; ++i) {
ir_node* pred = get_irn_n(irn, i);
for (i = 0; i < arity; ++i) {
ir_node* pred = get_irn_n(irn, i);
- if (is_Phi(irn) || get_irn_mode(pred) == mode_M
|| is_Block(pred)
) {
+ if (is_Phi(irn) || get_irn_mode(pred) == mode_M) {
cost = 0;
} else if (get_nodes_block(pred) != block) {
cost = 1;
cost = 0;
} else if (get_nodes_block(pred) != block) {
cost = 1;
@@
-198,9
+195,7
@@
static int normal_tree_cost(ir_node* irn, instance_t *inst)
mode = get_irn_mode(op);
if (mode == mode_M)
continue;
mode = get_irn_mode(op);
if (mode == mode_M)
continue;
- if (arch_get_irn_flags(op) & arch_irn_flags_not_scheduled)
- continue;
- if (mode != mode_T && arch_irn_is_ignore(op))
+ if (arch_irn_is_ignore(op))
continue;
cost = MAX(fc->costs[i].cost + n_op_res, cost);
last = op;
continue;
cost = MAX(fc->costs[i].cost + n_op_res, cost);
last = op;
@@
-224,7
+219,11
@@
static void normal_cost_walker(ir_node* irn, void* env)
#if defined NORMAL_DBG
ir_fprintf(stderr, "cost walking node %+F\n", irn);
#endif
#if defined NORMAL_DBG
ir_fprintf(stderr, "cost walking node %+F\n", irn);
#endif
- if (is_Block(irn)) return;
+ if (is_Block(irn)) {
+ ir_node **const roots = NEW_ARR_F(ir_node*, 0);
+ set_irn_link(irn, roots);
+ return;
+ }
if (!must_be_scheduled(irn)) return;
normal_tree_cost(irn, inst);
}
if (!must_be_scheduled(irn)) return;
normal_tree_cost(irn, inst);
}
@@
-236,7
+235,6
@@
static void collect_roots(ir_node* irn, void* env)
(void)env;
(void)env;
- if (is_Block(irn)) return;
if (!must_be_scheduled(irn)) return;
is_root = be_is_Keep(irn) || !get_irn_fc(irn)->no_root;
if (!must_be_scheduled(irn)) return;
is_root = be_is_Keep(irn) || !get_irn_fc(irn)->no_root;
@@
-248,9
+246,6
@@
static void collect_roots(ir_node* irn, void* env)
if (is_root) {
ir_node* block = get_nodes_block(irn);
ir_node** roots = (ir_node**)get_irn_link(block);
if (is_root) {
ir_node* block = get_nodes_block(irn);
ir_node** roots = (ir_node**)get_irn_link(block);
- if (roots == NULL) {
- roots = NEW_ARR_F(ir_node*, 0);
- }
ARR_APP1(ir_node*, roots, irn);
set_irn_link(block, roots);
}
ARR_APP1(ir_node*, roots, irn);
set_irn_link(block, roots);
}
@@
-260,7
+255,6
@@
static void collect_roots(ir_node* irn, void* env)
static ir_node** sched_node(ir_node** sched, ir_node* irn)
{
if (irn_visited_else_mark(irn)) return sched;
static ir_node** sched_node(ir_node** sched, ir_node* irn)
{
if (irn_visited_else_mark(irn)) return sched;
- if (is_End(irn)) return sched;
if (!is_Phi(irn) && !be_is_Keep(irn)) {
ir_node* block = get_nodes_block(irn);
if (!is_Phi(irn) && !be_is_Keep(irn)) {
ir_node* block = get_nodes_block(irn);
@@
-288,15
+282,19
@@
static int root_cmp(const void* a, const void* b)
const irn_cost_pair* const a1 = (const irn_cost_pair*)a;
const irn_cost_pair* const b1 = (const irn_cost_pair*)b;
int ret;
const irn_cost_pair* const a1 = (const irn_cost_pair*)a;
const irn_cost_pair* const b1 = (const irn_cost_pair*)b;
int ret;
- if (is_irn_forking(a1->irn)) {
+ if (is_irn_forking(a1->irn)
&& !is_irn_forking(b1->irn)
) {
ret = 1;
ret = 1;
- } else if (is_irn_forking(b1->irn)) {
+ } else if (is_irn_forking(b1->irn)
&& !is_irn_forking(a1->irn)
) {
ret = -1;
} else {
ret = b1->cost - a1->cost;
if (ret == 0) {
/* place live-out nodes later */
ret = (count_result(a1->irn) != 0) - (count_result(b1->irn) != 0);
ret = -1;
} else {
ret = b1->cost - a1->cost;
if (ret == 0) {
/* place live-out nodes later */
ret = (count_result(a1->irn) != 0) - (count_result(b1->irn) != 0);
+ if (ret == 0) {
+ /* compare node idx */
+ ret = get_irn_idx(a1->irn) - get_irn_idx(b1->irn);
+ }
}
}
#if defined NORMAL_DBG
}
}
#if defined NORMAL_DBG
@@
-310,7
+308,6
@@
static void normal_sched_block(ir_node* block, void* env)
{
ir_node** roots = (ir_node**)get_irn_link(block);
ir_heights_t* heights = (ir_heights_t*)env;
{
ir_node** roots = (ir_node**)get_irn_link(block);
ir_heights_t* heights = (ir_heights_t*)env;
- int root_count;
irn_cost_pair* root_costs;
int i;
ir_node** sched;
irn_cost_pair* root_costs;
int i;
ir_node** sched;
@@
-319,14
+316,14
@@
static void normal_sched_block(ir_node* block, void* env)
ir_fprintf(stderr, "sched walking block %+F\n", block);
#endif
ir_fprintf(stderr, "sched walking block %+F\n", block);
#endif
- if (roots == NULL) {
+ int const root_count = ARR_LEN(roots);
+ if (root_count == 0) {
#if defined NORMAL_DBG
fprintf(stderr, "has no roots\n");
#endif
return;
}
#if defined NORMAL_DBG
fprintf(stderr, "has no roots\n");
#endif
return;
}
- root_count = ARR_LEN(roots);
NEW_ARR_A(irn_cost_pair, root_costs, root_count);
for (i = 0; i < root_count; ++i) {
root_costs[i].irn = roots[i];
NEW_ARR_A(irn_cost_pair, root_costs, root_count);
for (i = 0; i < root_count; ++i) {
root_costs[i].irn = roots[i];