generate emitter functions from spec
[libfirm] / ir / be / bemain.c
index 02a43b7..82ed7e4 100644 (file)
@@ -47,6 +47,7 @@
 
 #undef DUMP_BEGIN
 #undef DUMP_PREPARED
+#define DUMP_TRANSFORM
 #define DUMP_SCHED
 #define DUMP_SPILL
 #undef DUMP_ALLOCATED
@@ -139,13 +140,16 @@ static void be_main_loop(void)
        be_init_env(&env);
        isa = arch_env_get_isa(env.arch_env);
 
+        /* create required irop's */
+        create_bearch_asm_opcodes();
+
        /* For all graphs */
        for(i = 0, n = get_irp_n_irgs(); i < n; ++i) {
                int j, m;
                ir_graph *irg = get_irp_irg(i);
                be_main_session_env_t session;
 
-               DBG((env.dbg, LEVEL_1, "====> IRG: %F\n", irg));
+               DBG((env.dbg, LEVEL_2, "====> IRG: %F\n", irg));
 #ifdef DUMP_BEGIN
                dump_ir_block_graph(irg, "-begin");
 #endif
@@ -156,10 +160,13 @@ static void be_main_loop(void)
                /* Compute some analyses and prepare the graph for backend use. */
                prepare_graph(&session);
 
-                create_bearch_asm_opcodes();
-                transform_firm();
+                transform_firm(irg);
 
+#ifdef DUMP_TRANSFORM
                dump_ir_block_graph(irg, "-transformed");
+#endif
+
+
 #if 0
 #ifdef DUMP_PREPARED
                dump_dominator_information(true);
@@ -243,18 +250,11 @@ static void be_main_loop(void)
 
 void be_main(int argc, const char *argv[])
 {
-       assembler_t *gnu_assembler;
-       FILE *asm_output_file;
+  FILE *asm_output_file;
 
-       be_main_loop();
+  be_main_loop();
 
-#if 0
-       gnu_assembler = gnuasm_create_assembler();
-       asm_output_file = fopen("asm_output.asm", "w");
-
-       asm_dump_globals(gnu_assembler);
-       gnuasm_dump(gnu_assembler, asm_output_file);
-       gnuasm_delete_assembler(gnu_assembler);
-       fclose(asm_output_file);
-#endif
+  asm_output_file = fopen(argv[0], "w");
+  firmbe_gen_code(asm_output_file);
+  fclose(asm_output_file);
 }