projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added if layer for irn_ops
[libfirm]
/
ir
/
be
/
bemain.c
diff --git
a/ir/be/bemain.c
b/ir/be/bemain.c
index
c878c94
..
96b421b
100644
(file)
--- a/
ir/be/bemain.c
+++ b/
ir/be/bemain.c
@@
-27,28
+27,29
@@
#include "irloop_t.h"
#include "irtools.h"
#include "irloop_t.h"
#include "irtools.h"
+#include "bearch.h"
+#include "firm/bearch_firm.h"
+#include "ia32/bearch_ia32.h"
+
#include "be_t.h"
#include "be_t.h"
-#include "bechordal_t.h"
-#include "bera.h"
-#include "beifg.h"
-#include "beifg_impl.h"
#include "benumb_t.h"
#include "benumb_t.h"
+#include "beutil.h"
+#include "benode_t.h"
+#include "beirgmod.h"
#include "besched_t.h"
#include "belistsched.h"
#include "belive_t.h"
#include "besched_t.h"
#include "belistsched.h"
#include "belive_t.h"
-#include "beutil.h"
-#include "bechordal.h"
-#include "bearch.h"
+#include "bespillilp.h"
+#include "bespillbelady.h"
+#include "bera.h"
+#include "beraextern.h"
+#include "bechordal_t.h"
+#include "beifg.h"
+#include "beifg_impl.h"
#include "becopyoptmain.h"
#include "becopystat.h"
#include "bessadestr.h"
#include "becopyoptmain.h"
#include "becopystat.h"
#include "bessadestr.h"
-#include "benode_t.h"
-#include "beirgmod.h"
-#include "bespillilp.h"
-#include "bespillbelady.h"
-#include "firm/bearch_firm.h"
-#include "ia32/bearch_ia32.h"
#define DUMP_INITIAL (1 << 0)
#define DUMP_SCHED (1 << 1)
#define DUMP_INITIAL (1 << 0)
#define DUMP_SCHED (1 << 1)
@@
-93,6
+94,7
@@
static const lc_opt_enum_mask_items_t dump_items[] = {
/* register allocators */
static const lc_opt_enum_const_ptr_items_t ra_items[] = {
{ "chordal", &be_ra_chordal_allocator },
/* register allocators */
static const lc_opt_enum_const_ptr_items_t ra_items[] = {
{ "chordal", &be_ra_chordal_allocator },
+ { "external", &be_ra_external_allocator },
{ NULL, NULL }
};
{ NULL, NULL }
};
@@
-131,15
+133,17
@@
void be_opt_register(void)
{
#ifdef WITH_LIBCORE
int i;
{
#ifdef WITH_LIBCORE
int i;
+ lc_opt_entry_t *be_grp_ra;
be_grp_root = lc_opt_get_grp(firm_opt_get_root(), "be");
be_grp_root = lc_opt_get_grp(firm_opt_get_root(), "be");
+ be_grp_ra = lc_opt_get_grp(be_grp_root, "ra");
lc_opt_add_table(be_grp_root, be_main_options);
lc_opt_add_table(be_grp_root, be_main_options);
- /* register
register
allocator options */
+ /* register allocator options */
for(i = 0; ra_items[i].name != NULL; ++i) {
const be_ra_t *ra = ra_items[i].value;
for(i = 0; ra_items[i].name != NULL; ++i) {
const be_ra_t *ra = ra_items[i].value;
- ra->register_options(be_grp_r
oot
);
+ ra->register_options(be_grp_r
a
);
}
/* register isa options */
}
/* register isa options */
@@
-163,13
+167,13
@@
void be_init(void)
phi_class_init();
}
phi_class_init();
}
-static be_main_env_t *be_init_env(be_main_env_t *env
, FILE *file_handle
)
+static be_main_env_t *be_init_env(be_main_env_t *env)
{
obstack_init(&env->obst);
env->dbg = firm_dbg_register("be.main");
env->arch_env = obstack_alloc(&env->obst, sizeof(env->arch_env[0]));
{
obstack_init(&env->obst);
env->dbg = firm_dbg_register("be.main");
env->arch_env = obstack_alloc(&env->obst, sizeof(env->arch_env[0]));
- arch_env_init(env->arch_env, isa_if
, file_handle
);
+ arch_env_init(env->arch_env, isa_if);
/* Register the irn handler of the architecture */
if (arch_isa_get_irn_handler(env->arch_env->isa))
/* Register the irn handler of the architecture */
if (arch_isa_get_irn_handler(env->arch_env->isa))
@@
-180,9
+184,7
@@
static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle)
* This irn handler takes care of the platform independent
* spill, reload and perm nodes.
*/
* This irn handler takes care of the platform independent
* spill, reload and perm nodes.
*/
- env->node_factory = obstack_alloc(&env->obst, sizeof(*env->node_factory));
- be_node_factory_init(env->node_factory, env->arch_env->isa);
- arch_env_add_irn_handler(env->arch_env, be_node_get_irn_handler(env->node_factory));
+ arch_env_add_irn_handler(env->arch_env, &be_node_irn_handler);
return env;
}
return env;
}
@@
-209,7
+211,7
@@
static void prepare_graph(be_main_env_t *s, ir_graph *irg)
remove_critical_cf_edges(irg);
/* Compute the dominance information. */
remove_critical_cf_edges(irg);
/* Compute the dominance information. */
- free_dom
_and_peace
(irg);
+ free_dom(irg);
compute_doms(irg);
/* Ensure, that the ir_edges are computed. */
compute_doms(irg);
/* Ensure, that the ir_edges are computed. */
@@
-228,7
+230,7
@@
static void be_main_loop(FILE *file_handle)
arch_isa_t *isa;
be_main_env_t env;
arch_isa_t *isa;
be_main_env_t env;
- be_init_env(&env
, file_handle
);
+ be_init_env(&env);
isa = arch_env_get_isa(env.arch_env);
isa = arch_env_get_isa(env.arch_env);
@@
-237,6
+239,7
@@
static void be_main_loop(FILE *file_handle)
ir_graph *irg = get_irp_irg(i);
arch_code_generator_t *cg;
ir_graph *irg = get_irp_irg(i);
arch_code_generator_t *cg;
+ const arch_code_generator_if_t *cg_if;
DBG((env.dbg, LEVEL_2, "====> IRG: %F\n", irg));
dump(DUMP_INITIAL, irg, "-begin", dump_ir_block_graph);
DBG((env.dbg, LEVEL_2, "====> IRG: %F\n", irg));
dump(DUMP_INITIAL, irg, "-begin", dump_ir_block_graph);
@@
-244,8
+247,11
@@
static void be_main_loop(FILE *file_handle)
/* set the current graph (this is important for several firm functions) */
current_ir_graph = irg;
/* set the current graph (this is important for several firm functions) */
current_ir_graph = irg;
+ /* Get the code generator interface. */
+ cg_if = isa->impl->get_code_generator(isa);
+
/* get a code generator for this graph. */
/* get a code generator for this graph. */
- cg =
arch_isa_make_code_generator(isa, irg
);
+ cg =
cg_if->init(file_handle, irg, env.arch_env
);
/* create the code generator and generate code. */
prepare_graph(&env, irg);
/* create the code generator and generate code. */
prepare_graph(&env, irg);
@@
-281,5
+287,6
@@
static void be_main_loop(FILE *file_handle)
void be_main(FILE *file_handle)
{
void be_main(FILE *file_handle)
{
- be_main_loop(file_handle);
+ be_node_init();
+ be_main_loop(file_handle);
}
}