From 2f5aa6031a432c4e49bb900243808d24a76f3cfb Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Mon, 14 Mar 2005 15:45:44 +0000 Subject: [PATCH 1/1] Added the bearch files to the makefile --- ir/be/Makefile.in | 2 +- ir/be/bearch.c | 14 +++++++++++++- ir/be/bearch.h | 46 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/ir/be/Makefile.in b/ir/be/Makefile.in index f3aa6c364..3de14ab41 100644 --- a/ir/be/Makefile.in +++ b/ir/be/Makefile.in @@ -15,7 +15,7 @@ srcdir = @srcdir@ topdir = ../.. subdir := ir/be -INSTALL_HEADERS = be.h +INSTALL_HEADERS = be.h bearch.h bearch_obj.def SOURCES = $(INSTALL_HEADERS) diff --git a/ir/be/bearch.c b/ir/be/bearch.c index 7aa7b555f..c00de537a 100644 --- a/ir/be/bearch.c +++ b/ir/be/bearch.c @@ -6,6 +6,8 @@ * $Id$ */ +#include + #include "bearch_t.h" #include "firm_config.h" @@ -237,7 +239,7 @@ arch_insn_t *arch_add_insn(arch_insn_format_t *fmt, const char *name) return insn; } -arch_insn_format_t *arch_find_insn_format(arch_isa_t *isa, const char *name) +arch_insn_format_t *arch_find_insn_format(const arch_isa_t *isa, const char *name) { return arch_data_find(insn_format, isa, name); } @@ -247,6 +249,11 @@ arch_isa_t *arch_find_isa(const char *name) return arch_data_find(isa, NULL, name); } +arch_insn_t *arch_find_insn(const arch_isa_t *isa, const char *name) +{ + return arch_data_find(insn, isa, name); +} + arch_register_class_t *arch_find_register_class_t(arch_isa_t *isa, const char *name) { return arch_data_find(register_class, isa, name); @@ -279,3 +286,8 @@ ir_node *arch_new_node_bare(const arch_insn_t *insn, ir_graph *irg, int arity) return arch_new_node(insn, irg, new_Unknown(mode_BB), mode_Is, arity, in); } + +ir_mode *arch_get_unknown_mode(void) +{ + return mode_Is; +} diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 743002cb7..3ba2e9069 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -2,7 +2,11 @@ #ifndef _FIRM_BEARCH_H #define _FIRM_BEARCH_H -#include "bitset.h" +#ifdef __cplusplus +extern "C" { +#endif + +struct bitset_t; /* * Define the types of the arch facility. @@ -19,7 +23,7 @@ * @param pos The number of the insn's operand to consider. * @param valid_regs A bitset where all valid registers are put. */ -typedef void (arch_register_callback_t)(ir_node *irn, int pos, bitset_t *valid_regs); +typedef void (arch_register_callback_t)(ir_node *irn, int pos, struct bitset_t *valid_regs); /** @@ -99,7 +103,7 @@ arch_insn_t *arch_add_insn(arch_insn_format_t *fmt, const char *name); * @return The instruction format, if it was added before, or NULL if it * is unknown. */ -arch_insn_format_t *arch_find_insn_format(arch_isa_t *isa, const char *name); +arch_insn_format_t *arch_find_insn_format(const arch_isa_t *isa, const char *name); /** * Find an isa. @@ -108,6 +112,14 @@ arch_insn_format_t *arch_find_insn_format(arch_isa_t *isa, const char *name); */ arch_isa_t *arch_find_isa(const char *name); +/** + * Find an sintrsuction in the instruction set architecture. + * @param isa The instruction set architecture. + * @param name The name of the instruction. + * @return The instruction or NULL if no such instruction exists. + */ +arch_insn_t *arch_find_insn(const arch_isa_t *isa, const char *name); + /** * Find a register class of an isa. * @param isa The isa. @@ -126,5 +138,33 @@ arch_register_class_t *arch_find_register_class(arch_isa_t *isa, const char *nam */ arch_register_set_t *arch_get_register_set_for_class(arch_register_class_t *cls); +/** + * Get a mode which is a placeholder for an unknown mode. + * @return Some mode to use, if you don't know which mode you will need, + * yet. + */ +ir_mode *arch_get_unknown_mode(void); + +/** + * Make a new bare instance of an insn. + * @param insn The instruction. + * @param irg The graph. + * @param arity The number of operands to reserve for the ir_node. + * @return An ir node. Its block and operands are set to an Unknown + * node. + */ +ir_node *arch_new_node_bare(const arch_insn_t *insn, ir_graph *irg, int arity); + +/** + * Make a new instance of an insn. + * This functions works like new_ir_node() and uses the op in the + * insn. + */ +ir_node *arch_new_node(const arch_insn_t *insn, ir_graph *irg, ir_node *block, + ir_mode *mode, int arity, ir_node **in); + +#ifdef __cplusplus +} +#endif #endif -- 2.20.1