They're adding more noise than they provide gain in readability. They
also make extra work to keep up to date.
16 files changed:
found = largest_dfn_pred(m, &res_index);
break;
}
found = largest_dfn_pred(m, &res_index);
break;
}
- if (m == n) { break; } /* It's not an unreachable loop, either. */
+ /* It's not an unreachable loop, either. */
+ if (m == n)
+ break;
}
//assert(0 && "no head found on stack");
}
}
//assert(0 && "no head found on stack");
}
env->num_consts += 1;
}
}
env->num_consts += 1;
}
}
/**
* Handle a mode_b input of Cond nodes.
/**
* Handle a mode_b input of Cond nodes.
/**
* Pre-block-walker: Called for every block to insert Confirm nodes
/**
* Pre-block-walker: Called for every block to insert Confirm nodes
handle_case(block, get_Cond_selector(cond), proj_nr, env);
}
handle_case(block, get_Cond_selector(cond), proj_nr, env);
}
-} /* insert_Confirm_in_block */
/**
* Checks if a node is a non-null Confirm.
/**
* Checks if a node is a non-null Confirm.
if (is_SymConst_addr_ent(ptr))
return 1;
return 0;
if (is_SymConst_addr_ent(ptr))
return 1;
return 0;
-} /* is_non_null_Confirm */
/**
* The given pointer will be dereferenced, add non-null Confirms.
/**
* The given pointer will be dereferenced, add non-null Confirms.
env->num_confirms += 1;
}
}
env->num_confirms += 1;
}
}
/**
* Pre-walker: Called for every node to insert Confirm nodes
/**
* Pre-walker: Called for every node to insert Confirm nodes
/*
* Construct Confirm nodes
/*
* Construct Confirm nodes
/* deactivate edges if they where off */
if (! edges_active)
edges_deactivate(irg);
/* deactivate edges if they where off */
if (! edges_active)
edges_deactivate(irg);
-} /* construct_confirms */
/* Construct a pass. */
ir_graph_pass_t *construct_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "confirm", construct_confirms);
/* Construct a pass. */
ir_graph_pass_t *construct_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "confirm", construct_confirms);
-} /* construct_confirms_pass */
static void remove_confirm(ir_node *n, void *env)
{
static void remove_confirm(ir_node *n, void *env)
{
void remove_confirms(ir_graph *irg)
{
irg_walk_graph(irg, NULL, remove_confirm, NULL);
void remove_confirms(ir_graph *irg)
{
irg_walk_graph(irg, NULL, remove_confirm, NULL);
/* Construct a pass. */
ir_graph_pass_t *remove_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "rem_confirm", remove_confirms);
/* Construct a pass. */
ir_graph_pass_t *remove_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "rem_confirm", remove_confirms);
-} /* remove_confirms_pass */
if (opt & aa_opt_inherited)
return global_mem_disamgig_opt;
return opt;
if (opt & aa_opt_inherited)
return global_mem_disamgig_opt;
return opt;
-} /* get_irg_memory_disambiguator_options */
/* Set the memory disambiguator options for a graph. */
void set_irg_memory_disambiguator_options(ir_graph *irg, unsigned options)
{
irg->mem_disambig_opt = options & ~aa_opt_inherited;
/* Set the memory disambiguator options for a graph. */
void set_irg_memory_disambiguator_options(ir_graph *irg, unsigned options)
{
irg->mem_disambig_opt = options & ~aa_opt_inherited;
-} /* set_irg_memory_disambiguator_options */
/* Set the global disambiguator options for all graphs not having local options. */
void set_irp_memory_disambiguator_options(unsigned options)
{
global_mem_disamgig_opt = options;
/* Set the global disambiguator options for all graphs not having local options. */
void set_irp_memory_disambiguator_options(unsigned options)
{
global_mem_disamgig_opt = options;
-} /* set_irp_memory_disambiguator_options */
/* Get the base storage class (ignore modifier) */
ir_storage_class_class_t get_base_sc(ir_storage_class_class_t x)
{
return x & ~ir_sc_modifiers;
/* Get the base storage class (ignore modifier) */
ir_storage_class_class_t get_base_sc(ir_storage_class_class_t x)
{
return x & ~ir_sc_modifiers;
/**
* Find the base address and entity of an Sel node.
/**
* Find the base address and entity of an Sel node.
}
*pEnt = get_Sel_entity(sel);
return ptr;
}
*pEnt = get_Sel_entity(sel);
return ptr;
/**
* Check if a given Const node is greater or equal a given size.
/**
* Check if a given Const node is greater or equal a given size.
return tarval_is_null(tv) ? ir_may_alias : ir_no_alias;
tv_size = new_tarval_from_long(size, get_tarval_mode(tv));
return tarval_cmp(tv_size, tv) & (ir_relation_less_equal) ? ir_no_alias : ir_may_alias;
return tarval_is_null(tv) ? ir_may_alias : ir_no_alias;
tv_size = new_tarval_from_long(size, get_tarval_mode(tv));
return tarval_cmp(tv_size, tv) & (ir_relation_less_equal) ? ir_no_alias : ir_may_alias;
/**
* Treat idx1 and idx2 as integer indexes and check if they differ always more than size.
/**
* Treat idx1 and idx2 as integer indexes and check if they differ always more than size.
/**
* Two Sel addresses have the same base address, check if there offsets are
/**
* Two Sel addresses have the same base address, check if there offsets are
(void) different_index;
#endif
return ir_may_alias;
(void) different_index;
#endif
return ir_may_alias;
-} /* different_sel_offsets */
/**
* Determine the alias relation by checking if adr1 and adr2 are pointer
/**
* Determine the alias relation by checking if adr1 and adr2 are pointer
/**
* Returns non-zero if a node is a result on a malloc-like routine.
/**
* Returns non-zero if a node is a result on a malloc-like routine.
-} /* is_malloc_Result */
ir_storage_class_class_t classify_pointer(const ir_node *irn,
const ir_entity *ent)
ir_storage_class_class_t classify_pointer(const ir_node *irn,
const ir_entity *ent)
/* access points-to information here */
return ir_may_alias;
/* access points-to information here */
return ir_may_alias;
-} /* _get_alias_relation */
/*
* Determine the alias relation between two addresses.
/*
* Determine the alias relation between two addresses.
ir_alias_relation rel = _get_alias_relation(adr1, mode1, adr2, mode2);
DB((dbg, LEVEL_1, "alias(%+F, %+F) = %s\n", adr1, adr2, get_ir_alias_relation_name(rel)));
return rel;
ir_alias_relation rel = _get_alias_relation(adr1, mode1, adr2, mode2);
DB((dbg, LEVEL_1, "alias(%+F, %+F) = %s\n", adr1, adr2, get_ir_alias_relation_name(rel)));
return rel;
-} /* get_alias_relation */
/* Set a source language specific memory disambiguator function. */
void set_language_memory_disambiguator(DISAMBIGUATOR_FUNC func)
{
language_disambuigator = func;
/* Set a source language specific memory disambiguator function. */
void set_language_memory_disambiguator(DISAMBIGUATOR_FUNC func)
{
language_disambuigator = func;
-} /* set_language_memory_disambiguator */
/** The result cache for the memory disambiguator. */
static set *result_cache = NULL;
/** The result cache for the memory disambiguator. */
static set *result_cache = NULL;
return p1->adr1 == p2->adr1 && p1->adr2 == p2->adr2 &&
p1->mode1 == p2->mode1 && p1->mode2 == p2->mode2;
return p1->adr1 == p2->adr1 && p1->adr2 == p2->adr2 &&
p1->mode1 == p2->mode1 && p1->mode2 == p2->mode2;
-} /* cmp_mem_disambig_entry */
/**
* Initialize the relation cache.
/**
* Initialize the relation cache.
void mem_disambig_init(void)
{
result_cache = new_set(cmp_mem_disambig_entry, 8);
void mem_disambig_init(void)
{
result_cache = new_set(cmp_mem_disambig_entry, 8);
-} /* mem_disambig_init */
/*
* Determine the alias relation between two addresses.
/*
* Determine the alias relation between two addresses.
set_insert(result_cache, &key, sizeof(key), HASH_ENTRY(adr1, adr2));
return key.result;
set_insert(result_cache, &key, sizeof(key), HASH_ENTRY(adr1, adr2));
return key.result;
-} /* get_alias_relation_ex */
/* Free the relation cache. */
void mem_disambig_term(void)
/* Free the relation cache. */
void mem_disambig_term(void)
del_set(result_cache);
result_cache = NULL;
}
del_set(result_cache);
result_cache = NULL;
}
-} /* mem_disambig_term */
/**
* Check the mode of a Load/Store with the mode of the entity
/**
* Check the mode of a Load/Store with the mode of the entity
return true;
}
return false;
return true;
}
return false;
/**
* Determine the usage state of a node (or its successor Sels).
/**
* Determine the usage state of a node (or its successor Sels).
return;
}
panic("invalid initializer found");
return;
}
panic("invalid initializer found");
-} /* check_initializer_nodes */
/**
* Mark all entities used in the initializer for the given entity as unknown
/**
* Mark all entities used in the initializer for the given entity as unknown
check_initializer(ent);
}
check_initializer(ent);
}
-} /* check_initializers */
flags = get_entity_usage(ent);
flags |= determine_entity_usage(irn, ent);
set_entity_usage(ent, (ir_entity_usage) flags);
flags = get_entity_usage(ent);
flags |= determine_entity_usage(irn, ent);
set_entity_usage(ent, (ir_entity_usage) flags);
-} /* check_global_address */
/**
* Update the entity usage flags of all global entities.
/**
* Update the entity usage flags of all global entities.
pmap_insert(mtp_map, tp, res);
return res;
pmap_insert(mtp_map, tp, res);
return res;
-} /* clone_type_and_cache */
/**
* Walker: clone all call types of Calls to methods having the
/**
* Walker: clone all call types of Calls to methods having the
-} /* update_calls_to_private */
/* Mark all private methods, i.e. those of which all call sites are known. */
void mark_private_methods(void)
/* Mark all private methods, i.e. those of which all call sites are known. */
void mark_private_methods(void)
all_irg_walk(NULL, update_calls_to_private, NULL);
pmap_destroy(mtp_map);
all_irg_walk(NULL, update_calls_to_private, NULL);
pmap_destroy(mtp_map);
-} /* mark_private_methods */
/* create a pass for mark_private_methods() */
ir_prog_pass_t *mark_private_methods_pass(const char *name)
{
return def_prog_pass(name ? name : "mark_private_methods", mark_private_methods);
/* create a pass for mark_private_methods() */
ir_prog_pass_t *mark_private_methods_pass(const char *name)
{
return def_prog_pass(name ? name : "mark_private_methods", mark_private_methods);
-} /* mark_private_methods_pass */
res_index = largest_dfn_pred (m);
break;
}
res_index = largest_dfn_pred (m);
break;
}
- if (m == n) { break; } /* It's not an unreachable loop, either. */
+ /* It's not an unreachable loop, either. */
+ if (m == n)
+ break;
}
//assert(0 && "no head found on stack");
}
}
//assert(0 && "no head found on stack");
}
num = (unsigned)PTR_TO_INT(entry->value);
}
return num;
num = (unsigned)PTR_TO_INT(entry->value);
}
return num;
/**
* Map a given Type to void by assigned the type number 0.
/**
* Map a given Type to void by assigned the type number 0.
(void) h;
be_emit_irprintf("\t.stabs\t\"void:t%u=%u\",%d,0,0,0\n", 0, 0, N_LSYM);
be_emit_write_line();
(void) h;
be_emit_irprintf("\t.stabs\t\"void:t%u=%u\",%d,0,0,0\n", 0, 0, N_LSYM);
be_emit_write_line();
typedef struct walker_env {
stabs_handle *h;
typedef struct walker_env {
stabs_handle *h;
Ignore it here as it's name is remapped to "void". */
map_to_void(h, tp);
return;
Ignore it here as it's name is remapped to "void". */
map_to_void(h, tp);
return;
#if 0
if (get_mode_size_bits(mode) & 7) {
/* this is a bitfield type, ignore it */
return;
#if 0
if (get_mode_size_bits(mode) & 7) {
/* this is a bitfield type, ignore it */
return;
#endif
type_num = get_type_number(h, tp);
#endif
type_num = get_type_number(h, tp);
be_emit_irprintf(":t%u=r1;%d;0;\",%d,0,0,0\n", type_num, size, N_LSYM);
be_emit_write_line();
}
be_emit_irprintf(":t%u=r1;%d;0;\",%d,0,0,0\n", type_num, size, N_LSYM);
be_emit_write_line();
}
-} /* gen_primitive_type */
/**
* Generates an enum type
/**
* Generates an enum type
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
/**
* print a pointer type
/**
* print a pointer type
print_pointer_type(h, tp, 0);
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
print_pointer_type(h, tp, 0);
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
-} /* gen_pointer_type */
/**
* print an array type
/**
* print an array type
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
/**
* Generates a struct/union type
/**
* Generates a struct/union type
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
}
be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
/**
* Generates a method type
/**
* Generates a method type
}
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
}
be_emit_irprintf("\",%d,0,0,0\n", N_LSYM);
be_emit_write_line();
/**
* type-walker: generate declaration for simple types,
/**
* type-walker: generate declaration for simple types,
switch (get_type_tpop_code(tp)) {
case tpo_class:
switch (get_type_tpop_code(tp)) {
case tpo_class:
break;
default:
assert(! "Unknown tpop code");
break;
default:
assert(! "Unknown tpop code");
- } /* switch */
-} /* walk_type */
/**
* generate declaration for all types
/**
* generate declaration for all types
break;
default:
assert(! "Unknown tpop code");
break;
default:
assert(! "Unknown tpop code");
- } /* switch */
- } /* while */
-} /* finish_types */
/**
* generate all types.
/**
* generate all types.
finish_types(&env);
del_waitq(env.wq);
finish_types(&env);
del_waitq(env.wq);
/* -------------------------- I/F ----------------------------- */
/* -------------------------- I/F ----------------------------- */
be_emit_irprintf("\",%d,0,0,%d\n", N_PSYM, ofs);
be_emit_write_line();
}
be_emit_irprintf("\",%d,0,0,%d\n", N_PSYM, ofs);
be_emit_write_line();
}
-} /* stabs_method_begin */
/**
* dump the stabs for a method end
/**
* dump the stabs for a method end
h->cur_ent = NULL;
h->layout = NULL;
h->cur_ent = NULL;
h->layout = NULL;
-} /* stabs_method_end */
h->next_type_nr++;
gen_void_type(h);
gen_types(h);
h->next_type_nr++;
gen_void_type(h);
gen_types(h);
/**
* dump a variable in the global type
/**
* dump a variable in the global type
buf[sizeof(buf) - 1] = '\0';
be_emit_string(buf);
buf[sizeof(buf) - 1] = '\0';
be_emit_string(buf);
/**
* Close the stabs handler.
/**
* Close the stabs handler.
stabs_handle *h = (stabs_handle *)handle;
pmap_destroy(h->type_map);
free(h);
stabs_handle *h = (stabs_handle *)handle;
pmap_destroy(h->type_map);
free(h);
/** The stabs operations. */
static const debug_ops stabs_ops = {
/** The stabs operations. */
static const debug_ops stabs_ops = {
static int x87_get_depth(const x87_state *state)
{
return state->depth;
static int x87_get_depth(const x87_state *state)
{
return state->depth;
/**
* Return the virtual register index at st(pos).
/**
* Return the virtual register index at st(pos).
{
assert(pos < state->depth);
return state->st[MASK_TOS(state->tos + pos)].reg_idx;
{
assert(pos < state->depth);
return state->st[MASK_TOS(state->tos + pos)].reg_idx;
{
assert(pos < state->depth);
return state->st[MASK_TOS(state->tos + pos)].node;
{
assert(pos < state->depth);
return state->st[MASK_TOS(state->tos + pos)].node;
/**
* Dump the stack for debugging.
/**
* Dump the stack for debugging.
x87_get_st_node(state, i)));
}
DB((dbg, LEVEL_2, "<-- TOS\n"));
x87_get_st_node(state, i)));
}
DB((dbg, LEVEL_2, "<-- TOS\n"));
#endif /* DEBUG_libfirm */
/**
#endif /* DEBUG_libfirm */
/**
DB((dbg, LEVEL_2, "After SET_REG: "));
DEBUG_ONLY(x87_dump_stack(state);)
DB((dbg, LEVEL_2, "After SET_REG: "));
DEBUG_ONLY(x87_dump_stack(state);)
/**
* Set the tos virtual register.
/**
* Set the tos virtual register.
static void x87_set_tos(x87_state *state, int reg_idx, ir_node *node)
{
x87_set_st(state, reg_idx, node, 0);
static void x87_set_tos(x87_state *state, int reg_idx, ir_node *node)
{
x87_set_st(state, reg_idx, node, 0);
/**
* Swap st(0) with st(pos).
/**
* Swap st(0) with st(pos).
DB((dbg, LEVEL_2, "After FXCH: "));
DEBUG_ONLY(x87_dump_stack(state);)
DB((dbg, LEVEL_2, "After FXCH: "));
DEBUG_ONLY(x87_dump_stack(state);)
/**
* Convert a virtual register to the stack index.
/**
* Convert a virtual register to the stack index.
if (state->st[MASK_TOS(tos + i)].reg_idx == reg_idx)
return i;
return -1;
if (state->st[MASK_TOS(tos + i)].reg_idx == reg_idx)
return i;
return -1;
/**
* Push a virtual Register onto the stack, double pushed allowed.
/**
* Push a virtual Register onto the stack, double pushed allowed.
state->st[state->tos].node = node;
DB((dbg, LEVEL_2, "After PUSH: ")); DEBUG_ONLY(x87_dump_stack(state);)
state->st[state->tos].node = node;
DB((dbg, LEVEL_2, "After PUSH: ")); DEBUG_ONLY(x87_dump_stack(state);)
/**
* Push a virtual Register onto the stack, double pushes are NOT allowed.
/**
* Push a virtual Register onto the stack, double pushes are NOT allowed.
assert(x87_on_stack(state, reg_idx) == -1 && "double push");
x87_push_dbl(state, reg_idx, node);
assert(x87_on_stack(state, reg_idx) == -1 && "double push");
x87_push_dbl(state, reg_idx, node);
/**
* Pop a virtual Register from the stack.
/**
* Pop a virtual Register from the stack.
state->tos = MASK_TOS(state->tos + 1);
DB((dbg, LEVEL_2, "After POP: ")); DEBUG_ONLY(x87_dump_stack(state);)
state->tos = MASK_TOS(state->tos + 1);
DB((dbg, LEVEL_2, "After POP: ")); DEBUG_ONLY(x87_dump_stack(state);)
/**
* Empty the fpu stack
/**
* Empty the fpu stack
}
return PTR_TO_BLKSTATE(entry->value);
}
return PTR_TO_BLKSTATE(entry->value);
-} /* x87_get_bl_state */
/**
* Creates a new x87 state.
/**
* Creates a new x87 state.
res->sim = sim;
return res;
res->sim = sim;
return res;
/**
* Patch a virtual instruction into a x87 one and return
/**
* Patch a virtual instruction into a x87 one and return
} else if (mode_is_float(mode))
set_irn_mode(n, ia32_reg_classes[CLASS_ia32_st].mode);
return res;
} else if (mode_is_float(mode))
set_irn_mode(n, ia32_reg_classes[CLASS_ia32_st].mode);
return res;
/**
* Returns the first Proj of a mode_T node having a given mode.
/**
* Returns the first Proj of a mode_T node having a given mode.
-} /* get_irn_Proj_for_mode */
/**
* Wrap the arch_* function here so we can check for errors.
/**
* Wrap the arch_* function here so we can check for errors.
assert(res->reg_class == &ia32_reg_classes[CLASS_ia32_vfp]);
return res;
assert(res->reg_class == &ia32_reg_classes[CLASS_ia32_vfp]);
return res;
-} /* x87_get_irn_register */
static inline const arch_register_t *x87_irn_get_register(const ir_node *irn,
int pos)
static inline const arch_register_t *x87_irn_get_register(const ir_node *irn,
int pos)
assert(res->reg_class == &ia32_reg_classes[CLASS_ia32_vfp]);
return res;
assert(res->reg_class == &ia32_reg_classes[CLASS_ia32_vfp]);
return res;
-} /* x87_irn_get_register */
static inline const arch_register_t *get_st_reg(int index)
{
static inline const arch_register_t *get_st_reg(int index)
{
x87_fxch(state, pos);
return fxch;
x87_fxch(state, pos);
return fxch;
-} /* x87_fxch_shuffle */
/**
* Calculate the necessary permutations to reach dst_state.
/**
* Calculate the necessary permutations to reach dst_state.
/**
* Create a fxch node before another node.
/**
* Create a fxch node before another node.
sched_add_before(n, fxch);
DB((dbg, LEVEL_1, "<<< %s %s, %s\n", get_irn_opname(fxch), attr->x87[0]->name, attr->x87[2]->name));
return fxch;
sched_add_before(n, fxch);
DB((dbg, LEVEL_1, "<<< %s %s, %s\n", get_irn_opname(fxch), attr->x87[0]->name, attr->x87[2]->name));
return fxch;
/**
* Create a fpush before node n.
/**
* Create a fpush before node n.
sched_add_before(n, fpush);
DB((dbg, LEVEL_1, "<<< %s %s, %s\n", get_irn_opname(fpush), attr->x87[0]->name, attr->x87[2]->name));
sched_add_before(n, fpush);
DB((dbg, LEVEL_1, "<<< %s %s, %s\n", get_irn_opname(fpush), attr->x87[0]->name, attr->x87[2]->name));
-} /* x87_create_fpush */
/**
* Create a fpop before node n.
/**
* Create a fpop before node n.
DB((dbg, LEVEL_1, "<<< %s %s\n", get_irn_opname(fpop), attr->x87[0]->name));
} while (--num > 0);
return fpop;
DB((dbg, LEVEL_1, "<<< %s %s\n", get_irn_opname(fpop), attr->x87[0]->name));
} while (--num > 0);
return fpop;
/* --------------------------------- liveness ------------------------------------------ */
/* --------------------------------- liveness ------------------------------------------ */
-} /* vfp_liveness_transfer */
/**
* Put all live virtual registers at the end of a block into a bitset.
/**
* Put all live virtual registers at the end of a block into a bitset.
-} /* vfp_liveness_end_of_block */
/** get the register mask from an arch_register */
#define REGMASK(reg) (1 << (arch_register_get_index(reg)))
/** get the register mask from an arch_register */
#define REGMASK(reg) (1 << (arch_register_get_index(reg)))
assert(idx < sim->n_idx);
return sim->live[idx] & ~kill;
assert(idx < sim->n_idx);
return sim->live[idx] & ~kill;
-} /* vfp_live_args_after */
/**
* Calculate the liveness for a whole block and cache it.
/**
* Calculate the liveness for a whole block and cache it.
}
idx = get_irn_idx(block);
sim->live[idx] = live;
}
idx = get_irn_idx(block);
sim->live[idx] = live;
/**
* Returns true if a register is live in a set.
/**
* Returns true if a register is live in a set.
}
}
DB((dbg, LEVEL_2, "\n"));
}
}
DB((dbg, LEVEL_2, "\n"));
#endif /* DEBUG_libfirm */
/* --------------------------------- simulators ---------------------------------------- */
#endif /* DEBUG_libfirm */
/* --------------------------------- simulators ---------------------------------------- */
/**
* Simulate a virtual Unop.
/**
* Simulate a virtual Unop.
DB((dbg, LEVEL_1, "<<< %s -> %s\n", get_irn_opname(n), out->name));
return NO_NODE_ADDED;
DB((dbg, LEVEL_1, "<<< %s -> %s\n", get_irn_opname(n), out->name));
return NO_NODE_ADDED;
/**
* Simulate a virtual Load instruction.
/**
* Simulate a virtual Load instruction.
DB((dbg, LEVEL_1, "<<< %s -> %s\n", get_irn_opname(n), arch_register_get_name(out)));
return NO_NODE_ADDED;
DB((dbg, LEVEL_1, "<<< %s -> %s\n", get_irn_opname(n), arch_register_get_name(out)));
return NO_NODE_ADDED;
/**
* Rewire all users of @p old_val to @new_val iff they are scheduled after @p store.
/**
* Rewire all users of @p old_val to @new_val iff they are scheduled after @p store.
-} /* collect_and_rewire_users */
/**
* Simulate a virtual Store.
/**
* Simulate a virtual Store.
DB((dbg, LEVEL_1, "<<< %s %s ->\n", get_irn_opname(n), arch_register_get_name(op2)));
return insn;
DB((dbg, LEVEL_1, "<<< %s %s ->\n", get_irn_opname(n), arch_register_get_name(op2)));
return insn;
#define _GEN_BINOP(op, rev) \
static int sim_##op(x87_state *state, ir_node *n) { \
#define _GEN_BINOP(op, rev) \
static int sim_##op(x87_state *state, ir_node *n) { \
DB((dbg, LEVEL_1, "<<< %s %s ->\n", get_irn_opname(n), arch_register_get_name(op2)));
return NO_NODE_ADDED;
DB((dbg, LEVEL_1, "<<< %s %s ->\n", get_irn_opname(n), arch_register_get_name(op2)));
return NO_NODE_ADDED;
/**
* Simulate a virtual FtstFnstsw.
/**
* Simulate a virtual FtstFnstsw.
x87_create_fpop(state, sched_next(n), 1);
return NO_NODE_ADDED;
x87_create_fpop(state, sched_next(n), 1);
return NO_NODE_ADDED;
DEBUG_ONLY(x87_dump_stack(state);)
return NO_NODE_ADDED;
DEBUG_ONLY(x87_dump_stack(state);)
return NO_NODE_ADDED;
/**
* Keep the given node alive by adding a be_Keep.
/**
* Keep the given node alive by adding a be_Keep.
arch_set_irn_register(res, out);
return res;
arch_set_irn_register(res, out);
return res;
/**
* Simulate a be_Copy.
/**
* Simulate a be_Copy.
}
}
return NO_NODE_ADDED;
}
}
return NO_NODE_ADDED;
/**
* Returns the vf0 result Proj of a Call.
/**
* Returns the vf0 result Proj of a Call.
-} /* get_call_result_proj */
/**
* Simulate a ia32_Call.
/**
* Simulate a ia32_Call.
DEBUG_ONLY(x87_dump_stack(state);)
return NO_NODE_ADDED;
DEBUG_ONLY(x87_dump_stack(state);)
return NO_NODE_ADDED;
/**
* Simulate a be_Return.
/**
* Simulate a be_Return.
x87_pop(state);
return NO_NODE_ADDED;
x87_pop(state);
return NO_NODE_ADDED;
typedef struct perm_data_t {
const arch_register_t *in;
typedef struct perm_data_t {
const arch_register_t *in;
DB((dbg, LEVEL_1, "<<< %+F\n", irn));
return NO_NODE_ADDED;
DB((dbg, LEVEL_1, "<<< %+F\n", irn));
return NO_NODE_ADDED;
/**
* Kill any dead registers at block start by popping them from the stack.
/**
* Kill any dead registers at block start by popping them from the stack.
keep_alive(keep);
}
return state;
keep_alive(keep);
}
return state;
/**
* Run a simulation and fix all virtual instructions for a block.
/**
* Run a simulation and fix all virtual instructions for a block.
}
}
bl_state->end = state;
}
}
bl_state->end = state;
-} /* x87_simulate_block */
/**
* Register a simulator function.
/**
* Register a simulator function.
{
assert(op->ops.generic == NULL);
op->ops.generic = (op_func) func;
{
assert(op->ops.generic == NULL);
op->ops.generic = (op_func) func;
/**
* Create a new x87 simulator.
/**
* Create a new x87 simulator.
register_sim(op_be_Return, sim_Return);
register_sim(op_be_Perm, sim_Perm);
register_sim(op_be_Keep, sim_Keep);
register_sim(op_be_Return, sim_Return);
register_sim(op_be_Perm, sim_Perm);
register_sim(op_be_Keep, sim_Keep);
-} /* x87_init_simulator */
/**
* Destroy a x87 simulator.
/**
* Destroy a x87 simulator.
pmap_destroy(sim->blk_states);
obstack_free(&sim->obst, NULL);
DB((dbg, LEVEL_1, "x87 Simulator stopped\n\n"));
pmap_destroy(sim->blk_states);
obstack_free(&sim->obst, NULL);
DB((dbg, LEVEL_1, "x87 Simulator stopped\n\n"));
-} /* x87_destroy_simulator */
/**
* Pre-block walker: calculate the liveness information for the block
/**
* Pre-block walker: calculate the liveness information for the block
{
x87_simulator *sim = (x87_simulator*)data;
update_liveness(sim, block);
{
x87_simulator *sim = (x87_simulator*)data;
update_liveness(sim, block);
-} /* update_liveness_walker */
/*
* Run a simulation and fix all virtual instructions for a graph.
/*
* Run a simulation and fix all virtual instructions for a graph.
/* kill it */
del_waitq(sim.worklist);
x87_destroy_simulator(&sim);
/* kill it */
del_waitq(sim.worklist);
x87_destroy_simulator(&sim);
-} /* ia32_x87_simulate_graph */
/* Initializes the x87 simulator. */
void ia32_init_x87(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.ia32.x87");
/* Initializes the x87 simulator. */
void ia32_init_x87(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.ia32.x87");
firm_kind get_kind(const void *firm_thing)
{
return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD;
firm_kind get_kind(const void *firm_thing)
{
return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD;
}
static void dump_node_ana_vals(FILE *F, ir_node *n)
}
static void dump_node_ana_vals(FILE *F, ir_node *n)
}
void dump_type_node(FILE *F, ir_type *tp)
}
void dump_type_node(FILE *F, ir_type *tp)
break; /* case k_type */
}
default:
printf(" *** irdump, dump_type_info(l.%i), faulty type.\n", __LINE__);
break; /* case k_type */
}
default:
printf(" *** irdump, dump_type_info(l.%i), faulty type.\n", __LINE__);
- } /* switch kind_or_entity */
}
/** For dumping class hierarchies.
}
/** For dumping class hierarchies.
break; /* case k_type */
}
default:
printf(" *** irdump, dump_class_hierarchy_node(l.%i), faulty type.\n", __LINE__);
break; /* case k_type */
}
default:
printf(" *** irdump, dump_class_hierarchy_node(l.%i), faulty type.\n", __LINE__);
- } /* switch kind_or_entity */
}
/*******************************************************************/
}
/*******************************************************************/
}
edge_change_cnt(tgt, kind, +1);
}
edge_change_cnt(tgt, kind, +1);
#ifndef DEBUG_libfirm
/* verify list heads */
#ifndef DEBUG_libfirm
/* verify list heads */
h = 9*h + HASH_PTR(get_irn_op(node));
return h;
h = 9*h + HASH_PTR(get_irn_op(node));
return h;
-} /* firm_default_hash */
/* include generated code */
#include "gen_irnode.c.inl"
/* include generated code */
#include "gen_irnode.c.inl"
static inline dbg_info *_get_irn_dbg_info(const ir_node *n) {
return n->dbi;
static inline dbg_info *_get_irn_dbg_info(const ir_node *n) {
return n->dbi;
-} /* get_irn_dbg_info */
static inline void _set_irn_dbg_info(ir_node *n, dbg_info *db) {
n->dbi = db;
static inline void _set_irn_dbg_info(ir_node *n, dbg_info *db) {
n->dbi = db;
ops->copy_attr = default_copy_attr;
}
return ops;
ops->copy_attr = default_copy_attr;
}
return ops;
-} /* firm_set_default_copy_attr */
/* Creates a new ir operation. */
ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
/* Creates a new ir operation. */
ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
hook_new_ir_op(res);
return res;
hook_new_ir_op(res);
return res;
void free_ir_op(ir_op *code)
{
void free_ir_op(ir_op *code)
{
remove_irp_opcode(code);
free(code);
remove_irp_opcode(code);
free(code);
void ir_op_set_fragile_indices(ir_op *op, int fragile_mem_index,
int pn_x_regular, int pn_x_except)
void ir_op_set_fragile_indices(ir_op *op, int fragile_mem_index,
int pn_x_regular, int pn_x_except)
const char *get_op_name (const ir_op *op)
{
return get_id_str(op->name);
const char *get_op_name (const ir_op *op)
{
return get_id_str(op->name);
unsigned (get_op_code)(const ir_op *op)
{
return _get_op_code(op);
unsigned (get_op_code)(const ir_op *op)
{
return _get_op_code(op);
ident *(get_op_ident)(const ir_op *op)
{
return _get_op_ident(op);
ident *(get_op_ident)(const ir_op *op)
{
return _get_op_ident(op);
const char *get_op_pin_state_name(op_pin_state s)
{
const char *get_op_pin_state_name(op_pin_state s)
{
#undef XXX
}
return "<none>";
#undef XXX
}
return "<none>";
-} /* get_op_pin_state_name */
op_pin_state (get_op_pinned)(const ir_op *op)
{
return _get_op_pinned(op);
op_pin_state (get_op_pinned)(const ir_op *op)
{
return _get_op_pinned(op);
/* Sets op_pin_state_pinned in the opcode. Setting it to floating has no effect
for Phi, Block and control flow nodes. */
/* Sets op_pin_state_pinned in the opcode. Setting it to floating has no effect
for Phi, Block and control flow nodes. */
{
if (op == op_Block || op == op_Phi || is_op_cfopcode(op)) return;
op->pin_state = pinned;
{
if (op == op_Block || op == op_Phi || is_op_cfopcode(op)) return;
op->pin_state = pinned;
/* retrieve the next free opcode */
unsigned get_next_ir_opcode(void)
{
return next_iro++;
/* retrieve the next free opcode */
unsigned get_next_ir_opcode(void)
{
return next_iro++;
-} /* get_next_ir_opcode */
/* Returns the next free n IR opcode number, allows to register a bunch of user ops */
unsigned get_next_ir_opcodes(unsigned num)
/* Returns the next free n IR opcode number, allows to register a bunch of user ops */
unsigned get_next_ir_opcodes(unsigned num)
unsigned base = next_iro;
next_iro += num;
return base;
unsigned base = next_iro;
next_iro += num;
return base;
-} /* get_next_ir_opcodes */
/* Returns the generic function pointer from an ir operation. */
op_func (get_generic_function_ptr)(const ir_op *op)
{
return _get_generic_function_ptr(op);
/* Returns the generic function pointer from an ir operation. */
op_func (get_generic_function_ptr)(const ir_op *op)
{
return _get_generic_function_ptr(op);
-} /* get_generic_function_ptr */
/* Store a generic function pointer into an ir operation. */
void (set_generic_function_ptr)(ir_op *op, op_func func)
{
_set_generic_function_ptr(op, func);
/* Store a generic function pointer into an ir operation. */
void (set_generic_function_ptr)(ir_op *op, op_func func)
{
_set_generic_function_ptr(op, func);
-} /* set_generic_function_ptr */
/* Returns the ir_op_ops of an ir_op. */
const ir_op_ops *(get_op_ops)(const ir_op *op)
{
return _get_op_ops(op);
/* Returns the ir_op_ops of an ir_op. */
const ir_op_ops *(get_op_ops)(const ir_op *op)
{
return _get_op_ops(op);
irop_flags get_op_flags(const ir_op *op)
{
irop_flags get_op_flags(const ir_op *op)
{
static ir_tarval *computed_value_Const(const ir_node *n)
{
return get_Const_tarval(n);
static ir_tarval *computed_value_Const(const ir_node *n)
{
return get_Const_tarval(n);
-} /* computed_value_Const */
/**
* Return the value of a 'sizeof', 'alignof' or 'offsetof' SymConst.
/**
* Return the value of a 'sizeof', 'alignof' or 'offsetof' SymConst.
break;
}
return tarval_bad;
break;
}
return tarval_bad;
-} /* computed_value_SymConst */
/**
* Return the value of an Add.
/**
* Return the value of an Add.
-} /* computed_value_Add */
/**
* Return the value of a Sub.
/**
* Return the value of a Sub.
return tarval_sub(ta, tb, mode);
return tarval_bad;
return tarval_sub(ta, tb, mode);
return tarval_bad;
-} /* computed_value_Sub */
/**
* Return the value of a Carry.
/**
* Return the value of a Carry.
return get_mode_null(m);
}
return tarval_bad;
return get_mode_null(m);
}
return tarval_bad;
-} /* computed_value_Carry */
/**
* Return the value of a Borrow.
/**
* Return the value of a Borrow.
return get_mode_null(m);
}
return tarval_bad;
return get_mode_null(m);
}
return tarval_bad;
-} /* computed_value_Borrow */
/**
* Return the value of an unary Minus.
/**
* Return the value of an unary Minus.
return tarval_neg(ta);
return tarval_bad;
return tarval_neg(ta);
return tarval_bad;
-} /* computed_value_Minus */
/**
* Return the value of a Mul.
/**
* Return the value of a Mul.
-} /* computed_value_Mul */
/**
* Return the value of an And.
/**
* Return the value of an And.
-} /* computed_value_And */
/**
* Return the value of an Or.
/**
* Return the value of an Or.
return get_mode_all_one(get_irn_mode(n));
}
return tarval_bad;
return get_mode_all_one(get_irn_mode(n));
}
return tarval_bad;
-} /* computed_value_Or */
/**
* Return the value of an Eor.
/**
* Return the value of an Eor.
return tarval_eor(ta, tb);
}
return tarval_bad;
return tarval_eor(ta, tb);
}
return tarval_bad;
-} /* computed_value_Eor */
/**
* Return the value of a Not.
/**
* Return the value of a Not.
return tarval_not(ta);
return tarval_bad;
return tarval_not(ta);
return tarval_bad;
-} /* computed_value_Not */
/**
* Tests whether a shift shifts more bits than available in the mode
/**
* Tests whether a shift shifts more bits than available in the mode
return get_mode_null(get_irn_mode(n));
return tarval_bad;
return get_mode_null(get_irn_mode(n));
return tarval_bad;
-} /* computed_value_Shl */
/**
* Return the value of a Shr.
/**
* Return the value of a Shr.
return get_mode_null(get_irn_mode(n));
return tarval_bad;
return get_mode_null(get_irn_mode(n));
return tarval_bad;
-} /* computed_value_Shr */
/**
* Return the value of a Shrs.
/**
* Return the value of a Shrs.
return tarval_shrs(ta, tb);
}
return tarval_bad;
return tarval_shrs(ta, tb);
}
return tarval_bad;
-} /* computed_value_Shrs */
/**
* Return the value of a Rotl.
/**
* Return the value of a Rotl.
return tarval_rotl(ta, tb);
}
return tarval_bad;
return tarval_rotl(ta, tb);
}
return tarval_bad;
-} /* computed_value_Rotl */
bool ir_zero_when_converted(const ir_node *node, ir_mode *dest_mode)
{
bool ir_zero_when_converted(const ir_node *node, ir_mode *dest_mode)
{
return get_mode_null(mode);
return tarval_bad;
return get_mode_null(mode);
return tarval_bad;
-} /* computed_value_Conv */
/**
* Calculate the value of a Mux: can be evaluated, if the
/**
* Calculate the value of a Mux: can be evaluated, if the
return value_of(v);
}
return tarval_bad;
return value_of(v);
}
return tarval_bad;
-} /* computed_value_Mux */
/**
* Calculate the value of a Confirm: can be evaluated,
/**
* Calculate the value of a Confirm: can be evaluated,
return tv;
}
return value_of(get_Confirm_value(n));
return tv;
}
return value_of(get_Confirm_value(n));
-} /* computed_value_Confirm */
/**
* gives a (conservative) estimation of possible relation when comparing
/**
* gives a (conservative) estimation of possible relation when comparing
if (ta != tarval_bad && tb != tarval_bad)
return tarval_div(ta, tb);
return tarval_bad;
if (ta != tarval_bad && tb != tarval_bad)
return tarval_div(ta, tb);
return tarval_bad;
-} /* do_computed_value_Div */
/**
* Calculate the value of an integer Mod of two nodes.
/**
* Calculate the value of an integer Mod of two nodes.
if (ta != tarval_bad && tb != tarval_bad)
return tarval_mod(ta, tb);
return tarval_bad;
if (ta != tarval_bad && tb != tarval_bad)
return tarval_mod(ta, tb);
return tarval_bad;
-} /* do_computed_value_Mod */
/**
* Return the value of a Proj(Div).
/**
* Return the value of a Proj(Div).
return tarval_bad;
return do_computed_value_Div(get_Proj_pred(n));
return tarval_bad;
return do_computed_value_Div(get_Proj_pred(n));
-} /* computed_value_Proj_Div */
/**
* Return the value of a Proj(Mod).
/**
* Return the value of a Proj(Mod).
return do_computed_value_Mod(get_Mod_left(mod), get_Mod_right(mod));
}
return tarval_bad;
return do_computed_value_Mod(get_Mod_left(mod), get_Mod_right(mod));
}
return tarval_bad;
-} /* computed_value_Proj_Mod */
/**
* Return the value of a Proj.
/**
* Return the value of a Proj.
if (n->op->ops.computed_value_Proj != NULL)
return n->op->ops.computed_value_Proj(proj);
return tarval_bad;
if (n->op->ops.computed_value_Proj != NULL)
return n->op->ops.computed_value_Proj(proj);
return tarval_bad;
-} /* computed_value_Proj */
/**
* If the parameter n can be computed, return its value, else tarval_bad.
/**
* If the parameter n can be computed, return its value, else tarval_bad.
if (n->op->ops.computed_value)
return n->op->ops.computed_value(n);
return tarval_bad;
if (n->op->ops.computed_value)
return n->op->ops.computed_value(n);
return tarval_bad;
/**
* Set the default computed_value evaluator in an ir_op_ops.
/**
* Set the default computed_value evaluator in an ir_op_ops.
return ops;
#undef CASE_PROJ
#undef CASE
return ops;
#undef CASE_PROJ
#undef CASE
-} /* firm_set_default_computed_value */
/**
* Optimize operations that are commutative and have neutral 0,
/**
* Optimize operations that are commutative and have neutral 0,
-} /* equivalent_node_neutral_zero */
/**
* Eor is commutative and has neutral 0.
/**
* Eor is commutative and has neutral 0.
-} /* equivalent_node_Add */
/**
* optimize operations that are not commutative but have neutral 0 on left,
/**
* optimize operations that are not commutative but have neutral 0 on left,
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_0);
}
return n;
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_0);
}
return n;
-} /* equivalent_node_left_zero */
#define equivalent_node_Shl equivalent_node_left_zero
#define equivalent_node_Shr equivalent_node_left_zero
#define equivalent_node_Shl equivalent_node_left_zero
#define equivalent_node_Shr equivalent_node_left_zero
-} /* equivalent_node_Sub */
DBG_OPT_ALGSIM2(oldn, pred, n, FS_OPT_IDEM_UNARY);
}
return n;
DBG_OPT_ALGSIM2(oldn, pred, n, FS_OPT_IDEM_UNARY);
}
return n;
-} /* equivalent_node_idempotent_unop */
/** Optimize Not(Not(x)) == x. */
#define equivalent_node_Not equivalent_node_idempotent_unop
/** Optimize Not(Not(x)) == x. */
#define equivalent_node_Not equivalent_node_idempotent_unop
-} /* equivalent_node_Mul */
/**
* Use algebraic simplification a | a = a | 0 = 0 | a = a.
/**
* Use algebraic simplification a | a = a | 0 = 0 | a = a.
-} /* equivalent_node_Or */
/**
* Optimize a & 0b1...1 = 0b1...1 & a = a & a = (a|X) & a = a.
/**
* Optimize a & 0b1...1 = 0b1...1 & a = a & a = (a|X) & a = a.
-} /* equivalent_node_And */
/**
* Try to remove useless Conv's:
/**
* Try to remove useless Conv's:
-} /* equivalent_node_Conv */
/**
* - fold Phi-nodes, iff they have only one predecessor except
/**
* - fold Phi-nodes, iff they have only one predecessor except
DBG_OPT_PHI(oldn, n);
}
return n;
DBG_OPT_PHI(oldn, n);
}
return n;
-} /* equivalent_node_Phi */
/**
* Optimize Proj(Tuple).
/**
* Optimize Proj(Tuple).
DBG_OPT_TUPLE(oldn, tuple, proj);
return proj;
DBG_OPT_TUPLE(oldn, tuple, proj);
return proj;
-} /* equivalent_node_Proj_Tuple */
/**
* Optimize a / 1 = a.
/**
* Optimize a / 1 = a.
-} /* equivalent_node_Proj_Div */
/**
* Optimize CopyB(mem, x, x) into a Nop.
/**
* Optimize CopyB(mem, x, x) into a Nop.
-} /* equivalent_node_Proj_CopyB */
/**
* Optimize Bounds(idx, idx, upper) into idx.
/**
* Optimize Bounds(idx, idx, upper) into idx.
-} /* equivalent_node_Proj_Bound */
/**
* Does all optimizations on nodes that must be done on its Projs
/**
* Does all optimizations on nodes that must be done on its Projs
if (n->op->ops.equivalent_node_Proj)
return n->op->ops.equivalent_node_Proj(proj);
return proj;
if (n->op->ops.equivalent_node_Proj)
return n->op->ops.equivalent_node_Proj(proj);
return proj;
-} /* equivalent_node_Proj */
DBG_OPT_ID(oldn, n);
return n;
DBG_OPT_ID(oldn, n);
return n;
-} /* equivalent_node_Id */
if (n->op->ops.equivalent_node)
return n->op->ops.equivalent_node(n);
return n;
if (n->op->ops.equivalent_node)
return n->op->ops.equivalent_node(n);
return n;
/**
* Sets the default equivalent node operation for an ir_op_ops.
/**
* Sets the default equivalent node operation for an ir_op_ops.
return ops;
#undef CASE
#undef CASE_PROJ
return ops;
#undef CASE
#undef CASE_PROJ
-} /* firm_set_default_equivalent_node */
/**
* Returns non-zero if a node is a Phi node
/**
* Returns non-zero if a node is a Phi node
typedef ir_tarval *(*tarval_sub_type)(ir_tarval *a, ir_tarval *b, ir_mode *mode);
typedef ir_tarval *(*tarval_binop_type)(ir_tarval *a, ir_tarval *b);
typedef ir_tarval *(*tarval_sub_type)(ir_tarval *a, ir_tarval *b, ir_mode *mode);
typedef ir_tarval *(*tarval_binop_type)(ir_tarval *a, ir_tarval *b);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_binop_on_phi */
/**
* Apply an evaluator on a binop with two constant Phi.
/**
* Apply an evaluator on a binop with two constant Phi.
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(a), n, (ir_node **)res, mode);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(a), n, (ir_node **)res, mode);
-} /* apply_binop_on_2_phis */
/**
* Apply an evaluator on a unop with a constant operator (a Phi).
/**
* Apply an evaluator on a unop with a constant operator (a Phi).
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_unop_on_phi */
/**
* Apply a conversion on a constant operator (a Phi).
/**
* Apply a conversion on a constant operator (a Phi).
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_conv_on_phi */
/**
* Transform AddP(P, ConvIs(Iu)), AddP(P, ConvIu(Is)) and
/**
* Transform AddP(P, ConvIs(Iu)), AddP(P, ConvIu(Is)) and
-} /* transform_node_AddSub */
#define HANDLE_BINOP_PHI(eval, a, b, c, mode) \
do { \
#define HANDLE_BINOP_PHI(eval, a, b, c, mode) \
do { \
-} /* transform_node_Add */
/**
* returns -cnst or NULL if impossible
/**
* returns -cnst or NULL if impossible
-} /* transform_node_Sub */
/**
* Several transformation done on n*n=2n bits mul.
/**
* Several transformation done on n*n=2n bits mul.
}
}
return arch_dep_replace_mul_with_shifts(n);
}
}
return arch_dep_replace_mul_with_shifts(n);
-} /* transform_node_Mul */
/**
* Transform a Div Node.
/**
* Transform a Div Node.
set_Tuple_pred(n, pn_Div_res, value);
}
return n;
set_Tuple_pred(n, pn_Div_res, value);
}
return n;
-} /* transform_node_Div */
/**
* Transform a Mod node.
/**
* Transform a Mod node.
set_Tuple_pred(n, pn_Mod_res, value);
}
return n;
set_Tuple_pred(n, pn_Mod_res, value);
}
return n;
-} /* transform_node_Mod */
/**
* Transform a Cond node.
/**
* Transform a Cond node.
clear_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_CODE);
}
return n;
clear_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_CODE);
}
return n;
-} /* transform_node_Cond */
/**
* Prototype of a recursive transform function
/**
* Prototype of a recursive transform function
n = transform_node_bitop_shift(n);
return n;
n = transform_node_bitop_shift(n);
return n;
-} /* transform_node_And */
/* the order of the values is important! */
typedef enum const_class {
/* the order of the values is important! */
typedef enum const_class {
n = transform_node_bitop_shift(n);
return n;
n = transform_node_bitop_shift(n);
return n;
-} /* transform_node_Eor */
-} /* transform_node_Minus */
/**
* Transform a Proj(Load) with a non-null address.
/**
* Transform a Proj(Load) with a non-null address.
-} /* transform_node_Proj_Load */
/**
* Transform a Proj(Store) with a non-null address.
/**
* Transform a Proj(Store) with a non-null address.
-} /* transform_node_Proj_Store */
/**
* Transform a Proj(Div) with a non-zero value.
/**
* Transform a Proj(Div) with a non-zero value.
-} /* transform_node_Proj_Div */
/**
* Transform a Proj(Mod) with a non-zero value.
/**
* Transform a Proj(Mod) with a non-zero value.
-} /* transform_node_Proj_Mod */
/**
* Optimizes jump tables (CondIs or CondIu) by removing all impossible cases.
/**
* Optimizes jump tables (CondIs or CondIu) by removing all impossible cases.
left = get_Eor_left(left);
changed = true;
}
left = get_Eor_left(left);
changed = true;
}
- } /* mode_is_int(...) */
}
/* Cmp(And(1bit, val), 1bit) "bit-testing" can be replaced
}
/* Cmp(And(1bit, val), 1bit) "bit-testing" can be replaced
- } /* == or != */
- } /* mode_is_int */
if (relation == ir_relation_equal || relation == ir_relation_less_greater) {
switch (get_irn_opcode(left)) {
if (relation == ir_relation_equal || relation == ir_relation_less_greater) {
switch (get_irn_opcode(left)) {
DBG_OPT_ALGSIM0(n, n, FS_OPT_CMP_SHF_TO_AND);
}
break;
DBG_OPT_ALGSIM0(n, n, FS_OPT_CMP_SHF_TO_AND);
}
break;
}
if (changedc) { /* need a new Const */
}
if (changedc) { /* need a new Const */
-} /* transform_node_Proj_CopyB */
/**
* Optimize Bounds(idx, idx, upper) into idx.
/**
* Optimize Bounds(idx, idx, upper) into idx.
-} /* transform_node_Proj_Bound */
/**
* Does all optimizations on nodes that must be done on its Projs
/**
* Does all optimizations on nodes that must be done on its Projs
if (n->op->ops.transform_node_Proj)
return n->op->ops.transform_node_Proj(proj);
return proj;
if (n->op->ops.transform_node_Proj)
return n->op->ops.transform_node_Proj(proj);
return proj;
-} /* transform_node_Proj */
/**
* Test whether a block is unreachable
/**
* Test whether a block is unreachable
-} /* get_comm_Binop_Ops */
/**
* Optimize a Or(And(Or(And(v,c4),c3),c2),c1) pattern if possible.
/**
* Optimize a Or(And(Or(And(v,c4),c3),c2),c1) pattern if possible.
-} /* transform_node_Or_bf_store */
/**
* Optimize an Or(shl(x, c), shr(x, bits - c)) into a Rotl
/**
* Optimize an Or(shl(x, c), shr(x, bits - c)) into a Rotl
n = new_r_Rotl(block, x, c1, mode);
DBG_OPT_ALGSIM0(irn_or, n, FS_OPT_OR_SHFT_TO_ROTL);
return n;
n = new_r_Rotl(block, x, c1, mode);
DBG_OPT_ALGSIM0(irn_or, n, FS_OPT_OR_SHFT_TO_ROTL);
return n;
-} /* transform_node_Or_Rotl */
static bool is_cmp_unequal(const ir_node *node)
{
static bool is_cmp_unequal(const ir_node *node)
{
-} /* transform_node_Or */
n = transform_node_shift_bitop(n);
return n;
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shr */
n = transform_node_shift_bitop(n);
return n;
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shrs */
n = transform_node_shift_bitop(n);
return n;
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shl */
n = transform_node_shift_bitop(n);
return n;
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Rotl */
-} /* transform_node_Conv */
/**
* Remove dead blocks and nodes in dead blocks
/**
* Remove dead blocks and nodes in dead blocks
if (j != n_keepalives)
set_End_keepalives(n, j, in);
return n;
if (j != n_keepalives)
set_End_keepalives(n, j, in);
return n;
-} /* transform_node_End */
int ir_is_negated_value(const ir_node *a, const ir_node *b)
{
int ir_is_negated_value(const ir_node *a, const ir_node *b)
{
if (get_irn_pinned(call) == op_pin_state_floats)
set_irn_pinned(res, op_pin_state_floats);
return res;
if (get_irn_pinned(call) == op_pin_state_floats)
set_irn_pinned(res, op_pin_state_floats);
return res;
-} /* transform_node_Call */
/**
* Tries several [inplace] [optimizing] transformations and returns an
/**
* Tries several [inplace] [optimizing] transformations and returns an
} while (oldn != n);
return n;
} while (oldn != n);
return n;
/**
* Sets the default transform node operation for an ir_op_ops.
/**
* Sets the default transform node operation for an ir_op_ops.
#undef CASE_PROJ_EX
#undef CASE_PROJ
#undef CASE
#undef CASE_PROJ_EX
#undef CASE_PROJ
#undef CASE
-} /* firm_set_default_transform_node */
/* **************** Common Subexpression Elimination **************** */
/* **************** Common Subexpression Elimination **************** */
-} /* firm_set_default_node_cmp_attr */
/*
* Compare function for two nodes in the value table. Gets two
/*
* Compare function for two nodes in the value table. Gets two
return a->op->ops.node_cmp_attr(a, b);
return 0;
return a->op->ops.node_cmp_attr(a, b);
return 0;
/*
* Calculate a hash value of a node.
/*
* Calculate a hash value of a node.
unsigned ir_node_hash(const ir_node *node)
{
return node->op->ops.hash(node);
unsigned ir_node_hash(const ir_node *node)
{
return node->op->ops.hash(node);
void new_identities(ir_graph *irg)
void new_identities(ir_graph *irg)
if (irg->value_table != NULL)
del_pset(irg->value_table);
irg->value_table = new_pset(identities_cmp, N_IR_NODES);
if (irg->value_table != NULL)
del_pset(irg->value_table);
irg->value_table = new_pset(identities_cmp, N_IR_NODES);
void del_identities(ir_graph *irg)
{
if (irg->value_table != NULL)
del_pset(irg->value_table);
void del_identities(ir_graph *irg)
{
if (irg->value_table != NULL)
del_pset(irg->value_table);
/* Normalize a node by putting constants (and operands with larger
* node index) on the right (operator side). */
/* Normalize a node by putting constants (and operands with larger
* node index) on the right (operator side). */
-} /* ir_normalize_node */
/*
* Return the canonical node computing the same value as n.
/*
* Return the canonical node computing the same value as n.
-} /* identify_remember */
/**
* During construction we set the op_pin_state_pinned flag in the graph right
/**
* During construction we set the op_pin_state_pinned flag in the graph right
set_irg_pinned(irg, op_pin_state_floats);
}
return n;
set_irg_pinned(irg, op_pin_state_floats);
}
return n;
/* Add a node to the identities value table. */
void add_identities(ir_node *node)
/* Add a node to the identities value table. */
void add_identities(ir_node *node)
visit(node, env);
}
current_ir_graph = rem;
visit(node, env);
}
current_ir_graph = rem;
-} /* visit_all_identities */
/**
* These optimizations deallocate nodes from the obstack.
/**
* These optimizations deallocate nodes from the obstack.
-} /* optimize_in_place_2 */
/**
* Wrapper for external use, set proper status bits after optimization.
/**
* Wrapper for external use, set proper status bits after optimization.
change the control graph. */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
return optimize_in_place_2(n);
change the control graph. */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
return optimize_in_place_2(n);
-} /* optimize_in_place */
/**
* Calculate a hash value of a Const node.
/**
* Calculate a hash value of a Const node.
h = HASH_PTR(node->attr.con.tarval);
return h;
h = HASH_PTR(node->attr.con.tarval);
return h;
/**
* Calculate a hash value of a SymConst node.
/**
* Calculate a hash value of a SymConst node.
h = HASH_PTR(node->attr.symc.sym.type_p);
return h;
h = HASH_PTR(node->attr.symc.sym.type_p);
return h;
/**
* Set the default hash operation in an ir_op_ops.
/**
* Set the default hash operation in an ir_op_ops.
ops = firm_set_default_get_entity_attr(code, ops);
return ops;
ops = firm_set_default_get_entity_attr(code, ops);
return ops;
-} /* firm_set_default_operations */
void_pass_func_irg function = (void_pass_func_irg)context;
function(irg);
return 0;
void_pass_func_irg function = (void_pass_func_irg)context;
function(irg);
return 0;
-} /* void_graph_wrapper */
/* Creates an ir_graph pass for running void function(ir_graph *irg). */
ir_graph_pass_t *def_graph_pass(
/* Creates an ir_graph pass for running void function(ir_graph *irg). */
ir_graph_pass_t *def_graph_pass(
INIT_LIST_HEAD(&pass->list);
return pass;
INIT_LIST_HEAD(&pass->list);
return pass;
/**
* Wrapper for running int function(ir_graph *irg) as an ir_graph pass.
/**
* Wrapper for running int function(ir_graph *irg) as an ir_graph pass.
{
int_pass_func_irg function = (int_pass_func_irg)context;
return function(irg);
{
int_pass_func_irg function = (int_pass_func_irg)context;
return function(irg);
-} /* int_graph_wrapper */
/* Creates an ir_graph pass for running void function(ir_graph *irg). */
ir_graph_pass_t *def_graph_pass_ret(
/* Creates an ir_graph pass for running void function(ir_graph *irg). */
ir_graph_pass_t *def_graph_pass_ret(
INIT_LIST_HEAD(&pass->list);
return pass;
INIT_LIST_HEAD(&pass->list);
return pass;
-} /* def_graph_pass_ret */
/* constructor for a default graph pass */
ir_graph_pass_t *def_graph_pass_constructor(
/* constructor for a default graph pass */
ir_graph_pass_t *def_graph_pass_constructor(
INIT_LIST_HEAD(&pass->list);
return pass;
INIT_LIST_HEAD(&pass->list);
return pass;
-} /* def_graph_pass_constructor */
/* set the run parallel property */
void ir_graph_pass_set_parallel(ir_graph_pass_t *pass, int flag)
{
pass->run_parallel = flag != 0;
/* set the run parallel property */
void ir_graph_pass_set_parallel(ir_graph_pass_t *pass, int flag)
{
pass->run_parallel = flag != 0;
-} /* ir_graph_pass_set_parallel */
/**
* Wrapper for running void function(void) as an ir_prog pass.
/**
* Wrapper for running void function(void) as an ir_prog pass.
(void)irp;
function();
return 0;
(void)irp;
function();
return 0;
-} /* void_graph_wrapper */
/* Creates an ir_prog pass for running void function(void). */
ir_prog_pass_t *def_prog_pass(
/* Creates an ir_prog pass for running void function(void). */
ir_prog_pass_t *def_prog_pass(
INIT_LIST_HEAD(&pass->list);
return pass;
INIT_LIST_HEAD(&pass->list);
return pass;
/* Creates an ir_prog pass for running void function(void). */
ir_prog_pass_t *def_prog_pass_constructor(
/* Creates an ir_prog pass for running void function(void). */
ir_prog_pass_t *def_prog_pass_constructor(
INIT_LIST_HEAD(&pass->list);
return pass;
INIT_LIST_HEAD(&pass->list);
return pass;
-} /* def_prog_pass_constructor */
typedef struct pass_t {
ir_prog_pass_t pass;
typedef struct pass_t {
ir_prog_pass_t pass;
(void)irp;
pass->function(pass->context);
return 0;
(void)irp;
pass->function(pass->context);
return 0;
-} /* call_function_wrapper */
ir_prog_pass_t *call_function_pass(
const char *name, void (*function)(void *context), void *context) {
ir_prog_pass_t *call_function_pass(
const char *name, void (*function)(void *context), void *context) {
pass->context = context;
return &pass->pass;
pass->context = context;
return &pass->pass;
-} /* call_function_pass */
get_compound_name(owner), get_entity_name(ent)));
}
}
get_compound_name(owner), get_entity_name(ent)));
}
}
/**
* If we have the closed world assumption, we can calculate the
/**
* If we have the closed world assumption, we can calculate the
/* get ready for the next letter */
str++;
len--;
/* get ready for the next letter */
str++;
len--;
- } /* while (len > 0 ) */
if (sign < 0)
do_negate((const char*) buffer, (char*) buffer);
if (sign < 0)
do_negate((const char*) buffer, (char*) buffer);