#include "debug.h"
#include "execfreq.h"
#include "iredges_t.h"
+#include "error.h"
#include "bechordal_t.h"
#include "beabi.h"
#include "be_t.h"
#include "bera.h"
#include "beirg.h"
+#include "bedump_minir.h"
#include "bespillslots.h"
#include "bespill.h"
&options.vrfy_option, be_ch_vrfy_items
};
+static char minir_file[256] = "";
+
static const lc_opt_table_entry_t be_chordal_options[] = {
LC_OPT_ENT_ENUM_PTR ("perm", "perm lowering options", &lower_perm_var),
LC_OPT_ENT_ENUM_MASK("dump", "select dump phases", &dump_var),
LC_OPT_ENT_ENUM_PTR ("verify", "verify options", &be_ch_vrfy_var),
+ LC_OPT_ENT_STR ("minirout", "dump MinIR to file", minir_file, sizeof(minir_file)),
LC_OPT_LAST
};
be_add_module_to_list(&colorings, name, coloring);
}
-void be_ra_chordal_coloring(be_chordal_env_t *env)
+static void be_ra_chordal_coloring(be_chordal_env_t *env)
{
assert(selected_coloring != NULL);
- if(selected_coloring != NULL) {
+ if (selected_coloring != NULL) {
selected_coloring->allocate(env);
}
}
-
static void dump(unsigned mask, ir_graph *irg,
const arch_register_class_t *cls,
const char *suffix,
void (*dump_func)(ir_graph *, const char *))
{
- if((options.dump_flags & mask) == mask) {
+ if ((options.dump_flags & mask) == mask) {
if (cls) {
char buf[256];
snprintf(buf, sizeof(buf), "-%s%s", cls->name, suffix);
return;
/* only use memory operands, if the reload is only used by 1 node */
- if(get_irn_n_edges(irn) > 1)
+ if (get_irn_n_edges(irn) > 1)
return;
spill = be_get_Reload_mem(irn);
/**
* Perform things which need to be done per register class after spilling.
*/
-static void post_spill(post_spill_env_t *pse, int iteration) {
+static void post_spill(post_spill_env_t *pse, int iteration)
+{
be_chordal_env_t *chordal_env = &pse->cenv;
be_irg_t *birg = pse->birg;
ir_graph *irg = birg->irg;
}
be_timer_push(T_RA_COPYMIN);
+ if (minir_file[0] != '\0') {
+ FILE *out;
+
+ if (strcmp(minir_file, "-") == 0) {
+ out = stdout;
+ } else {
+ out = fopen(minir_file, "w");
+ if (out == NULL) {
+ panic("Cound't open minir output '%s'", minir_file);
+ }
+ }
+
+ be_export_minir(chordal_env->birg->main_env->arch_env, out, irg);
+ if (out != stdout)
+ fclose(out);
+ }
co_driver(chordal_env);
be_timer_pop(T_RA_COPYMIN);
const arch_register_class_t *cls
= arch_env_get_reg_class(arch_env, j);
- if(arch_register_class_flags(cls) & arch_register_class_flag_manual_ra)
+ if (arch_register_class_flags(cls) & arch_register_class_flag_manual_ra)
continue;
be_timer_push(T_VERIFY);
if (chordal_env.opts->vrfy_option == BE_CH_VRFY_WARN) {
be_verify_register_allocation(birg);
- } else if(chordal_env.opts->vrfy_option == BE_CH_VRFY_ASSERT) {
+ } else if (chordal_env.opts->vrfy_option == BE_CH_VRFY_ASSERT) {
assert(be_verify_register_allocation(birg)
&& "Register allocation invalid");
}
be_timer_pop(T_RA_OTHER);
}
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_main);
void be_init_chordal_main(void)
{
static be_ra_t be_ra_chordal_allocator = {
lc_opt_add_table(chordal_grp, be_chordal_options);
be_add_module_list_opt(chordal_grp, "coloring", "select coloring methode", &colorings, (void**) &selected_coloring);
}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_chordal_main);