Implement binary emitter for LdTls.
[libfirm] / ir / be / bechordal_main.c
index 1e6e6ba..a367495 100644 (file)
 #include "beabi.h"
 #include "beutil.h"
 #include "besched.h"
-#include "besched_t.h"
+#include "besched.h"
 #include "belive_t.h"
-#include "bearch_t.h"
+#include "bearch.h"
 #include "beifg_t.h"
 #include "beifg_impl.h"
-#include "benode_t.h"
+#include "benode.h"
 #include "bestatevent.h"
 #include "bestat.h"
 #include "bemodule.h"
 #include "be_t.h"
 #include "bera.h"
-#include "beirg_t.h"
+#include "beirg.h"
 
 #include "bespillslots.h"
-#include "bespilloptions.h"
+#include "bespill.h"
 #include "belower.h"
 
 #include "becopystat.h"
 #include "becopyopt.h"
 #include "bessadestr.h"
 #include "beverify.h"
-#include "benode_t.h"
+#include "benode.h"
 
 static be_ra_chordal_opts_t options = {
        BE_CH_DUMP_NONE,
@@ -207,7 +207,7 @@ static void memory_operand_walker(ir_node *irn, void *env)
 /**
  * Starts a walk for memory operands if supported by the backend.
  */
-static INLINE void check_for_memory_operands(ir_graph *irg)
+void check_for_memory_operands(ir_graph *irg)
 {
        irg_walk_graph(irg, NULL, memory_operand_walker, NULL);
 }
@@ -238,7 +238,7 @@ static void pre_spill(post_spill_env_t *pse, const arch_register_class_t *cls)
        be_put_ignore_regs(birg, pse->cls, chordal_env->ignore_colors);
 
        BE_TIMER_PUSH(t_ra_constr);
-       be_pre_spill_prepare_constr(chordal_env);
+       be_pre_spill_prepare_constr(chordal_env->birg, chordal_env->cls);
        BE_TIMER_POP(t_ra_constr);
 
        dump(BE_CH_DUMP_CONSTR, birg->irg, pse->cls, "-constr-pre", dump_ir_block_graph_sched);
@@ -270,9 +270,9 @@ static void post_spill(post_spill_env_t *pse, int iteration) {
                }
                BE_TIMER_POP(t_ra_spill_apply);
 
-               BE_TIMER_PUSH(t_verify);
 
                /* verify schedule and register pressure */
+               BE_TIMER_PUSH(t_verify);
                if (chordal_env->opts->vrfy_option == BE_CH_VRFY_WARN) {
                        be_verify_schedule(birg);
                        be_verify_register_pressure(birg, pse->cls, irg);
@@ -429,7 +429,7 @@ static void be_ra_chordal_main(be_irg_t *birg)
                /* the backend has its own spiller */
                m = arch_env_get_n_reg_class(arch_env);
 
-               pse = alloca(m * sizeof(pse[0]));
+               pse = ALLOCAN(post_spill_env_t, m);
 
                for (j = 0; j < m; ++j) {
                        memcpy(&pse[j].cenv, &chordal_env, sizeof(chordal_env));
@@ -448,7 +448,12 @@ static void be_ra_chordal_main(be_irg_t *birg)
        }
 
        BE_TIMER_PUSH(t_verify);
-       be_verify_register_allocation(birg);
+       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) {
+               assert(be_verify_register_allocation(birg)
+                               && "Register allocation invalid");
+       }
        BE_TIMER_POP(t_verify);
 
        BE_TIMER_PUSH(t_ra_epilog);
@@ -462,12 +467,12 @@ static void be_ra_chordal_main(be_irg_t *birg)
        BE_TIMER_POP(t_ra_other);
 }
 
-static be_ra_t be_ra_chordal_allocator = {
-       be_ra_chordal_main,
-};
-
 void be_init_chordal_main(void)
 {
+       static be_ra_t be_ra_chordal_allocator = {
+               be_ra_chordal_main,
+       };
+
        lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
        lc_opt_entry_t *ra_grp = lc_opt_get_grp(be_grp, "ra");
        lc_opt_entry_t *chordal_grp = lc_opt_get_grp(ra_grp, "chordal");