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

be: Factorise common dump formatters for booleans and registers.

This replaces several 1/0 and true/false by yes/no.
parent b745f81b
...@@ -98,10 +98,8 @@ static void arm_dump_node(FILE *F, const ir_node *n, dump_reason_t reason) ...@@ -98,10 +98,8 @@ static void arm_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
ir_fprintf(F, "load_store_mode = %+F\n", attr->load_store_mode); ir_fprintf(F, "load_store_mode = %+F\n", attr->load_store_mode);
ir_fprintf(F, "entity = %+F\n", attr->entity); ir_fprintf(F, "entity = %+F\n", attr->entity);
fprintf(F, "offset = %ld\n", attr->offset); fprintf(F, "offset = %ld\n", attr->offset);
fprintf(F, "is_frame_entity = %s\n", fprintf(F, "is_frame_entity = %s\n", be_dump_yesno(attr->is_frame_entity));
attr->is_frame_entity ? "yes" : "no"); fprintf(F, "entity_sign = %s\n", be_dump_yesno(attr->entity_sign));
fprintf(F, "entity_sign = %s\n",
attr->entity_sign ? "yes" : "no");
} }
if (has_shifter_operand(n)) { if (has_shifter_operand(n)) {
const arm_shifter_operand_t *attr const arm_shifter_operand_t *attr
......
...@@ -243,14 +243,14 @@ void be_dump_reqs_and_registers(FILE *F, const ir_node *node) ...@@ -243,14 +243,14 @@ void be_dump_reqs_and_registers(FILE *F, const ir_node *node)
fprintf(F, "inreq #%d = ", i); fprintf(F, "inreq #%d = ", i);
dump_register_req(F, req); dump_register_req(F, req);
arch_register_t const *const reg = be_get_info(skip_Proj_const(op))->out_infos ? arch_get_irn_register(op) : NULL; arch_register_t const *const reg = be_get_info(skip_Proj_const(op))->out_infos ? arch_get_irn_register(op) : NULL;
fprintf(F, " [%s]\n", reg ? reg->name : "n/a"); fprintf(F, " [%s]\n", be_dump_reg_name(reg));
} }
be_foreach_out(node, o) { be_foreach_out(node, o) {
const arch_register_req_t *req = arch_get_irn_register_req_out(node, o); const arch_register_req_t *req = arch_get_irn_register_req_out(node, o);
fprintf(F, "outreq #%u = ", o); fprintf(F, "outreq #%u = ", o);
dump_register_req(F, req); dump_register_req(F, req);
const arch_register_t *reg = arch_get_irn_register_out(node, o); const arch_register_t *reg = arch_get_irn_register_out(node, o);
fprintf(F, " [%s]\n", reg != NULL ? reg->name : "n/a"); fprintf(F, " [%s]\n", be_dump_reg_name(reg));
} }
fprintf(F, "flags ="); fprintf(F, "flags =");
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include "firm_types.h"
#include "be_types.h" #include "bearch.h"
/** /**
* Dump interference graph * Dump interference graph
...@@ -42,4 +42,14 @@ void be_dump_liveness_block(be_lv_t *lv, FILE *F, const ir_node *block); ...@@ -42,4 +42,14 @@ void be_dump_liveness_block(be_lv_t *lv, FILE *F, const ir_node *block);
void be_dump_reqs_and_registers(FILE *F, const ir_node *node); void be_dump_reqs_and_registers(FILE *F, const ir_node *node);
static inline char const *be_dump_reg_name(arch_register_t const *const reg)
{
return reg ? reg->name : "n/a";
}
static inline char const *be_dump_yesno(bool const b)
{
return b ? "yes" : "no";
}
#endif #endif
...@@ -224,13 +224,13 @@ static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason) ...@@ -224,13 +224,13 @@ static void ia32_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
fprintf(F, "condition_code = <invalid (0x%X)>\n", fprintf(F, "condition_code = <invalid (0x%X)>\n",
(unsigned)get_ia32_condcode(n)); (unsigned)get_ia32_condcode(n));
} }
fprintf(F, "ins_permuted = %u\n", (unsigned)attr->ins_permuted); fprintf(F, "ins_permuted = %s\n", be_dump_yesno(attr->ins_permuted));
} else if (is_ia32_CopyB(n) || is_ia32_CopyB_i(n)) { } else if (is_ia32_CopyB(n) || is_ia32_CopyB_i(n)) {
fprintf(F, "size = %u\n", get_ia32_copyb_size(n)); fprintf(F, "size = %u\n", get_ia32_copyb_size(n));
} }
fprintf(F, "commutative = %d\n", is_ia32_commutative(n)); fprintf(F, "commutative = %s\n", be_dump_yesno(is_ia32_commutative(n)));
fprintf(F, "is reload = %d\n", is_ia32_is_reload(n)); fprintf(F, "is reload = %s\n", be_dump_yesno(is_ia32_is_reload(n)));
fprintf(F, "latency = %u\n", get_ia32_latency(n)); fprintf(F, "latency = %u\n", get_ia32_latency(n));
/* dump frame entity */ /* dump frame entity */
......
...@@ -90,15 +90,14 @@ static void sparc_dump_node(FILE *F, const ir_node *n, dump_reason_t reason) ...@@ -90,15 +90,14 @@ static void sparc_dump_node(FILE *F, const ir_node *n, dump_reason_t reason)
if (sparc_has_load_store_attr(n)) { if (sparc_has_load_store_attr(n)) {
const sparc_load_store_attr_t *attr = get_sparc_load_store_attr_const(n); const sparc_load_store_attr_t *attr = get_sparc_load_store_attr_const(n);
ir_fprintf(F, "load store mode: %+F\n", attr->load_store_mode); ir_fprintf(F, "load store mode: %+F\n", attr->load_store_mode);
fprintf(F, "is frame entity: %s\n", fprintf(F, "is frame entity: %s\n", be_dump_yesno(attr->is_frame_entity));
attr->is_frame_entity ? "true" : "false");
} }
if (has_jmp_cond_attr(n)) { if (has_jmp_cond_attr(n)) {
const sparc_jmp_cond_attr_t *attr const sparc_jmp_cond_attr_t *attr
= get_sparc_jmp_cond_attr_const(n); = get_sparc_jmp_cond_attr_const(n);
fprintf(F, "relation: %d (%s)\n", (int)attr->relation, fprintf(F, "relation: %d (%s)\n", (int)attr->relation,
get_relation_string(attr->relation)); get_relation_string(attr->relation));
fprintf(F, "unsigned: %s\n", attr->is_unsigned ? "true" : "false"); fprintf(F, "unsigned: %s\n", be_dump_yesno(attr->is_unsigned));
} }
if (has_fp_attr(n)) { if (has_fp_attr(n)) {
const sparc_fp_attr_t *attr = get_sparc_fp_attr_const(n); const sparc_fp_attr_t *attr = get_sparc_fp_attr_const(n);
......
Supports Markdown
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