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

sparc: Factor out code to check for a conditional branch.

parent db599866
......@@ -446,9 +446,8 @@ static ir_node *pick_delay_slot_for(ir_node *node)
static const unsigned PICK_DELAY_SLOT_MAX_DISTANCE = 10;
assert(has_delay_slot(node));
if (is_sparc_Bicc(node) || is_sparc_fbfcc(node)) {
if (is_sparc_cond_branch(node))
optimize_fallthrough(node);
}
unsigned tries = 0;
sched_foreach_reverse_before(node, schedpoint) {
......@@ -509,7 +508,7 @@ static ir_node *pick_delay_slot_for(ir_node *node)
if (can_move_up_into_delayslot(schedpoint, node)) {
/* it's fine to move the insn across blocks */
return schedpoint;
} else if (is_sparc_Bicc(node) || is_sparc_fbfcc(node)) {
} else if (is_sparc_cond_branch(node)) {
ir_node *proj = get_Block_cfgpred(succ, 0);
unsigned nr = get_Proj_num(proj);
if ((nr == pn_sparc_Bicc_true || nr == pn_sparc_fbfcc_true)
......
......@@ -36,11 +36,6 @@ bool sparc_has_load_store_attr(const ir_node *node)
|| is_sparc_Stf(node) || is_sparc_IJmp(node);
}
static bool has_jmp_cond_attr(const ir_node *node)
{
return is_sparc_Bicc(node) || is_sparc_fbfcc(node);
}
#ifndef NDEBUG
static bool has_switch_jmp_attr(const ir_node *node)
{
......@@ -91,7 +86,7 @@ void sparc_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
ir_fprintf(F, "load store mode: %+F\n", attr->load_store_mode);
fprintf(F, "is frame entity: %s\n", be_dump_yesno(attr->is_frame_entity));
}
if (has_jmp_cond_attr(n)) {
if (is_sparc_cond_branch(n)) {
const sparc_jmp_cond_attr_t *attr
= get_sparc_jmp_cond_attr_const(n);
fprintf(F, "relation: %d (%s)\n", (int)attr->relation,
......@@ -158,13 +153,13 @@ const sparc_load_store_attr_t *get_sparc_load_store_attr_const(const ir_node *no
sparc_jmp_cond_attr_t *get_sparc_jmp_cond_attr(ir_node *node)
{
assert(has_jmp_cond_attr(node));
assert(is_sparc_cond_branch(node));
return (sparc_jmp_cond_attr_t*) get_irn_generic_attr_const(node);
}
const sparc_jmp_cond_attr_t *get_sparc_jmp_cond_attr_const(const ir_node *node)
{
assert(has_jmp_cond_attr(node));
assert(is_sparc_cond_branch(node));
return (const sparc_jmp_cond_attr_t*) get_irn_generic_attr_const(node);
}
......
......@@ -42,4 +42,9 @@ const sparc_call_attr_t *get_sparc_call_attr_const(const ir_node *node);
/* Include the generated headers */
#include "gen_sparc_new_nodes.h"
static inline bool is_sparc_cond_branch(ir_node const *const node)
{
return is_sparc_Bicc(node) || is_sparc_fbfcc(node);
}
#endif
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