X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeschedregpress.c;h=5f5e659365ff7a894f9e8d6f7112b68b91c079a0;hb=5db9cfb26b9524a5531404ae4911837e60783586;hp=e34afa838b52e59760b7885e43361890500bcede;hpb=e66230064eece9d3e28b66ae3a26bf8554459c60;p=libfirm diff --git a/ir/be/beschedregpress.c b/ir/be/beschedregpress.c index e34afa838..5f5e65936 100644 --- a/ir/be/beschedregpress.c +++ b/ir/be/beschedregpress.c @@ -1,5 +1,5 @@ /* - * 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. * @@ -24,9 +24,7 @@ * @date 29.08.2006 * @version $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include @@ -50,7 +48,6 @@ typedef struct _usage_stats_t { typedef struct { const list_sched_selector_t *vtab; - const arch_env_t *arch_env; } reg_pressure_main_env_t; typedef struct { @@ -89,7 +86,7 @@ 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); @@ -106,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"); @@ -176,16 +173,15 @@ static int compute_max_hops(reg_pressure_selector_env_t *env, ir_node *irn) 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 = be_get_birg_arch_env(birg); - main_env->vtab = vtab; + 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; @@ -198,7 +194,7 @@ static INLINE int must_appear_in_schedule(const list_sched_selector_t *sel, void 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); @@ -260,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; @@ -294,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(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; @@ -319,7 +315,7 @@ static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set, 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, @@ -331,5 +327,3 @@ static const list_sched_selector_t reg_pressure_selector_struct = { reg_pressure_block_free, free }; - -const list_sched_selector_t *reg_pressure_selector = ®_pressure_selector_struct;