#include "besched.h"
#include "belistsched.h"
-#include "benode_t.h"
+#include "benode.h"
typedef struct _usage_stats_t {
* One of them is live at the end of the block.
* Then, that one shall be scheduled at after the other
*/
- if(res != 0)
+ if (res != 0)
return res;
{
usage_stats_t *us = get_irn_link(irn);
- if(!us) {
+ if (!us) {
us = OALLOC(&env->obst, usage_stats_t);
us->irn = irn;
us->already_consumed = 0;
* If the reached node is not in the block desired,
* return the value passed for this situation.
*/
- if(get_nodes_block(irn) != bl)
+ if (get_nodes_block(irn) != bl)
return block_dominates(bl, curr_bl) ? 0 : INT_MAX;
/*
* If the node is in the current block but not
* yet scheduled, we keep on searching from that node.
*/
- if(!ir_nodeset_contains(&env->already_scheduled, irn)) {
+ if (!ir_nodeset_contains(&env->already_scheduled, irn)) {
int i, n;
int res = 0;
- for(i = 0, n = get_irn_ins_or_deps(irn); i < n; ++i) {
+ for (i = 0, n = get_irn_ins_or_deps(irn); i < n; ++i) {
ir_node *operand = get_irn_in_or_dep(irn, i);
- if(get_irn_visited(operand) < visited_nr) {
+ if (get_irn_visited(operand) < visited_nr) {
int tmp;
set_irn_visited(operand, visited_nr);
{
int res = -1;
- if(sel->to_appear_in_schedule)
+ if (sel->to_appear_in_schedule)
res = sel->to_appear_in_schedule(block_env, irn);
- return res >= 0 ? res : (to_appear_in_schedule(irn) || be_is_Keep(irn) || be_is_CopyKeep(irn) || be_is_RegParams(irn));
+ return res >= 0 ? res : (to_appear_in_schedule(irn) || be_is_Keep(irn) || be_is_CopyKeep(irn) || be_is_Start(irn));
}
static void *reg_pressure_block_init(void *graph_env, ir_node *bl)
* Collect usage statistics.
*/
sched_foreach(bl, irn) {
- if(must_appear_in_schedule(env->main_env->vtab, env, irn)) {
+ if (must_appear_in_schedule(env->main_env->vtab, env, irn)) {
int i, n;
- for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
+ for (i = 0, n = get_irn_arity(irn); i < n; ++i) {
//ir_node *op = get_irn_n(irn, i);
- if(must_appear_in_schedule(env->main_env->vtab, env, irn)) {
+ if (must_appear_in_schedule(env->main_env->vtab, env, irn)) {
usage_stats_t *us = get_or_set_usage_stats(env, irn);
#if 0 /* Liveness is not computed here! */
- if(is_live_end(bl, op))
+ if (is_live_end(bl, op))
us->uses_in_block = 99999;
else
#endif
reg_pressure_selector_env_t *env = block_env;
usage_stats_t *us;
- for(us = env->root; us; us = us->next)
+ for (us = env->root; us; us = us->next)
set_irn_link(us->irn, NULL);
obstack_free(&env->obst, NULL);
static int get_result_hops_sum(reg_pressure_selector_env_t *env, ir_node *irn)
{
int res = 0;
- if(get_irn_mode(irn) == mode_T) {
+ if (get_irn_mode(irn) == mode_T) {
const ir_edge_t *edge;
foreach_out_edge(irn, edge)
res += get_result_hops_sum(env, get_edge_src_irn(edge));
}
- else if(mode_is_data(get_irn_mode(irn)))
+ else if (mode_is_data(get_irn_mode(irn)))
res = compute_max_hops(env, irn);
int i, n;
int sum = 0;
- for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
+ for (i = 0, n = get_irn_arity(irn); i < n; ++i) {
ir_node *op = get_irn_n(irn, i);
- if(must_appear_in_schedule(env->main_env->vtab, env, op))
+ if (must_appear_in_schedule(env->main_env->vtab, env, op))
sum += compute_max_hops(env, op);
}
assert(ir_nodeset_size(ready_set) > 0);
ir_nodeset_iterator_init(&iter, ready_set);
- while( (irn = ir_nodeset_iterator_next(&iter)) != NULL) {
+ while ( (irn = ir_nodeset_iterator_next(&iter)) != NULL) {
/*
Ignore branch instructions for the time being.
They should only be scheduled if there is nothing else.
Take it and finish.
*/
- if(!res) {
+ if (!res) {
ir_nodeset_iterator_init(&iter, ready_set);
res = ir_nodeset_iterator_next(&iter);