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

wrapped debugging modules with DEBUG_ONLY

parent 0ed1fdbf
......@@ -297,9 +297,9 @@ static void TEMPLATE_register_emitters(void) {
*/
void TEMPLATE_emit_node(ir_node *irn, void *env) {
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);
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_TEMPLATE_t.h"
typedef struct _emit_env_t {
firm_dbg_module_t *mod;
FILE *out;
const arch_env_t *arch_env;
const TEMPLATE_code_gen_t *cg;
DEBUG_ONLY(firm_dbg_module_t *mod;)
} emit_env_t;
const lc_arg_env_t *TEMPLATE_get_arg_env(void);
......
......@@ -12,9 +12,9 @@ typedef struct _TEMPLATE_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) */
DEBUG_ONLY(firm_dbg_module_t *mod;) /* debugging module */
} TEMPLATE_code_gen_t;
......@@ -36,12 +36,12 @@ typedef struct _TEMPLATE_irn_ops_t {
/* this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _TEMPLATE_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 */
} TEMPLATE_transform_env_t;
......
......@@ -754,9 +754,9 @@ static void arm_register_emitters(void) {
*/
static void arm_emit_node(const ir_node *irn, void *env) {
arm_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);
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_arm_t.h"
typedef struct _arm_emit_env_t {
firm_dbg_module_t *mod;
FILE *out;
const arch_env_t *arch_env;
const arm_code_gen_t *cg;
DEBUG_ONLY(firm_dbg_module_t *mod;)
} arm_emit_env_t;
const lc_arg_env_t *arm_get_arg_env(void);
......
......@@ -821,7 +821,7 @@ static ir_node *gen_CopyB(arm_transform_env_t *env) {
const_env.dbg = dbg;
const_env.irg = irg;
const_env.irn = node;
const_env.mod = env->mod;
DEBUG_ONLY(const_env.mod = env->mod;)
const_env.mode = mode_Iu;
src_copy = be_new_Copy(&arm_reg_classes[CLASS_arm_general_purpose], irg, block, src);
......@@ -874,7 +874,7 @@ void arm_move_consts(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(pred);
tenv.irg = current_ir_graph;
tenv.irn = pred;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(pred);
const_graph = create_const_graph(&tenv);
set_irn_n(node, i, const_graph);
......@@ -899,7 +899,7 @@ void arm_move_consts(ir_node *node, void *env) {
tenv.dbg = get_irn_dbg_info(pred);
tenv.irg = current_ir_graph;
tenv.irn = pred;
tenv.mod = cgenv->mod;
DEBUG_ONLY(tenv.mod = cgenv->mod;)
tenv.mode = get_irn_mode(pred);
const_graph = create_const_graph(&tenv);
set_irn_n(node, i, const_graph);
......@@ -962,7 +962,7 @@ void arm_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
......
......@@ -14,10 +14,10 @@ typedef struct _arm_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_type *int_tp; /**< the int type, needed for Call conversion */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< debugging module */
} arm_code_gen_t;
......@@ -39,13 +39,12 @@ typedef struct _arm_irn_ops_t {
/* this is a struct to minimize the number of parameters
for transformation walker */
typedef struct _arm_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 */
// arm_code_gen_t *cg; /**< The code generator */
DEBUG_ONLY(firm_dbg_module_t *mod;) /**< The firm debugger */
} arm_transform_env_t;
......
......@@ -28,7 +28,7 @@ struct _be_main_env_t {
struct _be_options_t *options;
struct _arch_code_generator_t *cg;
struct _arch_irn_handler_t *phi_handler;
firm_dbg_module_t *dbg;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
};
struct _be_irg_t {
......
......@@ -74,7 +74,6 @@ struct _be_stack_slot_t {
struct _be_abi_irg_t {
struct obstack obst;
firm_dbg_module_t *dbg; /**< The debugging module. */
be_stack_frame_t *frame; /**< The stack frame model. */
const be_irg_t *birg; /**< The back end IRG. */
const arch_isa_t *isa; /**< The isa. */
......@@ -99,6 +98,7 @@ struct _be_abi_irg_t {
arch_irn_handler_t irn_handler;
arch_irn_ops_t irn_ops;
DEBUG_ONLY(firm_dbg_module_t *dbg;) /**< The debugging module. */
};
#define get_abi_from_handler(ptr) firm_container_of(ptr, be_abi_irg_t, irn_handler)
......@@ -1134,7 +1134,6 @@ static void create_barrier(be_abi_irg_t *env, ir_node *bl, ir_node **mem, pmap *
*/
static void modify_irg(be_abi_irg_t *env)
{
firm_dbg_module_t *dbg = env->dbg;
be_abi_call_t *call = env->call;
const arch_isa_t *isa = env->birg->main_env->arch_env->isa;
const arch_register_t *sp = arch_isa_sp(isa);
......@@ -1148,6 +1147,7 @@ static void modify_irg(be_abi_irg_t *env)
pset *dont_save = pset_new_ptr(8);
int n_params = get_method_n_params(method_type);
int max_arg = 0;
DEBUG_ONLY(firm_dbg_module_t *dbg = env->dbg;)
int i, j, n;
......
......@@ -63,7 +63,6 @@
typedef struct _be_chordal_alloc_env_t {
be_chordal_env_t *chordal_env;
firm_dbg_module_t *constr_dbg; /**< Debug output for the constraint handler. */
pset *pre_colored; /**< Set of precolored nodes. */
bitset_t *live; /**< A liveness bitset. */
bitset_t *tmp_colors; /**< An auxiliary bitset which is as long as the number of colors in the class. */
......@@ -71,6 +70,7 @@ typedef struct _be_chordal_alloc_env_t {
bitset_t *in_colors; /**< Colors used by live in values. */
bitset_t *ignore_regs; /**< A bitset of all ignore registers in the current class. */
int colors_n; /**< The number of colors. */
DEBUG_ONLY(firm_dbg_module_t *constr_dbg;) /**< Debug output for the constraint handler. */
} be_chordal_alloc_env_t;
#include "fourcc.h"
......@@ -380,13 +380,13 @@ static ir_node *pre_process_constraints(be_chordal_alloc_env_t *alloc_env, insn_
{
be_chordal_env_t *env = alloc_env->chordal_env;
const arch_env_t *aenv = env->birg->main_env->arch_env;
firm_dbg_module_t *dbg = alloc_env->constr_dbg;
insn_t *insn = *the_insn;
ir_node *bl = get_nodes_block(insn->irn);
ir_node *copy = NULL;
ir_node *perm = NULL;
bitset_t *out_constr = bitset_alloca(env->cls->n_regs);
bitset_t *bs = bitset_alloca(env->cls->n_regs);
DEBUG_ONLY(firm_dbg_module_t *dbg = alloc_env->constr_dbg;)
int i;
......@@ -504,7 +504,6 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env, ir_node *i
correctly precolored. These Perms arise during the ABI handling phase.
*/
if(insn->has_constraints) {
firm_dbg_module_t *dbg = alloc_env->constr_dbg;
const arch_env_t *aenv = env->birg->main_env->arch_env;
int n_regs = env->cls->n_regs;
bitset_t *bs = bitset_alloca(n_regs);
......@@ -512,6 +511,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env, ir_node *i
bipartite_t *bp = bipartite_new(n_regs, n_regs);
int *assignment = alloca(n_regs * sizeof(assignment[0]));
pmap *partners = pmap_create();
DEBUG_ONLY(firm_dbg_module_t *dbg = alloc_env->constr_dbg;)
int i, n_alloc;
long col;
......@@ -699,8 +699,8 @@ static void pressure(ir_node *block, void *env_ptr)
be_chordal_alloc_env_t *alloc_env = env_ptr;
be_chordal_env_t *env = alloc_env->chordal_env;
bitset_t *live = alloc_env->live;
firm_dbg_module_t *dbg = env->dbg;
ir_node *irn;
DEBUG_ONLY(firm_dbg_module_t *dbg = env->dbg;)
int i, n;
unsigned step = 0;
......@@ -795,11 +795,11 @@ static void assign(ir_node *block, void *env_ptr)
{
be_chordal_alloc_env_t *alloc_env = env_ptr;
be_chordal_env_t *env = alloc_env->chordal_env;
firm_dbg_module_t *dbg = env->dbg;
bitset_t *live = alloc_env->live;
bitset_t *colors = alloc_env->colors;
bitset_t *in_colors = alloc_env->in_colors;
const arch_env_t *arch_env = env->birg->main_env->arch_env;
DEBUG_ONLY(firm_dbg_module_t *dbg = env->dbg;)
const ir_node *irn;
border_t *b;
......
......@@ -55,12 +55,12 @@
void be_ra_chordal_check(be_chordal_env_t *chordal_env) {
firm_dbg_module_t *dbg = chordal_env->dbg;
const arch_env_t *arch_env = chordal_env->birg->main_env->arch_env;
struct obstack ob;
pmap_entry *pme;
ir_node **nodes, *n1, *n2;
int i, o;
DEBUG_ONLY(firm_dbg_module_t *dbg = chordal_env->dbg;)
/* Collect all irns */
obstack_init(&ob);
......@@ -98,13 +98,13 @@ void be_ra_chordal_check(be_chordal_env_t *chordal_env) {
static void check_pressure_walker(ir_node *bl, void *data)
{
be_chordal_env_t *env = data;
firm_dbg_module_t *dbg = env->dbg;
int n_regs = arch_register_class_n_regs(env->cls);
pset *live = pset_new_ptr_default();
int step = 0;
ir_node *irn;
irn_live_t *li;
DEBUG_ONLY(firm_dbg_module_t *dbg = env->dbg;)
live_foreach(bl, li) {
if(live_is_end(li) && chordal_has_class(env, li->irn)) {
......
......@@ -54,7 +54,6 @@ typedef struct _border_t {
struct _be_chordal_env_t {
struct obstack obst; /**< An obstack for temporary storage. */
be_ra_chordal_opts_t *opts; /**< A pointer to the chordal ra options. */
firm_dbg_module_t *dbg; /**< Debug module for the chordal register allocator. */
const be_irg_t *birg; /**< Back-end IRG session. */
dom_front_info_t *dom_front; /**< Dominance frontiers. */
ir_graph *irg; /**< The graph under examination. */
......@@ -62,6 +61,7 @@ struct _be_chordal_env_t {
pmap *border_heads; /**< Maps blocks to border heads. */
be_ifg_t *ifg; /**< The interference graph. */
void *data; /**< Some pointer, to which different phases can attach data to. */
DEBUG_ONLY(firm_dbg_module_t *dbg;) /**< Debug module for the chordal register allocator. */
};
static INLINE struct list_head *_get_block_border_head(const be_chordal_env_t *inf, ir_node *bl) {
......
......@@ -29,7 +29,7 @@
#include "becopystat.h"
#include "bitset.h"
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#define SEARCH_FREE_COLORS
......
......@@ -44,10 +44,10 @@
#define DEBUG_LVL 1
typedef struct _local_env_t {
firm_dbg_module_t *dbg;
double time_limit;
int first_x_var, last_x_var;
pmap *nr_2_irn;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} local_env_t;
static void build_coloring_cstr(ilp_env_t *ienv) {
......
......@@ -43,7 +43,7 @@
******************************************************************************/
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
void be_copy_opt_init(void) {
}
......
......@@ -29,7 +29,7 @@
#define DO_ILP2
#define DEBUG_LVL SET_LEVEL_1
static firm_dbg_module_t *dbg = NULL;
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#define MAX_ARITY 20
#define MAX_CLS_SIZE 20
......
......@@ -403,9 +403,9 @@ typedef struct _block_sched_env_t {
pset *ready_set;
pset *already_scheduled;
ir_node *block;
firm_dbg_module_t *dbg;
const list_sched_selector_t *selector;
void *selector_block_env;
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} block_sched_env_t;
/**
......
......@@ -43,7 +43,7 @@
typedef struct _lower_env_t {
be_chordal_env_t *chord_env;
int do_copy;
firm_dbg_module_t *dbg_module;
DEBUG_ONLY(firm_dbg_module_t *dbg_module;)
} lower_env_t;
/* holds a perm register pair */
......@@ -248,7 +248,6 @@ static perm_cycle_t *get_perm_cycle(perm_cycle_t *cycle, reg_pair_t *pairs, int
static void lower_perm_node(ir_node *irn, void *walk_env) {
const arch_register_class_t *reg_class;
const arch_env_t *arch_env;
firm_dbg_module_t *mod;
lower_env_t *env = walk_env;
reg_pair_t *pairs;
const ir_edge_t *edge;
......@@ -257,10 +256,11 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
ir_node *sched_point, *block, *in[2];
ir_node *arg1, *arg2, *res1, *res2;
ir_node *cpyxchg = NULL;
DEBUG_ONLY(firm_dbg_module_t *mod;)
arch_env = env->chord_env->birg->main_env->arch_env;
do_copy = env->do_copy;
mod = env->dbg_module;
DEBUG_ONLY(mod = env->dbg_module;)
block = get_nodes_block(irn);
/*
......
......@@ -103,7 +103,6 @@ typedef struct _var_info_t var_info_t;
* Environment with all the needed stuff
*/
typedef struct _be_raext_env_t {
firm_dbg_module_t *dbg;
arch_env_t *aenv;
const arch_register_class_t *cls;
ir_graph *irg;
......@@ -113,6 +112,7 @@ typedef struct _be_raext_env_t {
set *vars; /**< contains all var_info_t */
int n_cls_vars; /**< length of the array cls_vars */
var_info_t **cls_vars; /**< only the var_infos for current cls. needed for double iterating */
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} be_raext_env_t;
......
......@@ -51,7 +51,6 @@ typedef struct _spill_ctx_t {
} spill_ctx_t;
struct _spill_env_t {
firm_dbg_module_t *dbg;
const arch_register_class_t *cls;
const be_chordal_env_t *chordal_env;
struct obstack obst;
......@@ -60,6 +59,7 @@ struct _spill_env_t {
pset *mem_phis; /**< set of all special spilled phis. allocated and freed seperately */
decide_irn_t is_mem_phi; /**< callback func to decide if a phi needs special spilling */
void *data; /**< data passed to all callbacks */
DEBUG_ONLY(firm_dbg_module_t *dbg;)
};
static int cmp_spillctx(const void *a, const void *b, size_t n) {
......@@ -74,15 +74,11 @@ static int cmp_spillinfo(const void *x, const void *y, size_t size) {
return ! (xx->spilled_node == yy->spilled_node);
}
spill_env_t *be_new_spill_env(firm_dbg_module_t *dbg,
const be_chordal_env_t *chordal_env,
decide_irn_t is_mem_phi, void *data) {
spill_env_t *be_new_spill_env(const be_chordal_env_t *chordal_env, decide_irn_t is_mem_phi, void *data) {
spill_env_t *env = xmalloc(sizeof(env[0]));
env->spill_ctxs = new_set(cmp_spillctx, 1024);
env->spills = new_set(cmp_spillinfo, 1024);
env->cls = chordal_env->cls;
env->dbg = dbg;
env->is_mem_phi = is_mem_phi;
env->data = data;
env->chordal_env = chordal_env;
......@@ -386,11 +382,11 @@ typedef struct _spill_slot_t {
} spill_slot_t;
typedef struct _ss_env_t {
firm_dbg_module_t *dbg;
struct obstack ob;
be_chordal_env_t *cenv;
pmap *slots; /* maps spill_contexts to spill_slots */
pmap *types; /* maps modes to types */
pmap *types; /* maps modes to types */
DEBUG_ONLY(firm_dbg_module_t *dbg;)
} ss_env_t;
......
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