Commit b8d2203a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Factor out the common code to emit jump label names.

parent 87986ce0
......@@ -632,8 +632,7 @@ static void emit_amd64_jmp(const ir_node *node)
static void emit_jumptable_target(ir_entity const *const table,
ir_node const *const proj_x)
{
ir_node const *const block = be_emit_get_cfop_target(proj_x);
be_gas_emit_block_name(block);
be_emit_cfop_target(proj_x);
if (be_options.pic_style != BE_PIC_NONE) {
be_emit_char('-');
be_gas_emit_entity(table);
......
......@@ -226,15 +226,6 @@ static void emit_constant_name(const ent_or_tv_t *entry)
be_emit_irprintf("%sC%u", be_gas_get_private_prefix(), entry->label);
}
/**
* Emit the target label for a control flow node.
*/
static void arm_emit_cfop_target(const ir_node *irn)
{
ir_node *block = be_emit_get_cfop_target(irn);
be_gas_emit_block_name(block);
}
void arm_emitf(const ir_node *node, const char *format, ...)
{
BE_EMITF(node, format, ap, false) {
......@@ -439,7 +430,7 @@ static void emit_jumptable_target(ir_entity const *const table,
ir_node const *const proj_x)
{
(void)table;
arm_emit_cfop_target(proj_x);
be_emit_cfop_target(proj_x);
}
static void emit_arm_SwitchJmp(const ir_node *irn)
......
......@@ -13,6 +13,7 @@
#include "bedwarf.h"
#include "beemitter.h"
#include "be_t.h"
#include "begnuas.h"
#include "benode.h"
#include "dbginfo.h"
#include "debug.h"
......@@ -85,3 +86,9 @@ be_cond_branch_projs_t be_get_cond_branch_projs(ir_node const *const node)
assert(projs.f && projs.t);
return projs;
}
void be_emit_cfop_target(ir_node const *const jmp)
{
ir_node *const target = be_emit_get_cfop_target(jmp);
be_gas_emit_block_name(target);
}
......@@ -78,6 +78,11 @@ typedef struct be_cond_branch_projs_t {
be_cond_branch_projs_t be_get_cond_branch_projs(ir_node const *node);
/**
* Emit the target label for a control flow node.
*/
void be_emit_cfop_target(ir_node const *jmp);
#define BE_EMITF(node, fmt, ap, in_delay_slot) \
va_list ap; \
va_start(ap, fmt); \
......@@ -99,7 +104,7 @@ be_cond_branch_projs_t be_get_cond_branch_projs(ir_node const *node);
be_emit_char('%'); \
} else if (*fmt == 'L') { \
++fmt; \
be_gas_emit_block_name(be_emit_get_cfop_target(va_arg(ap, ir_node const*))); \
be_emit_cfop_target(va_arg(ap, ir_node const*)); \
} else
#endif
......@@ -267,15 +267,6 @@ static void ia32_emit_xmm_mode_suffix(ir_node const *const node)
be_emit_char(get_xmm_mode_suffix(attr->size));
}
/**
* Emits the target label for a control flow node.
*/
static void ia32_emit_cfop_target(const ir_node *node)
{
ir_node *block = be_emit_get_cfop_target(node);
be_gas_emit_block_name(block);
}
void x86_emit_condition_code(x86_condition_code_t cc)
{
switch (cc) {
......@@ -772,8 +763,7 @@ void ia32_emit_jumptable_target(ir_entity const *const table,
ir_node const *const proj_x)
{
(void)table;
ir_node const *const block = be_emit_get_cfop_target(proj_x);
be_gas_emit_block_name(block);
be_emit_cfop_target(proj_x);
switch (be_options.pic_style) {
case BE_PIC_NONE:
break;
......@@ -1268,7 +1258,7 @@ static void ia32_assign_exc_label(ir_node *node)
be_emit_char(':');
be_emit_pad_comment();
be_emit_cstring("/* exception to Block ");
ia32_emit_cfop_target(node);
be_emit_cfop_target(node);
be_emit_cstring(" */\n");
be_emit_write_line();
}
......
......@@ -179,15 +179,6 @@ static void emit_fp_suffix(const ir_mode *mode)
}
}
/**
* Returns the target label for a control flow node.
*/
static void sparc_emit_cfop_target(const ir_node *node)
{
ir_node *block = be_emit_get_cfop_target(node);
be_gas_emit_block_name(block);
}
/**
* returns true if a sparc_call calls a register and not an immediate
*/
......@@ -1173,7 +1164,7 @@ static void emit_jumptable_target(ir_entity const *const table,
ir_node const *const proj_x)
{
(void)table;
sparc_emit_cfop_target(proj_x);
be_emit_cfop_target(proj_x);
}
static void emit_sparc_IJmp(ir_node const *const node)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment