Commit c3e48b15 authored by Michael Beck's avatar Michael Beck
Browse files

moved be_retrieve_dbg_info() into middleend and rename it to ir_retrieve_dbg_info()

[r16804]
parent ce14b8c8
......@@ -83,21 +83,6 @@ const backend_params *be_init(void);
*/
void be_main(FILE *file_handle, const char *cup_name);
/** The type of the debug info retriever function. */
typedef const char *(*retrieve_dbg_func)(const dbg_info *dbg, unsigned *line);
/**
* Sets a debug info retriever.
*
* @param func the debug retriever function.
*/
void be_set_debug_retrieve(retrieve_dbg_func func);
/**
* Retrieve the debug info.
*/
const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);
typedef struct be_main_env_t be_main_env_t;
typedef struct be_options_t be_options_t;
......
......@@ -195,6 +195,21 @@ void default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
/** @} */
/** The type of the debug info retriever function. */
typedef const char *(*retrieve_dbg_func)(const dbg_info *dbg, unsigned *line);
/**
* Sets a debug info retriever.
*
* @param func the debug retriever function.
*/
void ir_set_debug_retrieve(retrieve_dbg_func func);
/**
* Retrieve the debug info.
*/
const char *ir_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);
#ifdef __cplusplus
}
#endif
......
......@@ -43,6 +43,7 @@
#include "irargs_t.h"
#include "error.h"
#include "raw_bitset.h"
#include "dbginfo.h"
#include "../besched.h"
#include "../beblocksched.h"
......@@ -994,7 +995,7 @@ static unsigned num = -1;
static void arm_emit_dbg(const ir_node *irn) {
dbg_info *db = get_irn_dbg_info(irn);
unsigned lineno;
const char *fname = be_retrieve_dbg_info(db, &lineno);
const char *fname = ir_retrieve_dbg_info(db, &lineno);
if (! cg->birg->main_env->options->stabs_debug_support)
return;
......
......@@ -32,6 +32,7 @@
#include "irprintf.h"
#include "ident.h"
#include "tv.h"
#include "dbginfo.h"
FILE *emit_file;
struct obstack emit_obst;
......@@ -116,7 +117,7 @@ void be_emit_finish_line_gas(const ir_node *node)
be_emit_irprintf("%+F ", node);
dbg = get_irn_dbg_info(node);
sourcefile = be_retrieve_dbg_info(dbg, &lineno);
sourcefile = ir_retrieve_dbg_info(dbg, &lineno);
if(sourcefile != NULL) {
be_emit_string(sourcefile);
be_emit_irprintf(":%u", lineno);
......
......@@ -434,12 +434,12 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
or try to read in profile data for current translation unit.
*/
if (be_options.opt_profile) {
ir_graph *prof_init_irg = be_profile_instrument(prof_filename, profile_default);
ir_graph *prof_init_irg = ir_profile_instrument(prof_filename, profile_default);
initialize_birg(&birgs[num_birgs], prof_init_irg, &env);
num_birgs++;
set_method_img_section(get_irg_entity(prof_init_irg), section_constructors);
} else {
be_profile_read(prof_filename);
ir_profile_read(prof_filename);
}
/* For all graphs */
......@@ -535,8 +535,8 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
/**
* Create execution frequencies from profile data or estimate some
*/
if (be_profile_has_data())
birg->exec_freq = be_create_execfreqs_from_profile(irg);
if (ir_profile_has_data())
birg->exec_freq = ir_create_execfreqs_from_profile(irg);
else
birg->exec_freq = compute_execfreq(irg, 10);
......@@ -736,7 +736,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
#endif /* if 0 */
stat_ev_ctx_pop("bemain_irg");
}
be_profile_free();
ir_profile_free();
be_done_env(&env);
#undef BE_TIMER_POP
......@@ -802,23 +802,6 @@ void be_main(FILE *file_handle, const char *cup_name)
#endif
}
/** The debug info retriever function. */
static retrieve_dbg_func retrieve_dbg = NULL;
/* Sets a debug info retriever. */
void be_set_debug_retrieve(retrieve_dbg_func func) {
retrieve_dbg = func;
}
/* Retrieve the debug info. */
const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line) {
if (retrieve_dbg)
return retrieve_dbg(dbg, line);
*line = 0;
return NULL;
}
unsigned be_put_ignore_regs(const be_irg_t *birg, const arch_register_class_t *cls, bitset_t *bs)
{
if (bs == NULL)
......
......@@ -440,8 +440,8 @@ static double
execution_frequency(const spill_ilp_t *si, const ir_node * irn)
{
#define FUDGE 0.001
if(be_profile_has_data())
return ((double)be_profile_get_block_execcount(get_block_const(irn))) + FUDGE;
if(ir_profile_has_data())
return ((double)ir_profile_get_block_execcount(get_block_const(irn))) + FUDGE;
#ifndef EXECFREQ_LOOPDEPH
return get_block_execfreq(si->birg->exec_freq, get_block_const(irn)) + FUDGE;
......
......@@ -42,6 +42,7 @@
#include "execfreq.h"
#include "error.h"
#include "raw_bitset.h"
#include "dbginfo.h"
#include "../besched_t.h"
#include "../benode_t.h"
......@@ -1915,7 +1916,7 @@ static void ia32_emit_dbg(const ir_node *node)
{
dbg_info *db = get_irn_dbg_info(node);
unsigned lineno;
const char *fname = be_retrieve_dbg_info(db, &lineno);
const char *fname = ir_retrieve_dbg_info(db, &lineno);
if (! cg->birg->main_env->options->stabs_debug_support)
return;
......
......@@ -101,3 +101,20 @@ void default_dbg_info_merge_sets(ir_node **new_nodes, int n_new_nodes,
set_irn_dbg_info(new_nodes[i], old_db);
}
} /* default_dbg_info_merge_sets */
/** The debug info retriever function. */
static retrieve_dbg_func retrieve_dbg = NULL;
/* Sets a debug info retriever. */
void ir_set_debug_retrieve(retrieve_dbg_func func) {
retrieve_dbg = func;
}
/* Retrieve the debug info. */
const char *ir_retrieve_dbg_info(const dbg_info *dbg, unsigned *line) {
if (retrieve_dbg)
return retrieve_dbg(dbg, line);
*line = 0;
return NULL;
}
Supports Markdown
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