projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
I was annoyed by the compiler warnings about implicit conversions.
[libfirm]
/
ir
/
be
/
beschedtrace.c
diff --git
a/ir/be/beschedtrace.c
b/ir/be/beschedtrace.c
index
9f3822d
..
f216ab0
100644
(file)
--- a/
ir/be/beschedtrace.c
+++ b/
ir/be/beschedtrace.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.
*
@@
-24,17
+24,16
@@
* @date 28.08.2006
* @version $Id$
*/
* @date 28.08.2006
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
-#endif
#include <stdlib.h>
#include "iredges_t.h"
#include <stdlib.h>
#include "iredges_t.h"
-#include "besched
_t
.h"
+#include "besched.h"
#include "belistsched.h"
#include "belistsched.h"
-#include "benode_t.h"
+#include "benode.h"
+#include "belive.h"
/* we need a special mark */
static char _mark;
/* we need a special mark */
static char _mark;
@@
-52,7
+51,6
@@
typedef struct _trace_irn {
typedef struct _trace_env {
trace_irn_t *sched_info; /**< trace scheduling information about the nodes */
typedef struct _trace_env {
trace_irn_t *sched_info; /**< trace scheduling information about the nodes */
- const arch_env_t *arch_env; /**< the arch environment */
sched_timestep_t curr_time; /**< current time of the scheduler */
void *selector_env; /**< the backend selector environment */
const list_sched_selector_t *selector; /**< the actual backend selector */
sched_timestep_t curr_time; /**< current time of the scheduler */
void *selector_env; /**< the backend selector environment */
const list_sched_selector_t *selector; /**< the actual backend selector */
@@
-74,7
+72,7
@@
static ir_node *get_nodeset_node(const ir_nodeset_t *nodeset)
/**
* Returns non-zero if the node is a root node
*/
/**
* Returns non-zero if the node is a root node
*/
-static
INLINE
unsigned is_root_node(trace_env_t *env, ir_node *n)
+static
inline
unsigned is_root_node(trace_env_t *env, ir_node *n)
{
int idx = get_irn_idx(n);
{
int idx = get_irn_idx(n);
@@
-85,7
+83,7
@@
static INLINE unsigned is_root_node(trace_env_t *env, ir_node *n)
/**
* Mark a node as root node
*/
/**
* Mark a node as root node
*/
-static
INLINE
void mark_root_node(trace_env_t *env, ir_node *n)
+static
inline
void mark_root_node(trace_env_t *env, ir_node *n)
{
int idx = get_irn_idx(n);
{
int idx = get_irn_idx(n);
@@
-96,7
+94,7
@@
static INLINE void mark_root_node(trace_env_t *env, ir_node *n)
/**
* Get the current delay.
*/
/**
* Get the current delay.
*/
-static
INLINE
sched_timestep_t get_irn_delay(trace_env_t *env, ir_node *n) {
+static
inline
sched_timestep_t get_irn_delay(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-106,7
+104,7
@@
static INLINE sched_timestep_t get_irn_delay(trace_env_t *env, ir_node *n) {
/**
* Set the current delay.
*/
/**
* Set the current delay.
*/
-static
INLINE
void set_irn_delay(trace_env_t *env, ir_node *n, sched_timestep_t delay) {
+static
inline
void set_irn_delay(trace_env_t *env, ir_node *n, sched_timestep_t delay) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-116,7
+114,7
@@
static INLINE void set_irn_delay(trace_env_t *env, ir_node *n, sched_timestep_t
/**
* Get the current etime.
*/
/**
* Get the current etime.
*/
-static
INLINE
sched_timestep_t get_irn_etime(trace_env_t *env, ir_node *n) {
+static
inline
sched_timestep_t get_irn_etime(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-126,7
+124,7
@@
static INLINE sched_timestep_t get_irn_etime(trace_env_t *env, ir_node *n) {
/**
* Set the current etime.
*/
/**
* Set the current etime.
*/
-static
INLINE
void set_irn_etime(trace_env_t *env, ir_node *n, sched_timestep_t etime) {
+static
inline
void set_irn_etime(trace_env_t *env, ir_node *n, sched_timestep_t etime) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-136,7
+134,7
@@
static INLINE void set_irn_etime(trace_env_t *env, ir_node *n, sched_timestep_t
/**
* Get the number of users.
*/
/**
* Get the number of users.
*/
-static
INLINE
unsigned get_irn_num_user(trace_env_t *env, ir_node *n) {
+static
inline
unsigned get_irn_num_user(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-146,7
+144,7
@@
static INLINE unsigned get_irn_num_user(trace_env_t *env, ir_node *n) {
/**
* Set the number of users.
*/
/**
* Set the number of users.
*/
-static
INLINE
void set_irn_num_user(trace_env_t *env, ir_node *n, unsigned num_user) {
+static
inline
void set_irn_num_user(trace_env_t *env, ir_node *n, unsigned num_user) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-156,7
+154,7
@@
static INLINE void set_irn_num_user(trace_env_t *env, ir_node *n, unsigned num_u
/**
* Get the register difference.
*/
/**
* Get the register difference.
*/
-static
INLINE
int get_irn_reg_diff(trace_env_t *env, ir_node *n) {
+static
inline
int get_irn_reg_diff(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-166,7
+164,7
@@
static INLINE int get_irn_reg_diff(trace_env_t *env, ir_node *n) {
/**
* Set the register difference.
*/
/**
* Set the register difference.
*/
-static
INLINE
void set_irn_reg_diff(trace_env_t *env, ir_node *n, int reg_diff) {
+static
inline
void set_irn_reg_diff(trace_env_t *env, ir_node *n, int reg_diff) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-176,7
+174,7
@@
static INLINE void set_irn_reg_diff(trace_env_t *env, ir_node *n, int reg_diff)
/**
* Get the pre-order position.
*/
/**
* Get the pre-order position.
*/
-static
INLINE
int get_irn_preorder(trace_env_t *env, ir_node *n) {
+static
inline
int get_irn_preorder(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-186,7
+184,7
@@
static INLINE int get_irn_preorder(trace_env_t *env, ir_node *n) {
/**
* Set the pre-order position.
*/
/**
* Set the pre-order position.
*/
-static
INLINE
void set_irn_preorder(trace_env_t *env, ir_node *n, int pos) {
+static
inline
void set_irn_preorder(trace_env_t *env, ir_node *n, int pos) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-196,7
+194,7
@@
static INLINE void set_irn_preorder(trace_env_t *env, ir_node *n, int pos) {
/**
* Get the pre-order position.
*/
/**
* Get the pre-order position.
*/
-static
INLINE
unsigned get_irn_critical_path_len(trace_env_t *env, ir_node *n) {
+static
inline
unsigned get_irn_critical_path_len(trace_env_t *env, ir_node *n) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-206,7
+204,7
@@
static INLINE unsigned get_irn_critical_path_len(trace_env_t *env, ir_node *n) {
/**
* Set the pre-order position.
*/
/**
* Set the pre-order position.
*/
-static
INLINE
void set_irn_critical_path_len(trace_env_t *env, ir_node *n, unsigned len) {
+static
inline
void set_irn_critical_path_len(trace_env_t *env, ir_node *n, unsigned len) {
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
int idx = get_irn_idx(n);
assert(idx < ARR_LEN(env->sched_info));
@@
-285,7
+283,7
@@
static int get_reg_difference(trace_env_t *env, ir_node *irn) {
ir_node *block = get_nodes_block(irn);
if (be_is_Call(irn)) {
ir_node *block = get_nodes_block(irn);
if (be_is_Call(irn)) {
- /* we want calls prefered */
+ /* we want calls prefer
r
ed */
return -5;
}
return -5;
}
@@
-305,13
+303,16
@@
static int get_reg_difference(trace_env_t *env, ir_node *irn) {
for (i = get_irn_arity(irn) - 1; i >= 0; i--) {
ir_node *in = get_irn_n(irn, i);
for (i = get_irn_arity(irn) - 1; i >= 0; i--) {
ir_node *in = get_irn_n(irn, i);
- if (mode_is_datab(get_irn_mode(in)) && /* must be data node */
- ! arch_irn_is(env->arch_env, in, ignore) && /* ignore "ignore" nodes :) */
- ! be_is_live_end(env->liveness, block, in) /* if the value lives outside of block: do not count */
+ if (!mode_is_datab(get_irn_mode(in)))
+ continue;
- ) {
- num_in++;
- }
+ if (arch_irn_is_ignore(in))
+ continue;
+
+ if (be_is_live_end(env->liveness, block, in))
+ continue;
+
+ num_in++;
}
return num_out - num_in;
}
return num_out - num_in;
@@
-428,7
+429,7
@@
static void trace_preprocess_block(trace_env_t *env, ir_node *block) {
for (cur_pos = 0, curr = root; curr; curr = get_irn_link(curr), cur_pos++) {
sched_timestep_t d;
for (cur_pos = 0, curr = root; curr; curr = get_irn_link(curr), cur_pos++) {
sched_timestep_t d;
- if (
arch_irn_class_is(env->arch_env, curr, branch
)) {
+ if (
is_cfop(curr
)) {
/* assure, that branches can be executed last */
d = 0;
}
/* assure, that branches can be executed last */
d = 0;
}
@@
-482,7
+483,7
@@
static void trace_node_ready(void *data, ir_node *irn, ir_node *pred) {
*/
static void trace_update_time(void *data, ir_node *irn) {
trace_env_t *env = data;
*/
static void trace_update_time(void *data, ir_node *irn) {
trace_env_t *env = data;
- if (is_Phi(irn) || get_irn_opcode(irn) ==
ir
o_Start) {
+ if (is_Phi(irn) || get_irn_opcode(irn) ==
be
o_Start) {
env->curr_time += get_irn_etime(env, irn);
}
else {
env->curr_time += get_irn_etime(env, irn);
}
else {
@@
-496,14
+497,13
@@
static void trace_update_time(void *data, ir_node *irn) {
* @return The environment
*/
static trace_env_t *trace_init(const be_irg_t *birg) {
* @return The environment
*/
static trace_env_t *trace_init(const be_irg_t *birg) {
- trace_env_t *env =
xcalloc(1, sizeof(*env)
);
+ trace_env_t *env =
XMALLOCZ(trace_env_t
);
ir_graph *irg = be_get_birg_irg(birg);
int nn = get_irg_last_idx(irg);
ir_graph *irg = be_get_birg_irg(birg);
int nn = get_irg_last_idx(irg);
- env->arch_env = be_get_birg_arch_env(birg);
env->curr_time = 0;
env->sched_info = NEW_ARR_F(trace_irn_t, nn);
env->curr_time = 0;
env->sched_info = NEW_ARR_F(trace_irn_t, nn);
- env->liveness = be_liveness(
b
irg);
+ env->liveness = be_liveness(irg);
FIRM_DBG_REGISTER(env->dbg, "firm.be.sched.trace");
be_liveness_assure_chk(env->liveness);
FIRM_DBG_REGISTER(env->dbg, "firm.be.sched.trace");
be_liveness_assure_chk(env->liveness);
@@
-526,13
+526,14
@@
static void trace_free(void *data) {
/**
* Simple selector. Just assure that jumps are scheduled last.
*/
/**
* Simple selector. Just assure that jumps are scheduled last.
*/
-static ir_node *basic_selection(const arch_env_t *arch_env, ir_nodeset_t *ready_set) {
+static ir_node *basic_selection(ir_nodeset_t *ready_set)
+{
ir_node *irn = NULL;
ir_nodeset_iterator_t iter;
/* assure that branches and constants are executed last */
foreach_ir_nodeset(ready_set, irn, iter) {
ir_node *irn = NULL;
ir_nodeset_iterator_t iter;
/* assure that branches and constants are executed last */
foreach_ir_nodeset(ready_set, irn, iter) {
- if (!
arch_irn_class_is(arch_env, irn, branch
)) {
+ if (!
is_cfop(irn
)) {
return irn;
}
}
return irn;
}
}
@@
-584,7
+585,7
@@
static ir_node *muchnik_select(void *block_env, ir_nodeset_t *ready_set, ir_node
if (cnt == 1) {
irn = get_nodeset_node(&ecands);
if (cnt == 1) {
irn = get_nodeset_node(&ecands);
- if (
arch_irn_class_is(env->arch_env, irn, branch
)) {
+ if (
is_cfop(irn
)) {
/* BEWARE: don't select a JUMP if others are still possible */
goto force_mcands;
}
/* BEWARE: don't select a JUMP if others are still possible */
goto force_mcands;
}
@@
-592,12
+593,12
@@
static ir_node *muchnik_select(void *block_env, ir_nodeset_t *ready_set, ir_node
}
else if (cnt > 1) {
DB((env->dbg, LEVEL_3, "\tecand = %d, max_delay = %u\n", cnt, max_delay));
}
else if (cnt > 1) {
DB((env->dbg, LEVEL_3, "\tecand = %d, max_delay = %u\n", cnt, max_delay));
- irn = basic_selection(
env->arch_env,
&ecands);
+ irn = basic_selection(&ecands);
}
else {
force_mcands:
DB((env->dbg, LEVEL_3, "\tmcand = %d\n", ir_nodeset_size(&mcands)));
}
else {
force_mcands:
DB((env->dbg, LEVEL_3, "\tmcand = %d\n", ir_nodeset_size(&mcands)));
- irn = basic_selection(
env->arch_env,
&mcands);
+ irn = basic_selection(&mcands);
}
}
}
}
@@
-660,7
+661,7
@@
static ir_node *heuristic_select(void *block_env, ir_nodeset_t *ns, ir_nodeset_t
/* priority based selection, heuristic inspired by mueller diss */
foreach_ir_nodeset(ns, irn, iter) {
/* make sure that branches are scheduled last */
/* priority based selection, heuristic inspired by mueller diss */
foreach_ir_nodeset(ns, irn, iter) {
/* make sure that branches are scheduled last */
- if (!
arch_irn_class_is(trace_env->arch_env, irn, branch
)) {
+ if (!
is_cfop(irn
)) {
int rdiff = get_irn_reg_diff(trace_env, irn);
int sign = rdiff < 0;
int chg = (rdiff < 0 ? -rdiff : rdiff) << PRIO_CHG_PRESS;
int rdiff = get_irn_reg_diff(trace_env, irn);
int sign = rdiff < 0;
int chg = (rdiff < 0 ? -rdiff : rdiff) << PRIO_CHG_PRESS;
@@
-700,7
+701,7
@@
static ir_node *heuristic_select(void *block_env, ir_nodeset_t *ns, ir_nodeset_t
DBG((trace_env->dbg, LEVEL_4, "heuristic selected %+F:\n", cand));
}
else {
DBG((trace_env->dbg, LEVEL_4, "heuristic selected %+F:\n", cand));
}
else {
- cand = basic_selection(
trace_env->arch_env,
ns);
+ cand = basic_selection(ns);
}
return cand;
}
return cand;