/*
- * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
/**
* @file
- * @brief Regpressure node selector.
+ * @brief Register pressure node selector.
* @author Sebastian Hack
* @date 29.08.2006
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <stdlib.h>
#include "iredges_t.h"
#include "irgwalk.h"
+#include "irtools.h"
#include "besched_t.h"
#include "belistsched.h"
typedef struct {
const list_sched_selector_t *vtab;
- const arch_env_t *arch_env;
} reg_pressure_main_env_t;
typedef struct {
}
#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);
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");
return res;
}
-static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg)
+static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const be_irg_t *birg)
{
- reg_pressure_main_env_t *main_env = xmalloc(sizeof(main_env[0]));
+ reg_pressure_main_env_t *main_env = XMALLOC(reg_pressure_main_env_t);
- main_env->arch_env = arch_env;
- main_env->vtab = vtab;
- irg_walk_graph(irg, firm_clear_link, NULL, NULL);
+ main_env->vtab = vtab;
+ irg_walk_graph(be_get_birg_irg(birg), firm_clear_link, NULL, NULL);
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;
static void *reg_pressure_block_init(void *graph_env, ir_node *bl)
{
ir_node *irn;
- reg_pressure_selector_env_t *env = xmalloc(sizeof(env[0]));
+ reg_pressure_selector_env_t *env = XMALLOC(reg_pressure_selector_env_t);
obstack_init(&env->obst);
ir_nodeset_init(&env->already_scheduled);
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;
Ignore branch instructions for the time being.
They should only be scheduled if there is nothing else.
*/
- if (! arch_irn_class_is(env->main_env->arch_env, irn, branch)) {
+ if (!arch_irn_class_is(irn, branch)) {
int costs = reg_pr_costs(env, irn);
if (costs <= curr_cost) {
res = irn;
return res;
}
-static const list_sched_selector_t reg_pressure_selector_struct = {
+const list_sched_selector_t reg_pressure_selector = {
reg_pressure_graph_init,
reg_pressure_block_init,
reg_pressure_select,
reg_pressure_block_free,
free
};
-
-const list_sched_selector_t *reg_pressure_selector = ®_pressure_selector_struct;