Commit 3a8e20bb authored by Christoph Mallon's avatar Christoph Mallon
Browse files

irprog: Add and use foreach_irp_irg{,_r}().

parent c8d8b2b4
......@@ -217,9 +217,7 @@ void compute_callgraph(void)
/* initialize */
free_callgraph();
size_t n_irgs = get_irp_n_irgs();
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
assert(get_irg_callee_info_state(irg) == irg_callee_info_consistent);
irg->callees = (cg_callee_entry **)new_pset(cg_callee_entry_cmp, 8);
irg->callers = (ir_graph **)new_pset(graph_cmp, 8);
......@@ -227,16 +225,13 @@ void compute_callgraph(void)
}
/* Compute the call graph */
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
construct_cf_backedges(irg); // We also find the maximal loop depth of a call.
irg_walk_graph(irg, ana_Call, NULL, NULL);
}
/* Change the sets to arrays. */
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
pset *callee_set = (pset *)irg->callees;
size_t count = pset_count(callee_set);
irg->callees = NEW_ARR_F(cg_callee_entry *, count);
......@@ -264,8 +259,7 @@ void compute_callgraph(void)
void free_callgraph(void)
{
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
if (irg->callees) DEL_ARR_F(irg->callees);
if (irg->callers) DEL_ARR_F(irg->callers);
if (irg->callee_isbe) free(irg->callee_isbe);
......@@ -318,16 +312,13 @@ void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *e
++master_cg_visited;
/* roots are methods which have no callers in the current program */
size_t n_irgs = get_irp_n_irgs();
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
if (get_irg_n_callers(irg) == 0)
do_walk(irg, pre, post, env);
}
/* in case of unreachable call loops we haven't visited some irgs yet */
for (size_t i = 0; i < n_irgs; i++) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
do_walk(irg, pre, post, env);
}
}
......@@ -529,8 +520,7 @@ static void init_scc(struct obstack *obst)
loop_node_cnt = 0;
init_stack();
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
set_irg_link(irg, new_scc_info(obst));
irg->callgraph_recursion_depth = 0;
irg->callgraph_loop_depth = 0;
......@@ -770,9 +760,7 @@ static void cgscc(ir_graph *n)
*/
static void reset_isbe(void)
{
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
free(irg->caller_isbe);
irg->caller_isbe = NULL;
......@@ -802,14 +790,11 @@ void find_callgraph_recursions(void)
++master_cg_visited;
cgscc(outermost_ir_graph);
size_t n_irgs = get_irp_n_irgs();
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
if (!cg_irg_visited(irg) && get_irg_n_callers(irg) == 0)
cgscc(irg);
}
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
if (!cg_irg_visited(irg))
cgscc(irg);
}
......@@ -819,8 +804,7 @@ void find_callgraph_recursions(void)
mature_loops(current_loop, get_irg_obstack(outermost_ir_graph));
/* -- Reverse the backedge information. -- */
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
for (size_t j = 0, n_callees = get_irg_n_callees(irg); j < n_callees; ++j) {
if (is_irg_callee_backedge(irg, j))
set_irg_caller_backedge(get_irg_callee(irg, j), irg);
......
......@@ -453,8 +453,7 @@ static size_t get_free_methods(ir_entity ***free_methods)
{
pset *free_set = pset_new_ptr_default();
for (size_t i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_graph *const irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
ir_entity *const ent = get_irg_entity(irg);
ir_linkage const linkage = get_entity_linkage(ent);
......@@ -651,8 +650,7 @@ static void callee_walker(ir_node *call, void *env)
static void callee_ana(void)
{
/* analyse all graphs */
for (size_t i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
assure_irg_properties(irg, IR_GRAPH_PROPERTY_NO_TUPLES);
irg_walk_graph(irg, callee_walker, NULL, NULL);
set_irg_callee_info_state(irg, irg_callee_info_consistent);
......@@ -704,8 +702,8 @@ void free_callee_info(ir_graph *irg)
void free_irp_callee_info(void)
{
for (size_t i = 0, n = get_irp_n_irgs(); i < n; ++i) {
free_callee_info(get_irp_irg(i));
foreach_irp_irg(i, irg) {
free_callee_info(irg);
}
}
......
......@@ -1193,9 +1193,7 @@ static void analyse_irp_globals_entity_usage(void)
check_initializers(type);
}
for (size_t i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
assure_irg_outs(irg);
irg_walk_graph(irg, NULL, check_global_address, NULL);
}
......@@ -1292,8 +1290,7 @@ void mark_private_methods(void)
/* first step: change the calling conventions of the local non-escaped entities */
bool changed = false;
for (size_t i = 0, n = get_irp_n_irgs(); i < n; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
ir_entity *ent = get_irg_entity(irg);
ir_entity_usage flags = get_entity_usage(ent);
......
......@@ -702,9 +702,8 @@ void free_loop_information(ir_graph *irg)
void free_all_loop_information(void)
{
size_t i;
for (i = 0; i < get_irp_n_irgs(); i++) {
free_loop_information(get_irp_irg(i));
foreach_irp_irg(i, irg) {
free_loop_information(irg);
}
}
......
......@@ -323,8 +323,7 @@ void compute_trouts(void)
init_trouts();
/* Compute outs for IR nodes. */
for (size_t i = get_irp_n_irgs(); i-- > 0;) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg_r(i, irg) {
irg_walk_graph(irg, NULL, chain_accesses, NULL);
}
walk_const_code(NULL, chain_accesses, NULL);
......
......@@ -29,7 +29,7 @@
#include "irgmod.h"
#include "irgwalk.h"
#include "iropt_t.h"
#include "irprog.h"
#include "irprog_t.h"
#include "lower_builtins.h"
#include "lower_calls.h"
#include "util.h"
......@@ -503,15 +503,12 @@ static void amd64_lower_for_target(void)
lower_calls_with_compounds(LF_RETURN_HIDDEN);
be_after_irp_transform("lower-calls");
size_t n_irgs = get_irp_n_irgs();
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
lower_switch(irg, 4, 256, mode_Iu);
be_after_transform(irg, "lower-switch");
}
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* Turn all small CopyBs into loads/stores, and turn all bigger
* CopyBs into memcpy calls, because we cannot handle CopyB nodes
* during code generation yet.
......
......@@ -12,7 +12,7 @@
#include "lc_opts_enum.h"
#include "irgwalk.h"
#include "irprog.h"
#include "irprog_t.h"
#include "ircons.h"
#include "irgmod.h"
#include "irgopt.h"
......@@ -381,20 +381,17 @@ static int arm_is_valid_clobber(const char *clobber)
static void arm_lower_for_target(void)
{
ir_mode *mode_gp = arm_reg_classes[CLASS_arm_gp].mode;
size_t i, n_irgs = get_irp_n_irgs();
/* lower compound param handling */
lower_calls_with_compounds(LF_RETURN_HIDDEN);
be_after_irp_transform("lower-calls");
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
lower_switch(irg, 4, 256, mode_gp);
be_after_transform(irg, "lower-switch");
}
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* Turn all small CopyBs into loads/stores and all bigger CopyBs into
* memcpy calls.
* TODO: These constants need arm-specific tuning. */
......
......@@ -437,8 +437,7 @@ void be_after_irp_transform(const char *name)
if (be_after_transform == NULL)
return;
for (size_t i = get_irp_n_irgs(); i-- > 0; ) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg_r(i, irg) {
be_after_transform(irg, name);
}
}
......@@ -449,8 +448,7 @@ void be_lower_for_target(void)
isa_if->lower_for_target();
/* set the phase to low */
for (size_t i = get_irp_n_irgs(); i-- > 0;) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg_r(i, irg) {
assert(!irg_is_constrained(irg, IR_GRAPH_CONSTRAINT_TARGET_LOWERED));
add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_TARGET_LOWERED);
}
......@@ -487,12 +485,10 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
be_gas_begin_compilation_unit(&env);
/* First: initialize all birgs */
size_t num_birgs = 0;
size_t num_irgs = get_irp_n_irgs();
size_t num_birgs = 0;
/* we might need 1 birg more for instrumentation constructor */
be_irg_t *birgs = ALLOCAN(be_irg_t, num_irgs + 1);
for (size_t i = 0; i < num_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
be_irg_t *const birgs = ALLOCAN(be_irg_t, get_irp_n_irgs() + 1);
foreach_irp_irg(i, irg) {
ir_entity *entity = get_irg_entity(irg);
if (get_entity_linkage(entity) & IR_LINKAGE_NO_CODEGEN)
continue;
......@@ -526,10 +522,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
if (num_birgs > 0 && be_options.opt_profile_generate) {
ir_graph *const prof_init_irg = ir_profile_instrument(prof_filename);
assert(prof_init_irg->be_data == NULL);
initialize_birg(&birgs[num_birgs], prof_init_irg, &env);
num_birgs++;
num_irgs++;
assert(num_irgs == get_irp_n_irgs());
initialize_birg(&birgs[num_birgs++], prof_init_irg, &env);
}
for (be_timer_id_t t = T_FIRST; t < T_LAST+1; ++t) {
......@@ -537,16 +530,14 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
}
if (!have_profile) {
be_timer_push(T_EXECFREQ);
for (size_t i = 0; i < num_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
ir_estimate_execfreq(irg);
}
be_timer_pop(T_EXECFREQ);
}
/* For all graphs */
for (size_t i = 0; i < num_irgs; ++i) {
ir_graph *const irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
ir_entity *const entity = get_irg_entity(irg);
if (get_entity_linkage(entity) & IR_LINKAGE_NO_CODEGEN)
continue;
......
......@@ -12,7 +12,7 @@
#include "lc_opts_enum.h"
#include "irarch.h"
#include "irgwalk.h"
#include "irprog.h"
#include "irprog_t.h"
#include "iredges_t.h"
#include "ircons_t.h"
#include "irflag.h"
......@@ -1724,7 +1724,6 @@ static int ia32_is_valid_clobber(const char *clobber)
static void ia32_lower_for_target(void)
{
ir_mode *mode_gp = ia32_reg_classes[CLASS_ia32_gp].mode;
size_t n_irgs = get_irp_n_irgs();
/* lower compound param handling
* Note: we lower compound arguments ourself, since on ia32 we don't
......@@ -1766,8 +1765,7 @@ static void ia32_lower_for_target(void)
lower_builtins(s, supported);
be_after_irp_transform("lower-builtins");
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* break up switches with wide ranges */
lower_switch(irg, 4, 256, mode_gp);
be_after_transform(irg, "lower-switch");
......@@ -1776,15 +1774,13 @@ static void ia32_lower_for_target(void)
ia32_lower64();
be_after_irp_transform("lower-64");
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* lower for mode_b stuff */
ir_lower_mode_b(irg, ia32_mode_gp);
be_after_transform(irg, "lower-modeb");
}
for (size_t i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* Turn all small CopyBs into loads/stores, keep medium-sized CopyBs,
* so we can generate rep movs later, and turn all big CopyBs into
* memcpy calls. */
......
......@@ -500,8 +500,7 @@ static void sparc_lower_for_target(void)
lower_calls_with_compounds(LF_RETURN_HIDDEN);
be_after_irp_transform("lower-calls");
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
/* Turn all small CopyBs into loads/stores and all bigger CopyBs into
* memcpy calls. */
lower_CopyB(irg, 31, 32, false);
......@@ -523,8 +522,7 @@ static void sparc_lower_for_target(void)
be_after_irp_transform("lower-builtins");
ir_mode *mode_gp = sparc_reg_classes[CLASS_sparc_gp].mode;
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
lower_switch(irg, 4, 256, mode_gp);
be_after_transform(irg, "lower-switch");
}
......@@ -532,8 +530,7 @@ static void sparc_lower_for_target(void)
sparc_lower_64bit();
be_after_irp_transform("lower-64");
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
ir_lower_mode_b(irg, mode_Iu);
be_after_transform(irg, "lower-modeb");
/* TODO: Pass SPARC_MIN_STACKSIZE as addr_delta as soon as
......
......@@ -585,9 +585,8 @@ void irg_finalize_cons(ir_graph *irg)
void irp_finalize_cons(void)
{
size_t i, n;
for (i = 0, n = get_irp_n_irgs(); i < n; ++i) {
irg_finalize_cons(get_irp_irg(i));
foreach_irp_irg(i, irg) {
irg_finalize_cons(irg);
}
}
......
......@@ -652,15 +652,15 @@ static void collect_node(ir_node *node, void *env)
*/
static ir_node **construct_block_lists(ir_graph *irg)
{
size_t i;
int walk_flag = ir_resources_reserved(irg) & IR_RESOURCE_IRN_VISITED;
int const walk_flag = ir_resources_reserved(irg) & IR_RESOURCE_IRN_VISITED;
if (walk_flag) {
ir_free_resources(irg, IR_RESOURCE_IRN_VISITED);
}
for (i = get_irp_n_irgs(); i > 0;)
ird_set_irg_link(get_irp_irg(--i), NULL);
foreach_irp_irg_r(i, irg) {
ird_set_irg_link(irg, NULL);
}
ird_walk_graph(irg, clear_link, collect_node, irg);
......@@ -1868,8 +1868,6 @@ void dump_vcg_footer(FILE *F)
static void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg)
{
size_t i;
construct_block_lists(irg);
/*
......@@ -1877,8 +1875,7 @@ static void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg)
* only the requested irg but also all irgs that can be reached
* from irg.
*/
for (i = get_irp_n_irgs(); i > 0;) {
ir_graph *other_irg = get_irp_irg(--i);
foreach_irp_irg_r(i, other_irg) {
ir_node **arr = (ir_node**)ird_get_irg_link(other_irg);
if (arr == NULL)
continue;
......@@ -2003,14 +2000,12 @@ void dump_cfg(FILE *F, ir_graph *irg)
void dump_callgraph(FILE *F)
{
size_t i;
ir_dump_flags_t old_flags = ir_get_dump_flags();
ir_remove_dump_flags(ir_dump_flag_disable_edge_labels);
dump_vcg_header(F, "Callgraph", "Hierarchic", NULL);
for (i = get_irp_n_irgs(); i > 0;) {
ir_graph *irg = get_irp_irg(--i);
foreach_irp_irg_r(i, irg) {
ir_entity *ent = get_irg_entity(irg);
size_t j, n_callees = get_irg_n_callees(irg);
......@@ -2407,10 +2402,7 @@ void dump_ir_graph(ir_graph *graph, const char *suffix)
void dump_all_ir_graphs(const char *suffix)
{
size_t i, n_irgs = get_irp_n_irgs();
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
dump_ir_graph(irg, suffix);
}
}
......@@ -511,9 +511,9 @@ void set_max_irg_visited(int val)
ir_visited_t inc_max_irg_visited(void)
{
#ifndef NDEBUG
size_t i;
for (i = 0; i < get_irp_n_irgs(); i++)
assert(max_irg_visited >= get_irg_visited(get_irp_irg(i)));
foreach_irp_irg(i, irg) {
assert(max_irg_visited >= get_irg_visited(irg));
}
#endif
return ++max_irg_visited;
}
......
......@@ -16,7 +16,7 @@
#include "irnode_t.h"
#include "irgraph_t.h"
#include "irprog.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "irhooks.h"
#include "entity_t.h"
......@@ -132,11 +132,7 @@ void irg_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void
void all_irg_walk(irg_walk_func *pre, irg_walk_func *post, void *env)
{
size_t i, n;
ir_graph *irg;
for (i = 0, n = get_irp_n_irgs(); i < n; i++) {
irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
irg_walk_graph(irg, pre, post, env);
}
}
......@@ -379,8 +375,9 @@ void walk_const_code(irg_walk_func *pre, irg_walk_func *post, void *env)
n_types = get_irp_n_types();
for (i = 0; i < n_types; i++)
walk_types_entities(get_irp_type(i), &walk_entity, &my_env);
for (i = 0; i < get_irp_n_irgs(); i++)
walk_types_entities(get_irg_frame_type(get_irp_irg(i)), &walk_entity, &my_env);
foreach_irp_irg(i, irg) {
walk_types_entities(get_irg_frame_type(irg), &walk_entity, &my_env);
}
/* Walk constant array bounds. */
for (i = 0; i < n_types; i++) {
......
......@@ -16,7 +16,7 @@
#include "irio.h"
#include "irnode_t.h"
#include "irprog.h"
#include "irprog_t.h"
#include "irgraph_t.h"
#include "irprintf.h"
#include "ircons_t.h"
......@@ -1111,8 +1111,7 @@ void ir_export_file(FILE *file)
write_typegraph(env);
for (size_t i = 0, n_irgs = get_irp_n_irgs(); i < n_irgs; i++) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
write_irg(env, irg);
}
......
......@@ -14,6 +14,7 @@
#include "hashptr.h"
#include "debug.h"
#include "irprog_t.h"
#include "obst.h"
#include "xmalloc.h"
#include "set.h"
......@@ -110,11 +111,9 @@ static unsigned int get_irg_n_blocks(ir_graph *irg)
*/
static unsigned int get_irp_n_blocks(void)
{
int i, n = get_irp_n_irgs();
unsigned int count = 0;
for (i = 0; i < n; i++) {
ir_graph *irg = get_irp_irg(i);
foreach_irp_irg(i, irg) {
count += get_irg_n_blocks(irg);
}
......@@ -449,7 +448,6 @@ static ir_entity *new_static_string_entity(ident *name, const char *string)
ir_graph *ir_profile_instrument(const char *filename)
{
int n, n_blocks = 0;
ident *counter_id, *filename_id;
ir_entity *bblock_counts, *ent_filename;
block_id_walker_data_t wd;
......@@ -461,7 +459,7 @@ ir_graph *ir_profile_instrument(const char *filename)
return NULL;
/* count the number of block first */
n_blocks = get_irp_n_blocks();
unsigned const n_blocks = get_irp_n_blocks();
/* create all the necessary types and entities. Note that the
* types must have a fixed layout, because we are already running in the
......@@ -474,8 +472,7 @@ ir_graph *ir_profile_instrument(const char *filename)
/* initialize block id array and instrument blocks */
wd.id = 0;
for (n = get_irp_n_irgs() - 1; n >= 0; --n) {
ir_graph *irg = get_irp_irg(n);
foreach_irp_irg_r(i, irg) {
instrument_irg(irg, bblock_counts, &wd);
}
......@@ -542,8 +539,7 @@ static void block_associate_walker(ir_node *bb, void *env)
static void irp_associate_blocks(block_assoc_t *env)
{
for (int n = get_irp_n_irgs() - 1; n >= 0; --n) {
ir_graph *irg = get_irp_irg(n);
foreach_irp_irg_r(i, irg) {
irg_block_walk_graph(irg, block_associate_walker, NULL, env);
}
}
......@@ -624,8 +620,7 @@ static void ir_set_execfreqs_from_profile(ir_graph *irg)
void ir_create_execfreqs_from_profile(void)
{
for (int n = get_irp_n_irgs() - 1; n >= 0; --n) {
ir_graph *irg = get_irp_irg(n);
foreach_irp_irg_r(i, irg) {
ir_set_execfreqs_from_profile(irg);
}
}
......@@ -96,19 +96,19 @@ void free_ir_prog(void)
if (irp == NULL)
return;
size_t i;
/* must iterate backwards here */
for (i = get_irp_n_irgs(); i > 0;)
free_ir_graph(get_irp_irg(--i));
foreach_irp_irg_r(i, irg) {
free_ir_graph(irg);
}
/* free entities first to avoid entity types being destroyed before
* the entities using them */
for (i = get_irp_n_types(); i > 0;)
for (size_t i = get_irp_n_types(); i > 0;)
free_type_entities(get_irp_type(--i));
ir_finish_entity(irp);
for (i = get_irp_n_types(); i > 0;)
for (size_t i = get_irp_n_types(); i > 0;)
free_type(get_irp_type(--i));
free_ir_graph(irp->const_code_irg);
......
......@@ -158,4 +158,15 @@ FIRM_API void add_irp_irg(ir_graph *irg);
shrinks the list by one. */
FIRM_API void remove_irp_irg(ir_graph *irg);
#define foreach_irp_irg(idx, irg) \
for (bool irg##__b = true; irg##__b; irg##__b = false) \
for (size_t idx = 0, irg##__n = get_irp_n_irgs(); irg##__b && idx != irg##__n; ++idx) \