be_set_emitter(op_be_Keep, be_emit_nothing);
}
-typedef void (*emit_func_ptr) (const ir_node *);
-
-/**
- * Emits code for a node.
- */
-static void TEMPLATE_emit_node(const ir_node *node)
-{
- ir_op *op = get_irn_op(node);
-
- if (op->ops.generic) {
- emit_func_ptr func = (emit_func_ptr) op->ops.generic;
- (*func) (node);
- } else {
- ir_fprintf(stderr, "No emitter for node %+F\n", node);
- }
-}
-
/**
* Walks over the nodes in a block connected by scheduling edges
* and emits code for each node.
be_gas_begin_block(block, true);
sched_foreach(block, node) {
- TEMPLATE_emit_node(node);
+ be_emit_node(node);
}
}
be_set_emitter(op_be_Start, be_emit_nothing);
}
-typedef void (*emit_func_ptr) (const ir_node *);
-
-/**
- * Emits code for a node.
- */
-static void amd64_emit_node(const ir_node *node)
-{
- ir_op *op = get_irn_op(node);
-
- if (op->ops.generic) {
- emit_func_ptr func = (emit_func_ptr) op->ops.generic;
- (*func) (node);
- } else {
- ir_fprintf(stderr, "No emitter for node %+F\n", node);
- }
-}
-
/**
* Walks over the nodes in a block connected by scheduling edges
* and emits code for each node.
be_gas_begin_block(block, true);
sched_foreach(block, node) {
- amd64_emit_node(node);
+ be_emit_node(node);
}
}
be_set_emitter(op_be_Keep, be_emit_nothing);
}
-/**
- * Emits code for a node.
- */
-static void arm_emit_node(const ir_node *irn)
-{
- ir_op *op = get_irn_op(irn);
-
- if (op->ops.generic) {
- emit_func *emit = (emit_func *)op->ops.generic;
- be_dwarf_location(get_irn_dbg_info(irn));
- (*emit)(irn);
- } else {
- panic("Error: No emit handler for node %+F (graph %+F)\n",
- irn, get_irn_irg(irn));
- }
-}
-
/**
* emit the block label if needed.
*/
arm_emit_block_header(block, prev_block);
be_dwarf_location(get_irn_dbg_info(block));
sched_foreach(block, irn) {
- arm_emit_node(irn);
+ be_emit_node(irn);
}
}
*/
#include "config.h"
+#include "bedwarf.h"
#include "beemitter.h"
#include "be_t.h"
+#include "error.h"
#include "irnode_t.h"
#include "irprintf.h"
#include "ident.h"
{
(void)node;
}
+
+void be_emit_node(ir_node const *const node)
+{
+ be_dwarf_location(get_irn_dbg_info(node));
+ ir_op *const op = get_irn_op(node);
+ emit_func *const emit = get_generic_function_ptr(emit_func, op);
+ DEBUG_ONLY(if (!emit) panic("no emit handler for node %+F (%+G, graph %+F)\n", node, node, get_irn_irg(node));)
+ emit(node);
+}
void be_emit_nothing(ir_node const *node);
+/**
+ * Emit code for a node.
+ */
+void be_emit_node(ir_node const *node);
+
#endif
#undef IA32_EMIT
}
-typedef void (*emit_func_ptr) (const ir_node *);
-
/**
* Assign and emit an exception label if the current instruction can fail.
*/
*/
static void ia32_emit_node(ir_node *node)
{
- ir_op *op = get_irn_op(node);
-
DBG((dbg, LEVEL_1, "emitting code for %+F\n", node));
if (is_ia32_irn(node)) {
}
}
}
- if (op->ops.generic) {
- emit_func_ptr func = (emit_func_ptr) op->ops.generic;
-
- be_dwarf_location(get_irn_dbg_info(node));
- (*func) (node);
- } else {
- panic("no emit handler for node %+F (%+G, graph %+F)\n", node, node, get_irn_irg(node));
- }
+ be_emit_node(node);
if (sp_relative) {
int sp_change = arch_get_sp_bias(node);
static unsigned *delay_slot_fillers;
static pmap *delay_slots;
-static void sparc_emit_node(const ir_node *node);
static bool emitting_delay_slot;
/**
if (filler != NULL) {
assert(!is_no_instruction(filler));
assert(!emits_multiple_instructions(filler));
- sparc_emit_node(filler);
+ be_emit_node(filler);
} else {
sparc_emitf(NULL, "nop");
}
be_set_emitter(op_sparc_Start, be_emit_nothing);
}
-/**
- * Emits code for a node.
- */
-static void sparc_emit_node(const ir_node *node)
-{
- ir_op *op = get_irn_op(node);
-
- if (op->ops.generic) {
- emit_func *func = (emit_func*)op->ops.generic;
- be_dwarf_location(get_irn_dbg_info(node));
- (*func) (node);
- } else {
- panic("No emit handler for node %+F (graph %+F)\n", node,
- get_irn_irg(node));
- }
-}
-
static bool block_needs_label(const ir_node *block, const ir_node *sched_prev)
{
if (get_Block_entity(block) != NULL)
sched_foreach(block, node) {
if (rbitset_is_set(delay_slot_fillers, get_irn_idx(node)))
continue;
- sparc_emit_node(node);
+ be_emit_node(node);
}
}