Commit 793165ad authored by Matthias Braun's avatar Matthias Braun
Browse files

remove commented out code

parent 60642ede
......@@ -234,23 +234,6 @@ static void analyze_ent_args(ir_entity *ent)
/* copy the temporary info */
memcpy(ent->attr.mtd_attr.param_access, rw_info,
nparams * sizeof(ent->attr.mtd_attr.param_access[0]));
#if 0
printf("\n%s:\n", get_entity_name(ent));
for (i = 0; i < nparams; ++i) {
if (is_Pointer_type(get_method_param_type(mtp, i)))
if (ent->attr.mtd_attr.param_access[i] != ptr_access_none) {
printf(" Pointer Arg %d access: ", i);
if (ent->attr.mtd_attr.param_access[i] & ptr_access_read)
printf("READ ");
if (ent->attr.mtd_attr.param_access[i] & ptr_access_write)
printf("WRITE ");
if (ent->attr.mtd_attr.param_access[i] & ptr_access_store)
printf("STORE ");
printf("\n");
}
}
#endif
}
void analyze_irg_args(ir_graph *irg)
......
......@@ -173,13 +173,7 @@ void compute_cdep(ir_graph *irg)
irg_block_walk_graph(irg, cdep_pre, NULL, &env);
#if 0
set_dump_block_edge_hook(cdep_edge_hook);
dump_ir_block_graph(irg, "_cdep");
set_dump_block_edge_hook(NULL);
#else
(void) cdep_edge_hook;
#endif
/* restore the post dominator relation */
set_Block_ipostdom(env.start_block, rem);
......
......@@ -184,22 +184,6 @@ static void sel_methods_walker(ir_node *node, void *env)
*/
assert(get_entity_irg(ent) == NULL);
}
#if 0
else if (get_opt_closed_world() && get_opt_dyn_meth_dispatch() &&
(ARR_LEN(arr) == 1 && arr[0] != NULL)) {
ir_node *new_node;
/*
* The Sel node returns only one possible method.
* So we could replace the Sel node by a SymConst.
* This method must exists.
*/
assert(get_entity_irg(arr[0]) != NULL);
new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(arr[0]), get_nodes_block(node));
DBG_OPT_POLY(node, new_node);
exchange(node, new_node);
}
#endif
}
}
......
......@@ -272,11 +272,6 @@ void dfs_dump(const dfs_t *dfs, FILE *file)
for (i = 0; i < n; ++i) {
dfs_node_t *const node = nodes[i];
ir_fprintf(file, "\tn%d [label=\"%d\"]\n", node->pre_num, get_Block_dom_tree_pre_num((ir_node*) node->node));
#if 0
ir_fprintf(file, "\tn%d [shape=box,label=\"%+F\\l%d %d/%d %d\"];\n",
node->pre_num, node->node, get_Block_dom_tree_pre_num(node->node),
node->pre_num, node->post_num, node->max_pre_num);
#endif
}
foreach_set (dfs->edges, dfs_edge_t, edge)
......
......@@ -303,7 +303,7 @@ static ir_alias_relation different_index(const ir_node *idx1, const ir_node *idx
*/
static ir_alias_relation different_sel_offsets(const ir_node *sel1, const ir_node *sel2)
{
/* seems to be broken */
/* TODO: fix */
(void) sel1;
(void) sel2;
#if 0
......
......@@ -148,36 +148,6 @@ static int get_irn_dfn(ir_node *n)
return scc->dfn;
}
#if 0
static ir_loop *find_nodes_loop(ir_node *n, ir_loop *l)
{
int i;
ir_loop *res = NULL;
/* Test whether n is contained in this loop. */
for (i = 0; i < get_loop_n_nodes(l); i++)
if (n == get_loop_node(l, i)) return l;
/* Is this a leave in the loop tree? If so loop not found. */
if (get_loop_n_sons(l) == 0) return NULL;
/* Else descend in the loop tree. */
for (i = 0; i < get_loop_n_sons(l); i++) {
res = find_nodes_loop(n, get_loop_son(l, i));
if (res) break;
}
return res;
}
/* @@@ temporary implementation, costly!!! */
ir_loop * get_irn_loop(ir_node *n)
{
ir_loop *l = get_irg_loop(current_ir_graph);
l = find_nodes_loop(n, l);
return l;
}
#endif
/**********************************************************************/
/* A stack. **/
/**********************************************************************/
......@@ -546,9 +516,6 @@ static ir_node *find_tail(ir_node *n)
ir_node *m;
int i, res_index = -2;
/*
if (!icfg && rm_cyclic_phis && remove_cyclic_phis (n)) return NULL;
*/
m = stack[tos-1]; /* tos = top of stack */
if (is_head(m, n)) {
res_index = smallest_dfn_pred(m, 0);
......@@ -761,19 +728,6 @@ static void reset_backedges(ir_node *n)
}
}
/*
static void loop_reset_backedges(ir_loop *l)
{
int i;
reset_backedges(get_loop_node(l, 0));
for (i = 0; i < get_loop_n_nodes(l); ++i)
set_irn_loop(get_loop_node(l, i), NULL);
for (i = 0; i < get_loop_n_sons(l); ++i) {
loop_reset_backedges(get_loop_son(l, i));
}
}
*/
static void loop_reset_node(ir_node *n, void *env)
{
(void) env;
......@@ -783,11 +737,6 @@ static void loop_reset_node(ir_node *n, void *env)
void free_loop_information(ir_graph *irg)
{
/* We can not use this recursion, as the loop might contain
illegal nodes by now. Why else would we throw away the
representation?
if (get_irg_loop(irg)) loop_reset_backedges(get_irg_loop(irg));
*/
irg_walk_graph(irg, loop_reset_node, NULL, NULL);
set_irg_loop(irg, NULL);
clear_irg_properties(current_ir_graph, IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO);
......
......@@ -220,19 +220,6 @@ static void add_entity_access(const ir_entity *ent, ir_node *n)
set_entity_access_array(ent, accs);
}
#if 0
void set_entity_access(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** accs;
assert(0 <= pos && pos < get_entity_n_accesses(ent));
assert(n && is_ir_node(n));
accs = get_entity_access_array(ent);
accs[pos] = n;
}
#endif
/*------------------------------------------------------------------*/
size_t get_entity_n_references(const ir_entity *ent)
......@@ -267,19 +254,6 @@ static void add_entity_reference(const ir_entity *ent, ir_node *n)
set_entity_reference_array(ent, refs);
}
#if 0
void set_entity_reference(const ir_entity *ent, int pos, ir_node *n)
{
ir_node ** refs;
assert(0 <= pos && pos < get_entity_n_references(ent));
assert(n && is_ir_node(n));
refs = get_entity_reference_array(ent);
refs[pos] = n;
}
#endif
/**------------------------------------------------------------------*/
/* Access routines for types */
/**------------------------------------------------------------------*/
......@@ -317,19 +291,6 @@ static void add_type_alloc(const ir_type *tp, ir_node *n)
set_type_alloc_array(tp, allocs);
}
#if 0
void set_type_alloc(const ir_type *tp, int pos, ir_node *n)
{
ir_node **allocs;
assert(0 <= pos && pos < get_type_n_allocs(tp));
assert(n && is_ir_node(n));
allocs = get_type_alloc_array(tp);
allocs[pos] = n;
}
#endif
/* Number of Cast nodes that create an instance of this type */
size_t get_type_n_casts(const ir_type *tp)
{
......@@ -387,19 +348,6 @@ void add_type_cast(const ir_type *tp, ir_node *n)
set_type_cast_array(tp, casts);
}
#if 0
void set_type_cast(const ir_type *tp, size_t pos, ir_node *n)
{
ir_node **casts;
assert(pos < get_type_n_casts(tp));
assert(n && is_ir_node(n));
casts = get_type_cast_array(tp);
casts[pos] = n;
}
#endif
/*------------------------------------------------------------------*/
size_t get_type_n_pointertypes_to(const ir_type *tp)
......@@ -434,19 +382,6 @@ void add_type_pointertype_to(const ir_type *tp, ir_type *ptp)
set_type_pointertype_array(tp, pts);
}
#if 0
void set_type_pointertype_to(const ir_type *tp, int pos, ir_type *ptp)
{
ir_type ** pts;
assert(0 <= pos && pos < get_type_n_pointertypes_to(tp));
assert(ptp && is_Pointer_type(ptp));
pts = get_type_pointertype_array(tp);
pts[pos] = ptp;
}
#endif
/*------------------------------------------------------------------*/
size_t get_type_n_arraytypes_of(const ir_type *tp)
......@@ -481,19 +416,6 @@ void add_type_arraytype_of(const ir_type *tp, ir_type *atp)
set_type_arraytype_array(tp, pts);
}
#if 0
void set_type_arraytype_of(const ir_type *tp, int pos, ir_type *atp)
{
ir_type ** pts;
assert(0 <= pos && pos < get_type_n_arraytypes_of(tp));
assert(atp && is_Array_type(atp));
pts = get_type_arraytype_array(tp);
pts[pos] = atp;
}
#endif
/*------------------------------------------------------------------*/
/* Building and Removing the out datastructure */
/*------------------------------------------------------------------*/
......
......@@ -199,21 +199,6 @@ unknown:
static void emit_amd64_SymConst(const ir_node *irn)
{
const amd64_SymConst_attr_t *attr = get_amd64_SymConst_attr_const(irn);
#if 0
sym_or_tv_t key, *entry;
unsigned label;
key.u.id = get_entity_ld_ident(attr->entity);
key.is_ident = 1;
key.label = 0;
entry = set_insert(sym_or_tv_t, sym_or_tv, &key, sizeof(key), hash_ptr(key.u.generic));
if (entry->label == 0) {
/* allocate a label */
entry->label = get_unique_label();
}
label = entry->label;
#endif
amd64_emitf(irn, "mov $%E, %D0", attr->entity);
}
......
......@@ -72,7 +72,6 @@ static ir_node *create_const_graph(ir_node *irn, ir_node *block)
}
value = get_tarval_long(tv);
//d// printf ("TEST GENERATE %d\n", value);
return new_bd_amd64_Immediate(dbgi, block, value);
}
......@@ -116,7 +115,6 @@ static ir_node *gen_SymConst(ir_node *node)
*/
static ir_node *gen_Add(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
/* ir_mode *mode = get_irn_mode(node); */
ir_node *op1 = get_Add_left(node);
ir_node *op2 = get_Add_right(node);
dbg_info *dbgi = get_irn_dbg_info(node);
......@@ -134,7 +132,6 @@ static ir_node *gen_Add(ir_node *node) {
*/
static ir_node *gen_Sub(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
/* ir_mode *mode = get_irn_mode(node); */
ir_node *op1 = get_Sub_left(node);
ir_node *op2 = get_Sub_right(node);
dbg_info *dbgi = get_irn_dbg_info(node);
......@@ -147,7 +144,6 @@ static ir_node *gen_Sub(ir_node *node) {
static ir_node *gen_Mul(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node));
/* ir_mode *mode = get_irn_mode(node); */
ir_node *op1 = get_Mul_left(node);
ir_node *op2 = get_Mul_right(node);
dbg_info *dbgi = get_irn_dbg_info(node);
......@@ -225,70 +221,6 @@ static ir_node *gen_Cond(ir_node *node)
return new_bd_amd64_Jcc(dbgi, block, flag_node, relation);
}
#if 0
/**
* Create an And that will zero out upper bits.
*
* @param dbgi debug info
* @param block the basic block
* @param op the original node
* param src_bits number of lower bits that will remain
*/
static ir_node *gen_zero_extension(dbg_info *dbgi, ir_node *block, ir_node *op,
int src_bits)
{
if (src_bits == 8) {
return new_bd_arm_And_imm(dbgi, block, op, 0xFF, 0);
} else if (src_bits == 16) {
ir_node *lshift = new_bd_arm_Mov_reg_shift_imm(dbgi, block, op, ARM_SHF_LSL_IMM, 16);
ir_node *rshift = new_bd_arm_Mov_reg_shift_imm(dbgi, block, lshift, ARM_SHF_LSR_IMM, 16);
return rshift;
} else {
panic("zero extension only supported for 8 and 16 bits");
}
}
/**
* Generate code for a sign extension.
*/
static ir_node *gen_sign_extension(dbg_info *dbgi, ir_node *block, ir_node *op,
int src_bits)
{
int shift_width = 32 - src_bits;
ir_node *lshift_node = new_bd_arm_Mov_reg_shift_imm(dbgi, block, op, ARM_SHF_LSL_IMM, shift_width);
ir_node *rshift_node = new_bd_arm_Mov_reg_shift_imm(dbgi, block, lshift_node, ARM_SHF_ASR_IMM, shift_width);
return rshift_node;
}
static ir_node *gen_extension(dbg_info *dbgi, ir_node *block, ir_node *op,
ir_mode *orig_mode)
{
int bits = get_mode_size_bits(orig_mode);
if (bits == 32)
return op;
if (mode_is_signed(orig_mode)) {
return gen_sign_extension(dbgi, block, op, bits);
} else {
return gen_zero_extension(dbgi, block, op, bits);
}
}
/**
* returns true if it is assured, that the upper bits of a node are "clean"
* which means for a 16 or 8 bit value, that the upper bits in the register
* are 0 for unsigned and a copy of the last significant bit for signed
* numbers.
*/
static bool upper_bits_clean(ir_node *transformed_node, ir_mode *mode)
{
(void) transformed_node;
(void) mode;
/* TODO */
return false;
}
#endif
static ir_node *gen_Phi(ir_node *node)
{
ir_mode *mode = get_irn_mode(node);
......@@ -341,18 +273,6 @@ static ir_node *gen_Conv(ir_node *node)
return new_bd_amd64_Conv(dbgi, block, new_op, min_mode);
#if 0
if (upper_bits_clean(new_op, min_mode)) {
return new_op;
}
if (mode_is_signed(min_mode)) {
return gen_sign_extension(dbg, block, new_op, min_bits);
} else {
return gen_zero_extension(dbg, block, new_op, min_bits);
}
#endif
}
}
......@@ -408,15 +328,6 @@ static ir_node *gen_Load(ir_node *node)
}
set_irn_pinned(new_load, get_irn_pinned(node));
#if 0
/* check for special case: the loaded value might not be used */
if (be_get_Proj_for_pn(node, pn_Load_res) == NULL) {
/* add a result proj and a Keep to produce a pseudo use */
ir_node *proj = new_r_Proj(new_load, mode_Iu, pn_amd64_Load_res);
be_new_Keep(block, 1, &proj);
}
#endif
return new_load;
}
......@@ -440,11 +351,6 @@ static ir_node *gen_Proj_Load(ir_node *node)
return new_rd_Proj(dbgi, new_load, mode_M, pn_amd64_Load_M);
}
break;
/*
case iro_sparc_fpaLoad:
panic("FP not implemented yet");
break;
*/
default:
panic("Unsupported Proj from Load");
}
......@@ -471,31 +377,7 @@ static ir_node *gen_Proj(ir_node *node)
}
} else if (is_Load(pred)) {
return gen_Proj_Load(node);
#if 0
} else if (be_is_SubSP(pred)) {
//panic("gen_Proj not implemented for SubSP");
return gen_Proj_be_SubSP(node);
} else if (be_is_AddSP(pred)) {
//panic("gen_Proj not implemented for AddSP");
return gen_Proj_be_AddSP(node);
} else if (is_Div(pred)) {
return gen_Proj_Div(node);
#endif
} else if (is_Start(pred)) {
#if 0
ir_graph *const irg = get_irn_irg(node);
if (node == get_irg_anchor(irg, anchor_tls)) {
return gen_Proj_tls(node);
}
} else {
ir_node *new_pred = be_transform_node(pred);
ir_mode *mode = get_irn_mode(node);
if (mode_needs_gp_reg(mode)) {
ir_node *new_proj = new_r_Proj(new_pred, mode_Iu, get_Proj_proj(node));
new_proj->node_nr = node->node_nr;
return new_proj;
}
#endif
}
return be_duplicate_node(node);
......
......@@ -544,24 +544,7 @@ static ir_node *gen_Add(ir_node *node)
panic("Softfloat not supported yet");
}
} else {
#if 0
/* check for MLA */
if (is_arm_Mul(new_op1) && get_irn_n_edges(op1) == 1) {
new_op3 = new_op2;
new_op2 = get_irn_n(new_op1, 1);
new_op1 = get_irn_n(new_op1, 0);
return new_bd_arm_Mla(dbgi, block, new_op1, new_op2, new_op3);
}
if (is_arm_Mul(new_op2) && get_irn_n_edges(op2) == 1) {
new_op3 = new_op1;
new_op1 = get_irn_n(new_op2, 0);
new_op2 = get_irn_n(new_op2, 1);
return new_bd_arm_Mla(dbgi, block, new_op1, new_op2, new_op3);
}
#endif
/* TODO: check for MLA */
return gen_int_binop(node, MATCH_COMMUTATIVE | MATCH_SIZE_NEUTRAL, &add_factory);
}
}
......@@ -1081,38 +1064,6 @@ enum fpa_imm_mode {
static ir_tarval *fpa_imm[FPA_IMM_MAX + 1][fpa_max];
#if 0
/**
* Check, if a floating point tarval is an fpa immediate, i.e.
* one of 0, 1, 2, 3, 4, 5, 10, or 0.5.
*/
static int is_fpa_immediate(tarval *tv)
{
ir_mode *mode = get_tarval_mode(tv);
int i, j, res = 1;
switch (get_mode_size_bits(mode)) {
case 32:
i = FPA_IMM_FLOAT;
break;
case 64:
i = FPA_IMM_DOUBLE;
break;
}
if (tarval_is_negative(tv)) {
tv = tarval_neg(tv);
res = -1;
}
for (j = 0; j < fpa_max; ++j) {
if (tv == fpa_imm[i][j])
return res * j;
}
return fpa_max;
}
#endif
static ir_node *gen_Const(ir_node *node)
{
ir_node *block = be_transform_node(get_nodes_block(node));
......@@ -1877,22 +1828,9 @@ static ir_node *gen_Call(ir_node *node)
entity = get_SymConst_entity(callee);
} else {
/* TODO: finish load matcher here */
#if 0
/* callee */
if (is_Proj(callee) && is_Load(get_Proj_pred(callee))) {
ir_node *load = get_Proj_pred(callee);
ir_node *ptr = get_Load_ptr(load);
ir_node *new_ptr = be_transform_node(ptr);
ir_node *mem = get_Load_mem(load);
ir_node *new_mem = be_transform_node(mem);
ir_mode *mode = get_Load_mode(node);
} else {
#endif
in[in_arity] = be_transform_node(callee);
in_req[in_arity] = arm_reg_classes[CLASS_arm_gp].class_req;
++in_arity;
//}
in[in_arity] = be_transform_node(callee);
in_req[in_arity] = arm_reg_classes[CLASS_arm_gp].class_req;
++in_arity;
}
/* outputs:
......
......@@ -105,10 +105,6 @@ static void ps_begin(plotter_t *_self, const rect_t *vis)
f = self->f = fopen(self->filename, "wt");
fprintf(f, "%%!PS-Adobe-2.0\n");
fprintf(f, "%%%%BoundingBox: %d %d %d %d\n", vis->x, vis->y, vis->w, vis->h);
#if 0
fprintf(f, "/mainfont /Courier findfont %f scalefont def\n", 10.0);
fprintf(f, "mainfont setfont\n");
#endif /* if 0 */
}
static void ps_setcolor(plotter_t *_self, const color_t *color)
......
......@@ -581,14 +581,6 @@ static int compare_ous(const void *k1, const void *k2)
if (u1_has_constr != u2_has_constr)
return u2_has_constr - u1_has_constr;
/* Now check, whether the two units are connected */
#if 0
for (i=0; i<u1->node_count; ++i)
for (o=0; o<u2->node_count; ++o)
if (u1->nodes[i] == u2->nodes[o])
return 0;
#endif
/* After all, the sort key decides. Greater keys come first. */
return u2->sort_key - u1->sort_key;
......
......@@ -237,14 +237,7 @@ void copystat_dump(ir_graph *irg)
fprintf(out, "%d\n", (int)ASIZE);
for (i = 0; i < ASIZE; i++) {
#if 0
if (i >= I_PHI_ARITY_S && i <= I_PHI_ARITY_E)
fprintf(out, "%i %i\n", curr_vals[i], curr_vals[I_PHI_CNT]);
else if (i >= I_CLS_SIZE_S && i <= I_CLS_SIZE_E)
fprintf(out, "%i %i\n", curr_vals[i], curr_vals[I_CLS_CNT]);
else
#endif
fprintf(out, "%i\n", curr_vals[i]);
fprintf(out, "%i\n", curr_vals[i]);
}
fclose(out);
......
......@@ -412,11 +412,6 @@ ir_node *be_peephole_IncSP_IncSP(ir_node *node)
void be_peephole_opt(ir_graph *irg)
{
#if 0
/* we sometimes find BadE nodes in float apps like optest_float.c or
* kahansum.c for example... */
be_invalidate_live_sets(irg);
#endif
be_assure_live_sets(irg);
arch_env = be_get_irg_arch_env(irg);
......
......@@ -1250,14 +1250,6 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node,
int res = hungarian_solve(bp, assignment, NULL, 0);
assert(res == 0);
#if 0
fprintf(stderr, "Swap result:");