From: Christian Würdig Date: Tue, 25 Oct 2005 07:58:55 +0000 (+0000) Subject: architecture independent part of the codegen module X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f674321deecaed3edc0f3d0ff2ef9bdb3fb2bdcf;p=libfirm architecture independent part of the codegen module --- diff --git a/ir/be/firm2arch.c b/ir/be/firm2arch.c new file mode 100644 index 000000000..792c4fd21 --- /dev/null +++ b/ir/be/firm2arch.c @@ -0,0 +1,67 @@ +/** + * Dumps Firm into CPU specific assembler format (the concrete + * implementations can be found in the subdirectories) + * @author Christian Wuerdig + * @date 18.10.2005 + * @version $Id$ + */ + +#include +#include + +#include "firm2arch.h" + +/** + * Transforms all irgs into assembler irgs. + * Calls the interface function transform_node() which + * needs to be implemented for each architecture. + */ +void transform_firm() { + int i; + + for (i = 0; i < get_irp_n_irgs(); i++) { + ir_graph *irg = get_irp_irg(i); + + if (! is_pseudo_ir_graph(irg)) { + irg_walk_blkwise_graph(irg, NULL, transform_node, NULL); + } + } +} + +/** + * Finishes the firm transformation. This function is called + * after register allocation and scheduling to build everything + * which can only be build after those phases e.g. function prolog + * and epilog. + * Calls the interface function finish_node_transformation which needs + * to be implemented for each architecture. + */ +void finish_transform() { + int i; + + for (i = 0; i < get_irp_n_irgs(); i++) { + ir_graph *irg = get_irp_irg(i); + + if (! is_pseudo_ir_graph(irg)) { + // irg_walk_blkwise_graph(irg, NULL, finish_node_transformation, NULL); + } + } +} + +/** + * Generates the architecture specific assembler code. + * Calls the interface functions firmbe_gen_decls() (dumps all global + * decls) and firmbe_gen_routine() (generates code for all routines) which + * need to be implemented for each architecture. + */ +void firmbe_gen_code(FILE *out) { + int i; + +// firmbe_gen_decls(out); + for (i = 0; i < get_irp_n_irgs(); ++i) { + ir_graph *irg = get_irp_irg(i); + +// if (! is_pseudo_ir_graph(irg)) + // firmbe_gen_routine(out, irg); + } +} diff --git a/ir/be/firm2arch.h b/ir/be/firm2arch.h new file mode 100644 index 000000000..fa148aa42 --- /dev/null +++ b/ir/be/firm2arch.h @@ -0,0 +1,21 @@ +#ifndef FIRM2ARCH_H +#define FIRM2ARCH_H + +#include + +void create_bearch_asm_opcodes(void); + +void transform_firm(void); + +extern void transform_node(ir_node *node, void *env); + +void finish_transform(void); + +extern void finish_node_transformation(ir_node *node, void *env); + +void firmbe_gen_code(FILE *out); + +extern void firmbe_gen_decls(FILE *out); +extern void firmbe_gen_routine(FILE *out, ir_graph *irg); + +#endif diff --git a/ir/be/firm2arch_nodes_attr.h b/ir/be/firm2arch_nodes_attr.h new file mode 100644 index 000000000..538b8b335 --- /dev/null +++ b/ir/be/firm2arch_nodes_attr.h @@ -0,0 +1,9 @@ +#ifndef NODES_ATTR_H +#define NODES_ATTR_H + +typedef struct { + tarval *tv; + void *reg_constraints; +} asmop_attr; + +#endif