Commit ea64ddab authored by Christian Würdig's avatar Christian Würdig
Browse files

wrapped debugging modules with DEBUG_ONLY

parent 0ed1fdbf
......@@ -22,11 +22,7 @@ typedef struct _spill_env_t spill_env_t;
typedef int(*decide_irn_t)(const ir_node*, void*);
spill_env_t *be_new_spill_env(
firm_dbg_module_t *dbg,
const be_chordal_env_t *chordal,
decide_irn_t is_mem_phi,
void *data);
spill_env_t *be_new_spill_env(const be_chordal_env_t *chordal, decide_irn_t is_mem_phi, void *data);
void be_delete_spill_env(spill_env_t *senv);
......
......@@ -47,7 +47,7 @@
#define DBG_SLOTS 32
#define DBG_TRACE 64
#define DEBUG_LVL 0 //(DBG_START | DBG_DECIDE | DBG_WSETS | DBG_FIX | DBG_SPILL)
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#define MIN(a,b) (((a)<(b))?(a):(b))
......@@ -639,14 +639,15 @@ void be_spill_belady(const be_chordal_env_t *chordal_env) {
/* init belady env */
obstack_init(&bel.ob);
bel.arch = chordal_env->birg->main_env->arch_env;
bel.cls = chordal_env->cls;
bel.n_regs = arch_register_class_n_regs(bel.cls);
bel.ws = new_workset(&bel.ob, &bel);
bel.uses = be_begin_uses(chordal_env->irg, chordal_env->birg->main_env->arch_env, bel.cls);
bel.senv = be_new_spill_env(dbg, chordal_env, is_mem_phi, NULL);
bel.reloads = pset_new_ptr_default();
bel.copies = pset_new_ptr_default();
bel.arch = chordal_env->birg->main_env->arch_env;
bel.cls = chordal_env->cls;
bel.n_regs = arch_register_class_n_regs(bel.cls);
bel.ws = new_workset(&bel.ob, &bel);
bel.uses = be_begin_uses(chordal_env->irg, chordal_env->birg->main_env->arch_env, bel.cls);
bel.senv = be_new_spill_env(chordal_env, is_mem_phi, NULL);
DEBUG_ONLY(bel.senv->dbg = dbg;)
bel.reloads = pset_new_ptr_default();
bel.copies = pset_new_ptr_default();
DBG((dbg, LEVEL_1, "running on register class: %s\n", bel.cls->name));
......
......@@ -86,7 +86,6 @@ typedef struct _spill_ilp_t {
spill_stat_t stats;
const arch_register_class_t *cls;
const be_chordal_env_t *chordal_env;
firm_dbg_module_t *dbg;
lpp_t *lpp;
set *irn_use_heads;
set *live_ranges;
......@@ -96,6 +95,7 @@ typedef struct _spill_ilp_t {
struct obstack *obst;
int enable_store : 1;
int enable_remat : 1;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} spill_ilp_t;
typedef struct _live_range_t live_range_t;
......@@ -635,7 +635,8 @@ void be_spill_ilp(const be_chordal_env_t *chordal_env)
memset(&si.stats, 0, sizeof(si.stats));
si.chordal_env = chordal_env;
si.obst = &obst;
si.senv = be_new_spill_env(si.dbg, chordal_env, is_mem_phi, &si);
si.senv = be_new_spill_env(chordal_env, is_mem_phi, &si);
DEBUG_ONLY(si.senv->dbg = si.dbg;)
si.cls = chordal_env->cls;
si.lpp = new_lpp(problem_name, lpp_minimize);
si.irn_use_heads = new_set(cmp_irn_use_head, 4096);
......@@ -646,7 +647,6 @@ void be_spill_ilp(const be_chordal_env_t *chordal_env)
si.enable_store = 1;
FIRM_DBG_REGISTER(si.dbg, "firm.be.ra.spillilp");
firm_dbg_set_mask(si.dbg, DBG_LEVEL);
irg_block_walk_graph(chordal_env->irg, process_block, NULL, &si);
if(si.enable_store)
add_store_costs(&si);
......
......@@ -29,7 +29,7 @@
#include "benode_t.h"
#include "besched_t.h"
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#define DUMP_GRAPHS
#define get_chordal_arch(ce) ((ce)->birg->main_env->arch_env)
......
......@@ -45,8 +45,8 @@ typedef struct _be_use_t {
struct _be_uses_t {
set *uses;
ir_graph *irg;
firm_dbg_module_t *dbg;
const arch_env_t *arch_env;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
};
......
......@@ -419,13 +419,13 @@ ia32_irn_ops_t ia32_irn_ops = {
*/
static void ia32_prepare_graph(void *self) {
ia32_code_gen_t *cg = self;
firm_dbg_module_t *old_mod = cg->mod;
DEBUG_ONLY(firm_dbg_module_t *old_mod = cg->mod;)
FIRM_DBG_REGISTER(cg->mod, "firm.be.ia32.transform");
irg_walk_blkwise_graph(cg->irg, ia32_place_consts_set_modes, ia32_transform_node, cg);
be_dump(cg->irg, "-transformed", dump_ir_block_graph_sched);
cg->mod = old_mod;
DEBUG_ONLY(cg->mod = old_mod;)
if (cg->opt.doam) {
edges_deactivate(cg->irg);
......@@ -663,7 +663,7 @@ static void ia32_after_ra_walker(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cg->mod;
DEBUG_ONLY(tenv.mod = cg->mod;)
tenv.mode = get_irn_mode(node);
tenv.cg = cg;
......
......@@ -43,7 +43,6 @@ typedef struct _ia32_code_gen_t {
FILE *out; /**< output file */
const arch_env_t *arch_env; /**< the arch env */
set *reg_set; /**< set to memorize registers for non-ia32 nodes (e.g. phi nodes) */
firm_dbg_module_t *mod; /**< debugging module */
int emit_decls; /**< flag indicating if decls were already emitted */
pmap *types; /**< A map of modes to primitive types */
pmap *tv_ent; /**< A map of entities that store tarvals */
......@@ -52,6 +51,7 @@ typedef struct _ia32_code_gen_t {
ia32_optimize_t opt; /**< contains optimization information */
char fp_kind; /**< floating point kind */
char used_x87; /**< x87 floating point unit used in this graph */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< debugging module */
} ia32_code_gen_t;
typedef struct _ia32_isa_t {
......@@ -77,13 +77,13 @@ typedef struct _ia32_irn_ops_t {
/* this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _ia32_transform_env_t {
firm_dbg_module_t *mod; /**< The firm debugger */
dbg_info *dbg; /**< The node debug info */
ir_graph *irg; /**< The irg, the node should be created in */
ir_node *block; /**< The block, the node should belong to */
ir_node *irn; /**< The irn, to be transformed */
ir_mode *mode; /**< The mode of the irn */
ia32_code_gen_t *cg; /**< The code generator */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< The firm debugger */
} ia32_transform_env_t;
/**
......
......@@ -1426,10 +1426,10 @@ static void ia32_register_emitters(void) {
* Emits code for a node.
*/
static void ia32_emit_node(const ir_node *irn, void *env) {
ia32_emit_env_t *emit_env = env;
firm_dbg_module_t *mod = emit_env->mod;
ia32_emit_env_t *emit_env = env;
FILE *F = emit_env->out;
ir_op *op = get_irn_op(irn);
DEBUG_ONLY(firm_dbg_module_t *mod = emit_env->mod;)
DBG((mod, LEVEL_1, "emitting code for %+F\n", irn));
......
......@@ -10,11 +10,11 @@
#include "bearch_ia32_t.h"
typedef struct _ia32_emit_env_t {
firm_dbg_module_t *mod;
FILE *out;
const arch_env_t *arch_env;
const ia32_code_gen_t *cg;
ia32_isa_t *isa;
DEBUG_ONLY(firm_dbg_module_t *mod;)
} ia32_emit_env_t;
const lc_arg_env_t *ia32_get_arg_env(void);
......
......@@ -217,7 +217,7 @@ void ia32_place_consts_set_modes(ir_node *irn, void *env) {
tenv.block = get_nodes_block(irn);
tenv.cg = cg;
tenv.irg = cg->irg;
tenv.mod = cg->mod;
DEBUG_ONLY(tenv.mod = cg->mod;)
/* Loop over all predecessors and check for Sym/Const nodes */
for (i = get_irn_arity(irn) - 1; i >= 0; --i) {
......@@ -596,7 +596,7 @@ static int load_store_addr_is_equal(const ir_node *load, const ir_node *store,
/**
* Folds Add or Sub to LEA if possible
*/
static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, firm_dbg_module_t *mod, ir_node *noreg) {
static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
ir_graph *irg = get_irn_irg(irn);
dbg_info *dbg = get_irn_dbg_info(irn);
ir_node *block = get_nodes_block(irn);
......@@ -613,6 +613,7 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, firm_dbg_module_t *
ir_node *left, *right, *temp;
ir_node *base, *index;
ia32_am_flavour_t am_flav;
DEBUG_ONLY(firm_dbg_module_t *mod = cg->mod;)
if (is_ia32_Add(irn))
isadd = 1;
......@@ -849,7 +850,6 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, firm_dbg_module_t *
*/
void ia32_optimize_am(ir_node *irn, void *env) {
ia32_code_gen_t *cg = env;
firm_dbg_module_t *mod = cg->mod;
ir_node *res = irn;
dbg_info *dbg;
ir_mode *mode;
......@@ -858,6 +858,7 @@ void ia32_optimize_am(ir_node *irn, void *env) {
ir_node *store, *load, *mem_proj;
ir_node *succ, *addr_b, *addr_i;
int check_am_src = 0;
DEBUG_ONLY(firm_dbg_module_t *mod = cg->mod;)
if (! is_ia32_irn(irn))
return;
......@@ -889,7 +890,7 @@ void ia32_optimize_am(ir_node *irn, void *env) {
/* check is irn is a candidate for address calculation */
if (is_candidate(block, irn, 1)) {
DBG((mod, LEVEL_1, "\tfound address calculation candidate %+F ... ", irn));
res = fold_addr(cg, irn, mod, noreg_gp);
res = fold_addr(cg, irn, noreg_gp);
if (res == irn)
DB((mod, LEVEL_1, "transformed into %+F\n", res));
......
......@@ -184,11 +184,11 @@ static ir_node *gen_binop(ia32_transform_env_t *env, ir_node *op1, ir_node *op2,
dbg_info *dbg = env->dbg;
ir_graph *irg = env->irg;
ir_node *block = env->block;
firm_dbg_module_t *mod = env->mod;
ir_node *noreg_gp = ia32_new_NoReg_gp(env->cg);
ir_node *noreg_fp = ia32_new_NoReg_fp(env->cg);
ir_node *nomem = new_NoMem();
ir_node *expr_op, *imm_op;
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
/* Check if immediate optimization is on and */
/* if it's an operation with immediate. */
......@@ -275,11 +275,11 @@ static ir_node *gen_shift_binop(ia32_transform_env_t *env, ir_node *op1, ir_node
dbg_info *dbg = env->dbg;
ir_graph *irg = env->irg;
ir_node *block = env->block;
firm_dbg_module_t *mod = env->mod;
ir_node *noreg = ia32_new_NoReg_gp(env->cg);
ir_node *nomem = new_NoMem();
ir_node *expr_op, *imm_op;
tarval *tv;
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
assert(! mode_is_float(mode) && "Shift/Rotate with float not supported");
......@@ -345,11 +345,11 @@ static ir_node *gen_unop(ia32_transform_env_t *env, ir_node *op, construct_unop_
ir_node *new_op = NULL;
ir_mode *mode = env->mode;
dbg_info *dbg = env->dbg;
firm_dbg_module_t *mod = env->mod;
ir_graph *irg = env->irg;
ir_node *block = env->block;
ir_node *noreg = ia32_new_NoReg_gp(env->cg);
ir_node *nomem = new_NoMem();
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
new_op = func(dbg, irg, block, noreg, noreg, op, nomem, mode_T);
......@@ -383,7 +383,6 @@ static ir_node *gen_unop(ia32_transform_env_t *env, ir_node *op, construct_unop_
static ir_node *gen_imm_Add(ia32_transform_env_t *env, ir_node *expr_op, ir_node *const_op) {
ir_node *new_op = NULL;
tarval *tv = get_ia32_Immop_tarval(const_op);
firm_dbg_module_t *mod = env->mod;
dbg_info *dbg = env->dbg;
ir_graph *irg = env->irg;
ir_node *block = env->block;
......@@ -391,6 +390,7 @@ static ir_node *gen_imm_Add(ia32_transform_env_t *env, ir_node *expr_op, ir_node
ir_node *nomem = new_NoMem();
int normal_add = 1;
tarval_classification_t class_tv, class_negtv;
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
/* try to optimize to inc/dec */
if (env->cg->opt.incdec && tv) {
......@@ -704,7 +704,6 @@ static ir_node *gen_Min(ia32_transform_env_t *env, ir_node *op1, ir_node *op2) {
static ir_node *gen_imm_Sub(ia32_transform_env_t *env, ir_node *expr_op, ir_node *const_op) {
ir_node *new_op = NULL;
tarval *tv = get_ia32_Immop_tarval(const_op);
firm_dbg_module_t *mod = env->mod;
dbg_info *dbg = env->dbg;
ir_graph *irg = env->irg;
ir_node *block = env->block;
......@@ -712,6 +711,7 @@ static ir_node *gen_imm_Sub(ia32_transform_env_t *env, ir_node *expr_op, ir_node
ir_node *nomem = new_NoMem();
int normal_sub = 1;
tarval_classification_t class_tv, class_negtv;
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
/* try to optimize to inc/dec */
if (env->cg->opt.incdec && tv) {
......@@ -1626,8 +1626,8 @@ static ir_node *gen_Conv(ia32_transform_env_t *env, ir_node *op) {
ir_node *new_op = NULL;
ir_node *noreg = ia32_new_NoReg_gp(env->cg);
ir_node *nomem = new_rd_NoMem(irg);
firm_dbg_module_t *mod = env->mod;
ir_node *proj;
DEBUG_ONLY(firm_dbg_module_t *mod = env->mod;)
if (src_mode == tgt_mode) {
/* this can happen when changing mode_P to mode_Is */
......@@ -1894,7 +1894,7 @@ void ia32_transform_sub_to_neg_add(ir_node *irn, ia32_code_gen_t *cg) {
tenv.dbg = get_irn_dbg_info(irn);
tenv.irg = cg->irg;
tenv.irn = irn;
tenv.mod = cg->mod;
DEBUG_ONLY(tenv.mod = cg->mod;)
tenv.mode = get_ia32_res_mode(irn);
tenv.cg = cg;
......@@ -1977,7 +1977,7 @@ void ia32_transform_lea_to_add(ir_node *irn, ia32_code_gen_t *cg) {
tenv.dbg = get_irn_dbg_info(irn);
tenv.irg = cg->irg;
tenv.irn = irn;
tenv.mod = cg->mod;
DEBUG_ONLY(tenv.mod = cg->mod;)
tenv.mode = get_irn_mode(irn);
tenv.cg = cg;
......@@ -2069,7 +2069,7 @@ void ia32_transform_node(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(node);
tenv.cg = cgenv;
......
......@@ -48,7 +48,7 @@
#define MASK_TOS(x) ((x) & (N_x87_REGS - 1))
/** the debug handle */
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
/**
* An exchange template.
......
......@@ -14,11 +14,11 @@ struct _mips_code_gen_t {
FILE *out; /**< output file */
const arch_env_t *arch_env; /**< the arch env */
set *reg_set; /**< set to memorize registers for FIRM nodes (e.g. phi) */
firm_dbg_module_t *mod; /**< debugging module */
int emit_decls; /**< flag indicating if decls were already emitted */
const be_irg_t *birg; /**< The be-irg (contains additional information about the irg) */
ir_node **bl_list; /**< The block schedule list. */
survive_dce_t *bl_list_sdce; /**< survive dce environment for the block schedule list */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< debugging module */
};
......@@ -40,13 +40,13 @@ typedef struct _mips_irn_ops_t {
/* this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _mips_transform_env_t {
firm_dbg_module_t *mod; /**< The firm debugger */
dbg_info *dbg; /**< The node debug info */
ir_graph *irg; /**< The irg, the node should be created in */
ir_node *block; /**< The block, the node should belong to */
ir_node *irn; /**< The irn, to be transformed */
ir_mode *mode; /**< The mode of the irn */
mips_code_gen_t *cg; /**< The code generator */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< The firm debugger */
} mips_transform_env_t;
ir_node *mips_new_NoReg(mips_code_gen_t *cg);
......
......@@ -658,10 +658,10 @@ typedef void (*emit_func) (const ir_node *, mips_emit_env_t *);
*/
static void mips_emit_node(ir_node *irn, mips_emit_env_t* env)
{
mips_emit_env_t *emit_env = env;
firm_dbg_module_t *mod = emit_env->mod;
mips_emit_env_t *emit_env = env;
FILE *F = emit_env->out;
ir_op *op = get_irn_op(irn);
DEBUG_ONLY(firm_dbg_module_t *mod = emit_env->mod;)
DBG((mod, LEVEL_1, "emitting code for %+F\n", irn));
......
......@@ -10,10 +10,10 @@
#include "bearch_mips_t.h"
typedef struct _mips_emit_env_t {
firm_dbg_module_t *mod;
FILE *out;
const arch_env_t *arch_env;
const mips_code_gen_t *cg;
DEBUG_ONLY(firm_dbg_module_t *mod;)
} mips_emit_env_t;
const lc_arg_env_t *mips_get_arg_env(void);
......
......@@ -986,7 +986,7 @@ void mips_transform_node(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(node);
tenv.cg = cgenv;
......@@ -1134,7 +1134,7 @@ void mips_pre_transform_node(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(node);
tenv.cg = cgenv;
......@@ -1173,7 +1173,7 @@ void mips_after_ra_walker(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cg->mod;
DEBUG_ONLY(tenv.mod = cg->mod;)
tenv.mode = get_irn_mode(node);
tenv.cg = cg;
......
......@@ -13,13 +13,13 @@ typedef struct _ppc32_code_gen_t {
FILE *out; /**< output file */
const arch_env_t *arch_env; /**< the arch env */
set *reg_set; /**< set to memorize registers for FIRM nodes (e.g. phi) */
firm_dbg_module_t *mod; /**< debugging module */
int emit_decls; /**< flag indicating if decls were already emitted */
const be_irg_t *birg; /**< The be-irg (contains additional information about the irg) */
unsigned area_size; /**< size of call area for the current irg */
entity *area; /**< the entity representing the call area or NULL for leaf functions */
ir_node *start_succ_block; /**< the block succeeding the start block in the cfg */
ir_node **blk_sched; /**< an array containing the scheduled blocks */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< debugging module */
} ppc32_code_gen_t;
......@@ -41,12 +41,12 @@ typedef struct _ppc32_irn_ops_t {
/** this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _ppc32_transform_env_t {
firm_dbg_module_t *mod; /**< The firm debugger */
dbg_info *dbg; /**< The node debug info */
ir_graph *irg; /**< The irg, the node should be created in */
ir_node *block; /**< The block, the node should belong to */
ir_node *irn; /**< The irn, to be transformed */
ir_mode *mode; /**< The mode of the irn */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< The firm debugger */
} ppc32_transform_env_t;
......
......@@ -574,10 +574,10 @@ static void ppc32_register_emitters(void) {
* Emits code for a node.
*/
static void ppc32_emit_node(ir_node *irn, void *env) {
ppc32_emit_env_t *emit_env = env;
firm_dbg_module_t *mod = emit_env->mod;
FILE *F = emit_env->out;
ir_op *op = get_irn_op(irn);
ppc32_emit_env_t *emit_env = env;
FILE *F = emit_env->out;
ir_op *op = get_irn_op(irn);
DEBUG_ONLY(firm_dbg_module_t *mod = emit_env->mod;)
DBG((mod, LEVEL_1, "emitting code for %+F\n", irn));
......
......@@ -10,10 +10,10 @@
#include "bearch_ppc32_t.h"
typedef struct _emit_env_t {
firm_dbg_module_t *mod;
FILE *out;
const arch_env_t *arch_env;
const ppc32_code_gen_t *cg;
DEBUG_ONLY(firm_dbg_module_t *mod;)
} ppc32_emit_env_t;
const lc_arg_env_t *ppc32_get_arg_env(void);
......
......@@ -1357,7 +1357,7 @@ void ppc32_transform_node(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(node);
#define UNOP(a) case iro_##a: asm_node = gen_##a(&tenv, get_##a##_op(node)); break
......@@ -1746,7 +1746,7 @@ void ppc32_transform_const(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(node);
tenv.irg = current_ir_graph;
tenv.irn = node;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(node);
#define OTHER_GEN(a) \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment