- refactoring of backend generator scripts: You can create multiple constructors
[libfirm] / ir / be / beschedregpress.c
index b6e0c6e..4c98e70 100644 (file)
@@ -24,9 +24,7 @@
  * @date        29.08.2006
  * @version     $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 
@@ -34,9 +32,9 @@
 #include "irgwalk.h"
 #include "irtools.h"
 
-#include "besched_t.h"
+#include "besched.h"
 #include "belistsched.h"
-#include "benode_t.h"
+#include "benode.h"
 
 
 typedef struct _usage_stats_t {
@@ -88,12 +86,12 @@ static int cmp_usage(const void *a, const void *b)
 }
 #endif
 
-static INLINE usage_stats_t *get_or_set_usage_stats(reg_pressure_selector_env_t *env, ir_node *irn)
+static inline usage_stats_t *get_or_set_usage_stats(reg_pressure_selector_env_t *env, ir_node *irn)
 {
        usage_stats_t *us = get_irn_link(irn);
 
        if(!us) {
-               us                   = obstack_alloc(&env->obst, sizeof(us[0]));
+               us                   = OALLOC(&env->obst, usage_stats_t);
                us->irn              = irn;
                us->already_consumed = 0;
                us->max_hops         = INT_MAX;
@@ -105,7 +103,7 @@ static INLINE usage_stats_t *get_or_set_usage_stats(reg_pressure_selector_env_t
        return us;
 }
 
-static INLINE usage_stats_t *get_usage_stats(ir_node *irn)
+static inline usage_stats_t *get_usage_stats(ir_node *irn)
 {
        usage_stats_t *us = get_irn_link(irn);
        assert(us && "This node must have usage stats");
@@ -183,14 +181,14 @@ static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const be
        return main_env;
 }
 
-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 = -1;
 
        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)
@@ -258,7 +256,7 @@ static int get_result_hops_sum(reg_pressure_selector_env_t *env, ir_node *irn)
        return res;
 }
 
-static INLINE int reg_pr_costs(reg_pressure_selector_env_t *env, ir_node *irn)
+static inline int reg_pr_costs(reg_pressure_selector_env_t *env, ir_node *irn)
 {
        int i, n;
        int sum = 0;
@@ -292,7 +290,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
                Ignore branch instructions for the time being.
                They should only be scheduled if there is nothing else.
                */
-               if (!arch_irn_class_is(irn, branch)) {
+               if (!is_cfop(irn)) {
                        int costs = reg_pr_costs(env, irn);
                        if (costs <= curr_cost) {
                                res       = irn;