* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry(type, pos, head, member) \
- for (pos = list_entry((head)->next, type, member); \
+ for (type *pos = list_entry((head)->next, type, member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, type, member))
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(type, pos, head, member) \
- for (pos = list_entry((head)->prev, type, member); \
+ for (type *pos = list_entry((head)->prev, type, member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, type, member))
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(type, pos, n, head, member) \
- for (pos = list_entry((head)->next, type, member), \
- n = list_entry(pos->member.next, type, member); \
+ for (type *pos = list_entry((head)->next, type, member), \
+ *n = list_entry(pos->member.next, type, member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, type, member))
struct list_head *head = get_block_border_head(env, block);
be_lv_t *lv = be_get_irg_liveness(env->irg);
- border_t *b;
-
bitset_clear_all(colors);
bitset_clear_all(live);
bitset_clear_all(in_colors);
struct list_head *head = get_block_border_head(env->chordal_env, block);
const draw_chordal_opts_t *opts = env->opts;
struct block_dims *dims = OALLOCZ(&env->obst, struct block_dims);
- border_t *b;
dims->min_step = INT_MAX;
const draw_chordal_opts_t *opts = env->opts;
struct block_dims *dims = pmap_get(struct block_dims, env->block_dims, bl);
char buf[64];
- border_t *b;
ir_snprintf(buf, sizeof(buf), "%F", bl);
*/
static void ou_optimize(unit_t *ou)
{
- qnode_t *curr = NULL;
- qnode_t *tmp;
- const arch_register_req_t *req;
- bitset_t const* allocatable_regs;
- unsigned n_regs;
- unsigned idx;
- int i;
+ qnode_t *curr = NULL;
+ const arch_register_req_t *req;
+ bitset_t const* allocatable_regs;
+ unsigned n_regs;
+ unsigned idx;
+ int i;
DBG((dbg, LEVEL_1, "\tOptimizing unit:\n"));
for (i=0; i<ou->node_count; ++i)
*/
int co_solve_heuristic(copy_opt_t *co)
{
- unit_t *curr;
-
ASSERT_OU_AVAIL(co);
pinned_global = pset_new_ptr(SLOTS_PINNED_GLOBAL);
static void reject_coloring(struct list_head *h)
{
- co2_irn_t *pos;
-
list_for_each_entry(co2_irn_t, pos, h, changed_list)
pos->tmp_fixed = 0;
}
static void materialize_coloring(struct list_head *h)
{
- co2_irn_t *pos;
-
list_for_each_entry(co2_irn_t, pos, h, changed_list) {
pos->orig_col = pos->tmp_col;
pos->tmp_fixed = 0;
static co2_cloud_t *new_cloud(co2_t *env, affinity_node_t *a)
{
co2_cloud_t *cloud = OALLOC(&env->obst, co2_cloud_t);
- co2_cloud_irn_t *ci;
int i;
DBG((env->dbg, LEVEL_2, "new cloud with %+F\n", a->irn));
static void process(co2_t *env)
{
- co2_cloud_t *pos;
co2_cloud_t **clouds;
int n_clouds;
int i;
aff_edge_t *edges = NEW_ARR_F(aff_edge_t, 0);
ir_node *n;
int i, len;
- aff_chunk_t *curr_chunk;
size_t pn;
/* at first we create the affinity edge objects */
*/
static inline void reject_coloring(struct list_head *nodes)
{
- co_mst_irn_t *n, *temp;
DB((dbg, LEVEL_4, "\treject coloring for"));
list_for_each_entry_safe(co_mst_irn_t, n, temp, nodes, list) {
DB((dbg, LEVEL_4, " %+F", n->irn));
static inline void materialize_coloring(struct list_head *nodes)
{
- co_mst_irn_t *n, *temp;
list_for_each_entry_safe(co_mst_irn_t, n, temp, nodes, list) {
assert(n->tmp_col >= 0);
n->col = n->tmp_col;
static void build_affinity_cstr(ilp_env_t *ienv)
{
unsigned n_colors = arch_register_class_n_regs(ienv->co->cls);
- unit_t *curr;
/* for all optimization units */
list_for_each_entry(unit_t, curr, &ienv->co->units, units) {
* Is this necessary?
*/
static inline int co_ilp_get_costs(copy_opt_t *co, ir_node *root, ir_node *arg) {
- int i;
- unit_t *curr;
+ int i;
/* search optimization unit for phi */
list_for_each_entry(unit_t, curr, &co->units, units)
static void co_sort_units(copy_opt_t *co)
{
int i, count = 0, costs;
- unit_t *ou, **ous;
+ unit_t **ous;
/* get the number of ous, remove them form the list and fill the array */
list_for_each_entry(unit_t, ou, &co->units, units)
void co_free_ou_structure(copy_opt_t *co)
{
- unit_t *curr, *tmp;
ASSERT_OU_AVAIL(co);
list_for_each_entry_safe(unit_t, curr, tmp, &co->units, units) {
xfree(curr->nodes);
int co_get_max_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_inevit_copy_costs(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_copy_costs(const copy_opt_t *co)
{
int i, res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
int co_get_lower_bound(const copy_opt_t *co)
{
int res = 0;
- unit_t *curr;
ASSERT_OU_AVAIL(co);
{
nodes_iter_t *it = (nodes_iter_t*)data;
struct list_head *head = get_block_border_head(it->env, bl);
- border_t *b;
foreach_border_head(head, b) {
if (b->is_def && b->is_real) {
struct list_head *head = get_block_border_head(it->env, block);
be_lv_t *lv = be_get_irg_liveness(it->env->irg);
- border_t *b;
int has_started = 0;
if (!be_is_live_in(lv, block, it->irn) && block != get_nodes_block(it->irn))
int ir_graph_pass_mgr_run(ir_graph_pass_manager_t *mgr)
{
- ir_graph_pass_t *pass;
- size_t i;
- int res = 0;
- ir_graph *rem = current_ir_graph;
+ size_t i;
+ int res = 0;
+ ir_graph *rem = current_ir_graph;
/* on all graphs: beware: number of irgs might be changed */
for (i = 0; i < get_irp_n_irgs(); ++i) {
int ir_prog_pass_mgr_run(ir_prog_pass_manager_t *mgr)
{
- ir_prog_pass_t *pass;
- int res = 0;
+ int res = 0;
/* run every pass on every graph */
unsigned idx = mgr->run_idx;
void term_graph_pass_mgr(ir_graph_pass_manager_t *mgr)
{
- ir_graph_pass_t *pass, *next;
-
list_for_each_entry_safe(ir_graph_pass_t, pass, next, &mgr->passes, list) {
if (pass->rem_from_mgr)
pass->rem_from_mgr(pass->context);
void term_prog_pass_mgr(ir_prog_pass_manager_t *mgr)
{
- ir_prog_pass_t *pass, *next;
-
list_for_each_entry_safe(ir_prog_pass_t, pass, next, &mgr->passes, list) {
if (pass->rem_from_mgr)
pass->rem_from_mgr(pass->context);
HashSetEntry *old_entries = self->entries;
HashSetEntry *new_entries;
list_head list = self->elem_list;
- ValueType *entry;
int res = 1;
/* allocate a new array with double size */
static lc_opt_entry_t *lc_opt_find_ent(const struct list_head *head, const char *name,
int error_to_use, lc_opt_err_info_t *err)
{
- lc_opt_entry_t *ent, *found = NULL;
+ lc_opt_entry_t *found = NULL;
int error = error_to_use;
unsigned hash = hash_str(name);
char grp_name[512];
char value[256];
char values[512];
- lc_opt_entry_t *e;
if (!list_empty(&s->opts)) {
lc_opt_print_grp_path(grp_name, sizeof(grp_name), ent, separator, stop_ent);
lc_grp_special_t *s;
if (ent->is_grp) {
- lc_opt_entry_t *e;
-
s = lc_get_grp_special(ent);
indent(f, level);
fprintf(f, "/%s\n", ent->name);
{
const backend_params *bparams = be_get_backend_param();
walk_env_t env;
- entry_t *entry;
assert(max_small_sz < min_large_sz && "CopyB size ranges must not overlap");
*/
static void check_partition(const partition_t *T)
{
- node_t *node;
unsigned n = 0;
list_for_each_entry(node_t, node, &T->Leader, node_list) {
*/
static void check_opcode(const partition_t *Z)
{
- node_t *node;
const ir_node *repr = NULL;
list_for_each_entry(node_t, node, &Z->Leader, node_list) {
{
#ifdef DEBUG_libfirm
partition_t *P;
- node_t *node;
for (P = env->dbg_list; P != NULL; P = P->dbg_next) {
check_partition(P);
*/
static void dump_partition(const char *msg, const partition_t *part)
{
- const node_t *node;
int first = 1;
lattice_elem_t type = get_partition_type(part);
partition_t *X_prime;
list_head tmp;
step_env senv[2];
- node_t *g, *h, *node, *t;
+ node_t *g, *h;
int max_input, transitions, winner, shf;
unsigned n;
DEBUG_ONLY(static int run = 0;)
/* Remove gg from X.Leader and put into g */
g = NULL;
- for (node = gg; node != NULL; node = node->next) {
+ for (node_t *node = gg; node != NULL; node = node->next) {
assert(node->part == X);
assert(node->is_follower == 0);
X_prime = new_partition(env);
max_input = 0;
n = 0;
- for (node = senv[winner].walked; node != NULL; node = node->race_next) {
+ for (node_t *node = senv[winner].walked; node != NULL; node = node->race_next) {
list_del(&node->node_list);
node->part = X_prime;
if (node->is_follower) {
*/
static void collect_touched(list_head *list, int idx, environment_t *env)
{
- node_t *x, *y;
+ node_t *y;
int end_idx = env->end_idx;
list_for_each_entry(node_t, x, list, node_list) {
*/
static void collect_commutative_touched(list_head *list, environment_t *env)
{
- node_t *x, *y;
+ node_t *y;
list_for_each_entry(node_t, x, list, node_list) {
int num_edges;
static partition_t *split_by_what(partition_t *X, what_func What,
partition_t **P, environment_t *env)
{
- node_t *x, *S;
+ node_t *S;
listmap_t map;
listmap_entry_t *iter;
partition_t *R;
x->on_fallen = 0;
if (old_type_was_T_or_C) {
- node_t *y, *tmp;
-
/* check if some nodes will make the leader -> follower transition */
list_for_each_entry_safe(node_t, y, tmp, &Y->Leader, node_list) {
if (y->type.tv != tarval_top && ! is_con(y->type)) {
*/
static void dump_partition(const char *msg, const partition_t *part)
{
- const block_t *block;
- int first = 1;
+ int first = 1;
DB((dbg, LEVEL_2, " %s part%u (%u blocks) {\n ", msg, part->nr, part->n_blocks));
list_for_each_entry(block_t, block, &part->blocks, block_list) {
{
block_t *ready_blocks = NULL;
unsigned n_ready = 0;
- block_t *bl, *next;
listmap_t map;
listmap_entry_t *iter;
*/
static void propagate(environment_t *env)
{
- partition_t *part, *next;
-
list_for_each_entry_safe(partition_t, part, next, &env->partitions, part_list) {
if (part->n_blocks < 2) {
/* zero or one block left, kill this partition */
static void propagate_blocks_live_troughs(partition_t *part, environment_t *env)
{
const ir_node *meet_block = part->meet_block;
- block_t *bl, *next;
listmap_t map;
listmap_entry_t *iter;
const ir_node *phi;
*/
static void propagate_live_troughs(environment_t *env)
{
- partition_t *part, *next;
-
list_for_each_entry_safe(partition_t, part, next, &env->partitions, part_list) {
propagate_blocks_live_troughs(part, env);
}
static void apply(ir_graph *irg, partition_t *part)
{
block_t *repr = list_entry(part->blocks.next, block_t, block_list);
- block_t *bl;
ir_node *block, *end, *meet_block, *p, *next;
ir_node **ins, **phi_ins;
phi_t *repr_phi, *phi;
void shape_blocks(ir_graph *irg)
{
environment_t env;
- partition_t *part;
block_t *bl;
int res, n;
{
ir_graph *rem = current_ir_graph;
inline_env_t env;
- call_entry *entry;
current_ir_graph = irg;
/* Handle graph state */
*/
static void append_call_list(inline_irg_env *dst, inline_irg_env *src, int loop_depth)
{
- call_entry *entry, *nentry;
+ call_entry *nentry;
/* Note that the src list points to Call nodes in the inlined graph, but
we need Call nodes in our graph. Luckily the inliner leaves this information
ir_graph *rem;
int did_inline;
wenv_t wenv;
- call_entry *entry, *next;
- const call_entry *centry;
pmap *copied_graphs;
pmap_entry *pm_entry;
{
int phiproj_computed = 0;
inline_irg_env *env = (inline_irg_env*)get_irg_link(irg);
- call_entry *curr_call;
wenv_t wenv;
pqueue_t *pqueue;
irg_inline_property prop = get_irg_inline_property(callee);
ir_graph *calleee;
int loop_depth;
- const call_entry *centry;
if ((prop < irg_inline_forced) && env->n_nodes + callee_env->n_nodes > maxsize) {
DB((dbg, LEVEL_2, "%+F: too big (%d) + %+F (%d)\n", irg,