/* 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)
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);
*/
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
}
}
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)
*/
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
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. **/
/**********************************************************************/
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);
}
}
-/*
-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;
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);
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)
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 */
/**------------------------------------------------------------------*/
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)
{
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)
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)
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 */
/*------------------------------------------------------------------*/
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);
}
}
value = get_tarval_long(tv);
- //d// printf ("TEST GENERATE %d\n", value);
return new_bd_amd64_Immediate(dbgi, block, value);
}
*/
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);
*/
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);
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);
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);
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
}
}
}
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;
}
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");
}
}
} 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);
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);
}
}
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));
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:
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)
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;
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);
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);
int res = hungarian_solve(bp, assignment, NULL, 0);
assert(res == 0);
-#if 0
- fprintf(stderr, "Swap result:");
- for (i = 0; i < (int) n_regs; ++i) {
- fprintf(stderr, " %d", assignment[i]);
- }
- fprintf(stderr, "\n");
-#endif
-
hungarian_free(bp);
permute_values(live_nodes, node, assignment);
} reg_pressure_selector_env_t;
-#if 0
-/*
-* Ugly global variable for the compare function
-* since qsort(3) does not pass an extra pointer.
-*/
-static ir_node *curr_bl = NULL;
-
-static int cmp_usage(const void *a, const void *b)
-{
- struct trivial_sched_env *env;
- const ir_node *p = a;
- const ir_node *q = b;
- int res = 0;
-
- res = is_live_end(env->curr_bl, a) - is_live_end(env->curr_bl, b);
-
- /*
- * One of them is live at the end of the block.
- * Then, that one shall be scheduled at after the other
- */
- if (res != 0)
- return res;
-
-
- return res;
-}
-#endif
-
static inline usage_stats_t *get_or_set_usage_stats(reg_pressure_selector_env_t *env, ir_node *irn)
{
usage_stats_t *us = (usage_stats_t*)get_irn_link(irn);
sched_foreach(bl, irn) {
for (int i = 0, n = get_irn_arity(irn); i < n; ++i) {
usage_stats_t *us = get_or_set_usage_stats(env, irn);
-#if 0 /* Liveness is not computed here! */
- if (is_live_end(bl, op))
- us->uses_in_block = 99999;
- else
-#endif
- us->uses_in_block++;
+ us->uses_in_block++;
}
}
(void) env;
if (be_is_Keep(n) || is_Proj(n))
return 0;
-#if 0
- if (env->selector->exectime)
- return env->selector->exectime(env->selector_env, n);
-#endif
return 1;
}
if (is_Proj(curr))
return 0;
-#if 0
- /* predecessors Proj's must be skipped */
- if (is_Proj(pred))
- pred = get_Proj_pred(pred);
-
- if (env->selector->latency)
- return env->selector->latency(env->selector_env, pred, pred_cycle, curr, curr_cycle);
-#endif
-
return 1;
}
be_ssa_construction_add_copies(&senv, copies, ARR_LEN(copies));
be_ssa_construction_fix_users(&senv, to_spill);
-#if 0
- /* no need to enable this as long as we invalidate liveness
- after this function... */
- be_ssa_construction_update_liveness_phis(&senv);
- be_liveness_update(to_spill);
- len = ARR_LEN(copies);
- for (i = 0; i < len; ++i) {
- be_liveness_update(lv, copies[i]);
- }
-#endif
be_ssa_construction_destroy(&senv);
}
/* need to reconstruct SSA form if we had multiple spills */
collect_memperm(env, node, reload, ent);
} else if (is_Phi(node) && get_irn_mode(node) == mode_M) {
collect_memphi(env, node, reload, ent);
- } else {
- /* Disabled for now, spills might get transformed by the backend */
-#if 0
- ir_fprintf(stderr, "Verify warning: No spill, memperm or memphi attached to node %+F found from node %+F in block %+F(%s)\n",
- node, reload, get_nodes_block(node), get_irg_name(env->irg));
- env->problem_found = true;
-#endif
}
}
1, /* cost of a constant shift instruction */
3, /* starting cost of a multiply instruction */
0, /* cost of multiply for every set bit */
-#if 0 /* TEST */
4, /* logarithm for alignment of function labels */
4, /* logarithm for alignment of loops labels */
7, /* maximum skip for alignment of loops labels */
-#else
- 0,
- 0,
- 0
-#endif
};
/* costs for the K10 */
be_set_IncSP_offset(irn, inc_ofs);
}
-#if 0
-/**
- * Creates a Push instruction before the given schedule point.
- *
- * @param dbgi debug info
- * @param block the block
- * @param stack the previous stack value
- * @param schedpoint the new node is added before this node
- * @param reg the register to pop
- *
- * @return the new stack value
- */
-static ir_node *create_push(dbg_info *dbgi, ir_node *block,
- ir_node *stack, ir_node *schedpoint)
-{
- const arch_register_t *esp = &ia32_registers[REG_ESP];
-
- ir_node *val = ia32_new_NoReg_gp(cg);
- ir_node *noreg = ia32_new_NoReg_gp(cg);
- ir_graph *irg = get_irn_irg(block);
- ir_node *nomem = get_irg_no_mem(irg);
- ir_node *push = new_bd_ia32_Push(dbgi, block, noreg, noreg, nomem, val, stack);
- sched_add_before(schedpoint, push);
-
- stack = new_r_Proj(push, mode_Iu, pn_ia32_Push_stack);
- arch_set_irn_register(stack, esp);
-
- return stack;
-}
-
-static void peephole_store_incsp(ir_node *store)
-{
- dbg_info *dbgi;
- ir_node *block;
- ir_node *noreg;
- ir_node *mem;
- ir_node *push;
- ir_node *val;
- ir_node *base;
- ir_node *index;
- ir_node *am_base = get_irn_n(store, n_ia32_Store_base);
- if (!be_is_IncSP(am_base)
- || get_nodes_block(am_base) != get_nodes_block(store))
- return;
- mem = get_irn_n(store, n_ia32_Store_mem);
- if (!is_ia32_NoReg_GP(get_irn_n(store, n_ia32_Store_index))
- || !is_NoMem(mem))
- return;
-
- int incsp_offset = be_get_IncSP_offset(am_base);
- if (incsp_offset <= 0)
- return;
-
- /* we have to be at offset 0 */
- int my_offset = get_ia32_am_offs_int(store);
- if (my_offset != 0) {
- /* TODO here: find out whether there is a store with offset 0 before
- * us and whether we can move it down to our place */
- return;
- }
- ir_mode *ls_mode = get_ia32_ls_mode(store);
- int my_store_size = get_mode_size_bytes(ls_mode);
-
- if (my_offset + my_store_size > incsp_offset)
- return;
-
- /* correctness checking:
- - noone else must write to that stackslot
- (because after translation incsp won't allocate it anymore)
- */
- sched_foreach_reverse_from(store, node) {
- int i, arity;
-
- if (node == am_base)
- break;
-
- /* make sure noone else can use the space on the stack */
- arity = get_irn_arity(node);
- for (i = 0; i < arity; ++i) {
- ir_node *pred = get_irn_n(node, i);
- if (pred != am_base)
- continue;
-
- if (i == n_ia32_base &&
- (get_ia32_op_type(node) == ia32_AddrModeS
- || get_ia32_op_type(node) == ia32_AddrModeD)) {
- int node_offset = get_ia32_am_offs_int(node);
- ir_mode *node_ls_mode = get_ia32_ls_mode(node);
- int node_size = get_mode_size_bytes(node_ls_mode);
- /* overlapping with our position? abort */
- if (node_offset < my_offset + my_store_size
- && node_offset + node_size >= my_offset)
- return;
- /* otherwise it's fine */
- continue;
- }
-
- /* strange use of esp: abort */
- return;
- }
- }
-
- /* all ok, change to push */
- dbgi = get_irn_dbg_info(store);
- block = get_nodes_block(store);
- noreg = ia32_new_NoReg_gp(cg);
- val = get_irn_n(store, n_ia32_Store_val);
-
- push = new_bd_ia32_Push(dbgi, block, noreg, noreg, mem,
-
- create_push(dbgi, block, am_base, store);
-}
-#endif
-
/**
* Return true if a mode can be stored in the GP register set
*/
{
/* the peephole code currently doesn't allow this since it changes
* the register. Find out why and how to workaround this... */
-#if 0
- const sparc_attr_t *attr = get_sparc_attr_const(node);
- if (attr->immediate_value == 0) {
- ir_node *base = get_irn_n(node, n_sparc_FrameAddr_base);
- be_peephole_exchange(node, base);
- }
-#endif
(void) node;
}
}
DBG_OPT_ALGSIM0(oldn, n, FS_OPT_SUB_TO_ADD);
return n;
-#if 0
- } else if (is_Mul(b)) { /* a - (b * C) -> a + (b * -C) */
- ir_node *m_right = get_Mul_right(b);
- if (is_Const(m_right)) {
- ir_node *cnst2 = const_negate(m_right);
- if (cnst2 != NULL) {
- dbg_info *m_dbg = get_irn_dbg_info(b);
- ir_node *m_block = get_nodes_block(b);
- ir_node *m_left = get_Mul_left(b);
- ir_mode *m_mode = get_irn_mode(b);
- ir_node *mul = new_rd_Mul(m_dbg, m_block, m_left, cnst2, m_mode);
- dbg_info *a_dbg = get_irn_dbg_info(n);
- ir_node *a_block = get_nodes_block(n);
-
- n = new_rd_Add(a_dbg, a_block, a, mul, mode);
- DBG_OPT_ALGSIM0(oldn, n, FS_OPT_SUB_TO_ADD);
- return n;
- }
- }
-#endif
}
/* Beware of Sub(P, P) which cannot be optimized into a simple Minus ... */
{
int n_floats = mode_is_float(m0) + mode_is_float(m1) + mode_is_float(m2);
if (n_floats == 1) {
-#if 0
- int n_signed = mode_is_signed(m0) + mode_is_signed(m1)
- + mode_is_signed(m2);
- /* we assume that float modes are always signed */
- if ((n_signed & 1) != 1)
- return false;
-#else
/* because overflow gives strange results we don't touch this case */
return false;
-#endif
} else if (n_floats == 2 && !mode_is_float(m1)) {
return false;
}
* The only thing gurobi sanely supports is giving a string with a filename
* :-( ...so we use /tmp/firm_gurobi.log as a temporary measure...
*/
-#if 0
- error = GRBsetlogfile(grb->env, lpp->log);
- check_gurobi_error(grb, error);
-#else
if (lpp->log != stdout && lpp->log != stderr) {
error = GRBsetintparam(grb->env, GRB_INT_PAR_OUTPUTFLAG, 0);
check_gurobi_error(grb, error);
}
-#endif
return grb;
}
colname[i] = (char*) curr_var->name;
vartype[i] = gurobi_var_encoding[curr_var->type.var_type];
-#if 0
- if (curr_var->value_kind == lpp_value_start) {
- panic("start values not supported in gurobi yet");
- indices[sv_cnt] = i;
- startv[sv_cnt++] = curr_var->value;
- }
-#endif
-
matbeg[i] = o;
matcnt[i] = 0;
matrix_foreach_in_col(lpp->m, 1 + i, elem) {
check_gurobi_error(grb, error);
}
-#if 0
- /*
- * If a bound of the objective function is supplied,
- * set it accordingly, dependign on minimization or maximization.
- */
- if(lpp->set_bound) {
- fprintf(stderr, "Warning: gurobi bound not implemented yet\n");
- }
-#endif
-
/* solve */
error = GRBoptimize(grb->model);
check_gurobi_error(grb, error);
lpp_writes(comm, solver);
lpp_flush(comm);
-#if 0
- ERR_CHECK_RETURN_VOID(lpp_ack(fd, sizeof(buf), buf), == 0,
- ("could not set solver: %s", solver));
-#endif
-
t_send = ir_timer_new();
t_recv = ir_timer_new();
return t;
/* for now, the 1-input identity is not supported */
-#if 0
- sel = get_irn_node(get_Mux_sel(mux));
-
- /* Mux sel input is mode_b, so it is always a tarval */
- if (sel->type.tv == tarval_b_true)
- return t;
- if (sel->type.tv == tarval_b_false)
- return f;
-#endif
return node;
}
dump_all_partitions(&env);
check_all_partitions(&env);
-#if 0
- dump_ir_block_graph(irg, "-partition");
-#endif
-
/* apply the result */
/* check, which nodes must be kept */
return -1;
}
-#if 0 // TODO
- /* Take the minimum of the conversion costs for Phi predecessors as only one
- * branch is actually executed at a time */
- if (is_Phi(node)) {
- int i;
- int arity = get_Phi_n_preds(node);
- int costs;
-
- costs = get_conv_costs(get_Phi_pred(node, 0), dest_mode);
- for (i = 1; i < arity; ++i) {
- ir_node *pred = get_Phi_pred(node, i);
- int c = get_conv_costs(pred, dest_mode);
- if (c < costs) costs = c;
- }
-
- return costs;
- }
-#endif
+ /* TODO: Phi nodes */
if (!is_downconv(mode, dest_mode)) {
return 1;
if (arity == 2) {
unsigned mark;
-#if 0
- DB((dbg, LEVEL_1, "Welding block %+F and %+F\n", block, mux_block));
- /* copy the block-info from the Mux-block to the block before merging */
-
- mark = get_Block_mark(mux_block) | get_Block_mark(block);
- set_Block_mark(block, mark);
- set_Block_phis(block, get_Block_phis(mux_block));
-
- set_irn_in(block, get_irn_arity(mux_block), get_irn_in(mux_block) + 1);
- exchange_cdep(mux_block, block);
- exchange(mux_block, block);
-#else
DB((dbg, LEVEL_1, "Welding block %+F to %+F\n", block, mux_block));
mark = get_Block_mark(mux_block) | get_Block_mark(block);
/* mark both block just to be sure, should be enough to mark mux_block */
set_Block_mark(mux_block, mark);
exchange(block, mux_block);
-#endif
return;
} else {
rewire(block, i, j, new_r_Jmp(mux_block));
return 0;
}
-#if 0
-/* Matze: disabled, check first if the compare still is correct */
-
-/**
- * returns whether the cmp evaluates to true or false according to vrp
- * information , or can't be evaluated!
- * 1: true, 0: false, -1: can't evaluate
- *
- * @param relation the compare mode of the Compare
- * @param left the left node
- * @param right the right node
- */
-static int eval_cmp_vrp(ir_relation relation, ir_node *left, ir_node *right)
-{
- ir_relation cmp_result = vrp_cmp(left, right);
- /* does the compare evaluate to true? */
- if (cmp_result == ir_relation_false)
- return -1;
-
- if ((cmp_result & relation) != cmp_result) {
- if ((cmp_result & relation) != 0) {
- return -1;
- }
- return 0;
- }
- return 1;
-}
-#endif
-
/**
* returns whether the cmp evaluates to true or false, or can't be evaluated!
* 1: true, 0: false, -1: can't evaluate
selector_evaluated = eval_cmp_tv(relation, tv_left, tv_right);
}
-#if 0
- if (selector_evaluated < 0) {
- /* This is only the case if the predecessor nodes are not
- * constant or the comparison could not be evaluated.
- * Try with VRP information now.
- */
- selector_evaluated = eval_cmp_vrp(relation, left, right);
- }
-#endif
} else if (is_Const_or_Confirm(selector)) {
ir_tarval *tv = get_Const_or_Confirm_tarval(selector);
if (tv == tarval_b_true) {
return 0;
}
-#if 0
-/**
- * check if a given node is a mul with 2, 4, 8
- */
-static int is_x86_shift_const(ir_node *mul)
-{
- ir_node *rc;
-
- if (! is_Mul(mul))
- return 0;
-
- /* normalization put constants on the right side */
- rc = get_Mul_right(mul);
- if (is_Const(rc)) {
- ir_tarval *tv = get_Const_tarval(rc);
-
- if (tarval_is_long(tv)) {
- long value = get_tarval_long(tv);
-
- if (value == 2 || value == 4 || value == 8) {
- /* do not reduce multiplications by 2, 4, 8 */
- return 1;
- }
- }
- }
- return 0;
-}
-#endif
-
/**
* Check if an IV represents a counter with constant limits.
*
size_t i, n;
if (gppt_fct) gen_pointer_type_to = gppt_fct;
-#if 0
- if (get_irp_typeinfo_state() != ir_typeinfo_consistent)
- simple_analyse_types();
-#endif
-
for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_graph *irg = get_irp_irg(i);
pure_normalize_irg_class_casts(irg);
{
int changed;
-#if 0
- if (get_irp_typeinfo_state() != ir_typeinfo_consistent)
- simple_analyse_types();
-#endif
-
changed = 0;
all_irg_walk(NULL, irn_optimize_class_cast, &changed);
/* count the nodes in the graph */
irg_walk_graph(graph->irg, update_node_stat, NULL, graph);
-#if 0
- /* Uncomment this code if chain-call means call exact one. */
- entry = opcode_get_entry(op_Call, graph->opcode_hash);
-
- /* check if we have more than 1 call */
- if (cnt_gt(entry->cnt_alive, 1))
- graph->is_chain_call = 0;
-#endif
-
/* recursive functions are never chain calls, leafs don't have calls */
if (graph->is_recursive || graph->is_leaf)
graph->is_chain_call = 0;
fc_exact &= normalize(result, result, sticky);
}
-#if 0
-static void _power_of_ten(int exp, float_descriptor_t *desc, char *result)
-{
- char *build;
- char *temp;
-
- /* positive sign */
- result->sign = 0;
-
- /* set new descriptor (else result is supposed to already have one) */
- if (desc != NULL)
- result->desc = *desc;
-
- build = alloca(value_size);
- temp = alloca(value_size);
-
- sc_val_from_ulong((1 << (result->desc.exponent_size - 1)) - 1, _exp(result));
-
- if (exp > 0) {
- /* temp is value of ten now */
- sc_val_from_ulong(10, NULL);
- _save_result(temp);
-
- for (exp--; exp > 0; exp--) {
- _save_result(build);
- sc_mul(build, temp, NULL);
- }
- _save_result(build);
-
- /* temp is amount of left shift needed to put the value left of the radix point */
- sc_val_from_ulong(result->desc.mantissa_size + ROUNDING_BITS, temp);
-
- _shift_left(build, temp, _mant(result));
-
- _normalize(result, result, 0);
- }
-}
-#endif
-
/**
* Truncate the fractional part away.
*