Commit ac122d9d authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Return the profile init irg from ir_profile_instrument() instead of guessing...

Return the profile init irg from ir_profile_instrument() instead of guessing that it is the last irg.
parent ecb5fc89
......@@ -583,8 +583,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
}
if (num_birgs > 0 && be_options.opt_profile_generate) {
ir_profile_instrument(prof_filename);
ir_graph *prof_init_irg = get_irp_irg(get_irp_n_irgs()-1);
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++;
......
......@@ -472,7 +472,7 @@ static ir_entity *new_static_string_entity(ident *name, const char *string)
return result;
}
void ir_profile_instrument(const char *filename)
ir_graph *ir_profile_instrument(const char *filename)
{
int n, n_blocks = 0;
ident *counter_id, *filename_id;
......@@ -483,7 +483,7 @@ void ir_profile_instrument(const char *filename)
/* Don't do anything for modules without code. Else the linker will
* complain. */
if (get_irp_n_irgs() == 0)
return;
return NULL;
/* count the number of block first */
n_blocks = get_irp_n_blocks();
......@@ -504,7 +504,7 @@ void ir_profile_instrument(const char *filename)
instrument_irg(irg, bblock_counts, &wd);
}
gen_initializer_irg(ent_filename, bblock_counts, n_blocks);
return gen_initializer_irg(ent_filename, bblock_counts, n_blocks);
}
static unsigned int *parse_profile(const char *filename, unsigned int num_blocks)
......
......@@ -37,7 +37,7 @@
* incremented in that block. After the program has run the info is written
* to @p filename.
*/
void ir_profile_instrument(const char *filename);
ir_graph *ir_profile_instrument(const char *filename);
/**
* Reads the corresponding profile info file if it exists and returns a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment