projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
non 32-bit divisions need upconvs
[libfirm]
/
ir
/
be
/
beschedregpress.c
diff --git
a/ir/be/beschedregpress.c
b/ir/be/beschedregpress.c
index
52a19ab
..
4c98e70
100644
(file)
--- a/
ir/be/beschedregpress.c
+++ b/
ir/be/beschedregpress.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-18,24
+18,23
@@
*/
/**
*/
/**
- *
Regpressure node selector.
- *
Originally implemented by Sebastian Hack
.
- * @author
Christian Wuerdig
- * @date 29.08.2006
- * @
cvs-id
$Id$
+ *
@file
+ *
@brief Register pressure node selector
.
+ * @author
Sebastian Hack
+ * @date
29.08.2006
+ * @
version
$Id$
*/
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
-#endif
#include <stdlib.h>
#include "iredges_t.h"
#include "irgwalk.h"
#include <stdlib.h>
#include "iredges_t.h"
#include "irgwalk.h"
+#include "irtools.h"
-#include "besched
_t
.h"
+#include "besched.h"
#include "belistsched.h"
#include "belistsched.h"
-#include "benode
_t
.h"
+#include "benode.h"
typedef struct _usage_stats_t {
typedef struct _usage_stats_t {
@@
-49,7
+48,6
@@
typedef struct _usage_stats_t {
typedef struct {
const list_sched_selector_t *vtab;
typedef struct {
const list_sched_selector_t *vtab;
- const arch_env_t *arch_env;
} reg_pressure_main_env_t;
typedef struct {
} reg_pressure_main_env_t;
typedef struct {
@@
-88,12
+86,12
@@
static int cmp_usage(const void *a, const void *b)
}
#endif
}
#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) {
{
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;
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;
}
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");
{
usage_stats_t *us = get_irn_link(irn);
assert(us && "This node must have usage stats");
@@
-173,31
+171,30
@@
static int compute_max_hops(reg_pressure_selector_env_t *env, ir_node *irn)
return res;
}
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 *b
irg)
{
{
- 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;
}
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);
{
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)
{
ir_node *irn;
}
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);
obstack_init(&env->obst);
ir_nodeset_init(&env->already_scheduled);
@@
-259,7
+256,7
@@
static int get_result_hops_sum(reg_pressure_selector_env_t *env, ir_node *irn)
return res;
}
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;
{
int i, n;
int sum = 0;
@@
-283,6
+280,7
@@
static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
reg_pressure_selector_env_t *env = block_env;
ir_node *irn, *res = NULL;
int curr_cost = INT_MAX;
reg_pressure_selector_env_t *env = block_env;
ir_node *irn, *res = NULL;
int curr_cost = INT_MAX;
+ (void) live_set;
assert(ir_nodeset_size(ready_set) > 0);
assert(ir_nodeset_size(ready_set) > 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.
*/
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 (!
is_cfop(irn
)) {
int costs = reg_pr_costs(env, irn);
if (costs <= curr_cost) {
res = irn;
int costs = reg_pr_costs(env, irn);
if (costs <= curr_cost) {
res = irn;
@@
-317,7
+315,7
@@
static ir_node *reg_pressure_select(void *block_env, ir_nodeset_t *ready_set,
return res;
}
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_graph_init,
reg_pressure_block_init,
reg_pressure_select,
@@
-329,5
+327,3
@@
static const list_sched_selector_t reg_pressure_selector_struct = {
reg_pressure_block_free,
free
};
reg_pressure_block_free,
free
};
-
-const list_sched_selector_t *reg_pressure_selector = ®_pressure_selector_struct;