Commit b41de678 authored by Matthias Braun's avatar Matthias Braun
Browse files

get rid of mode_is_datab()

Most uses in the backend should be mode_is_data() the few remaining uses
can compare with mode_b explicitely.
parent bf8ff592
......@@ -318,8 +318,6 @@ FIRM_API int mode_is_reference (const ir_mode *mode);
FIRM_API int mode_is_num (const ir_mode *mode);
/** Returns 1 if @p mode is for data values, 0 otherwise */
FIRM_API int mode_is_data (const ir_mode *mode);
/** Returns 1 if @p mode is for data values or internal booleans, 0 otherwise */
FIRM_API int mode_is_datab (const ir_mode *mode);
/**
* Returns true if a value of mode @p sm can be converted to mode @p lm without
......
......@@ -98,9 +98,6 @@ static inline ir_node *be_lv_iteration_cls_next(lv_iterator_t *iterator, be_lv_s
continue;
ir_node *node = info->node.node;
ir_mode *mode = get_irn_mode(node);
if (!mode_is_datab(mode))
continue;
if (!arch_irn_consider_in_reg_alloc(cls, node))
continue;
return node;
......
......@@ -73,7 +73,7 @@ typedef struct reg_pair_t {
static void set_reg_free(unsigned *free_regs, ir_node const *irn, bool const reg_is_free)
{
if (!mode_is_datab(get_irn_mode(irn)))
if (!mode_is_data(get_irn_mode(irn)))
return;
arch_register_t const *reg = arch_get_irn_register(irn);
if (reg_is_free) {
......@@ -377,8 +377,8 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
arch_register_req_t const *const req = arch_get_irn_register_req(other_different);
if (arch_register_req_is(req, ignore) ||
!mode_is_datab(get_irn_mode(other_different))) {
DB((dbg_constr, LEVEL_1, "ignore constraint for %+F because other_irn is ignore or not a datab node\n", irn));
!mode_is_data(get_irn_mode(other_different))) {
DB((dbg_constr, LEVEL_1, "ignore constraint for %+F because other_irn is ignore or not a data node\n", irn));
return;
}
......@@ -493,7 +493,7 @@ static void assure_constraints_walker(ir_node *block, void *walk_env)
sched_foreach_reverse(block, irn) {
be_foreach_value(irn, value,
if (mode_is_datab(get_irn_mode(value)))
if (mode_is_data(get_irn_mode(value)))
assure_different_constraints(value, irn, env);
);
}
......
......@@ -1105,7 +1105,7 @@ void be_set_phi_reg_req(ir_node *node, const arch_register_req_t *req)
info->in_reqs[i] = req;
}
assert(mode_is_datab(get_irn_mode(node)));
assert(mode_is_data(get_irn_mode(node)));
}
void be_dump_phi_reg_reqs(FILE *F, const ir_node *node, dump_reason_t reason)
......
......@@ -26,7 +26,7 @@ static char _mark;
typedef struct trace_irn {
sched_timestep_t delay; /**< The delay for this node if already calculated, else 0. */
sched_timestep_t etime; /**< The earliest time of this node. */
unsigned num_user; /**< The number real users (mode datab) of this node */
unsigned num_user; /**< The number real users (mode data) of this node */
int reg_diff; /**< The difference of num(out registers) - num(in registers) */
int preorder; /**< The pre-order position */
unsigned critical_path_len; /**< The weighted length of the longest critical path */
......@@ -232,7 +232,7 @@ static sched_timestep_t latency(trace_env_t *env, ir_node *pred, int pred_cycle,
}
/**
* Returns the number of users of a node having mode datab.
* Returns the number of users of a node having mode data.
*/
static int get_num_successors(ir_node *irn)
{
......@@ -246,7 +246,7 @@ static int get_num_successors(ir_node *irn)
if (mode == mode_T)
sum += get_num_successors(proj);
else if (mode_is_datab(mode))
else if (mode_is_data(mode))
sum += get_irn_n_edges(proj);
}
}
......@@ -277,21 +277,21 @@ static int get_reg_difference(trace_env_t *env, ir_node *irn)
}
if (get_irn_mode(irn) == mode_T) {
/* mode_T nodes: num out regs == num Projs with mode datab */
/* mode_T nodes: num out regs == num Projs with mode data */
foreach_out_edge(irn, edge) {
ir_node *proj = get_edge_src_irn(edge);
if (mode_is_datab(get_irn_mode(proj)))
if (mode_is_data(get_irn_mode(proj)))
num_out++;
}
}
else
num_out = 1;
/* num in regs: number of ins with mode datab and not ignore */
/* num in regs: number of ins with mode data and not ignore */
for (i = get_irn_arity(irn) - 1; i >= 0; i--) {
ir_node *in = get_irn_n(irn, i);
if (!mode_is_datab(get_irn_mode(in)))
if (!mode_is_data(get_irn_mode(in)))
continue;
if (arch_irn_is_ignore(in))
......
......@@ -315,7 +315,7 @@ ir_tarval *get_mode_max(ir_mode *mode)
ir_tarval *get_mode_null(ir_mode *mode)
{
assert(mode);
assert(mode_is_datab(mode));
assert(mode_is_data(mode) || mode == mode_b);
return mode->null;
}
......@@ -323,7 +323,7 @@ ir_tarval *get_mode_null(ir_mode *mode)
ir_tarval *get_mode_one(ir_mode *mode)
{
assert(mode);
assert(mode_is_datab(mode));
assert(mode_is_data(mode) || mode == mode_b);
return mode->one;
}
......@@ -339,7 +339,7 @@ ir_tarval *get_mode_minus_one(ir_mode *mode)
ir_tarval *get_mode_all_one(ir_mode *mode)
{
assert(mode);
assert(mode_is_datab(mode));
assert(mode_is_data(mode) || mode == mode_b);
return mode->all_one;
}
......@@ -394,11 +394,6 @@ int (mode_is_data)(const ir_mode *mode)
return mode_is_data_(mode);
}
int (mode_is_datab)(const ir_mode *mode)
{
return mode_is_datab_(mode);
}
unsigned (get_mode_mantissa_size)(const ir_mode *mode)
{
return get_mode_mantissa_size_(mode);
......
......@@ -32,7 +32,6 @@
#define mode_is_reference(mode) mode_is_reference_(mode)
#define mode_is_num(mode) mode_is_num_(mode)
#define mode_is_data(mode) mode_is_data_(mode)
#define mode_is_datab(mode) mode_is_datab_(mode)
#define get_type_for_mode(mode) get_type_for_mode_(mode)
#define get_mode_mantissa_size(mode) get_mode_mantissa_size_(mode)
#define get_mode_exponent_size(mode) get_mode_exponent_size_(mode)
......@@ -64,8 +63,8 @@ static inline void *get_mode_link_(const ir_mode *mode) { return mode->link; }
static inline void set_mode_link_(ir_mode *mode, void *l) { mode->link = l; }
/* Functions to check, whether a mode is signed, float, int, num, data,
datab. For more exact definitions read the corresponding pages
/* Functions to check, whether a mode is signed, float, int, num, data.
For more exact definitions read the corresponding pages
in the firm documentation or the following enumeration
The set of "float" is defined as:
......@@ -87,13 +86,7 @@ static inline void set_mode_link_(ir_mode *mode, void *l) { mode->link = l; }
data = {irm_F, irm_D, irm_E irm_Bs, irm_Bu, irm_Hs, irm_Hu,
irm_Is, irm_Iu, irm_Ls, irm_Lu, irm_C, irm_U, irm_P}
= {num || irm_C || irm_U || irm_P}
The set of "datab" is defined as:
---------------------------------
datab = {irm_F, irm_D, irm_E, irm_Bs, irm_Bu, irm_Hs, irm_Hu,
irm_Is, irm_Iu, irm_Ls, irm_Lu, irm_C, irm_U, irm_P, irm_b}
= {data || irm_b }
*/
*/
static inline int mode_is_signed_(const ir_mode *mode)
{
......@@ -125,11 +118,6 @@ static inline int mode_is_data_(const ir_mode *mode)
return (get_mode_sort(mode) & irmsh_is_data);
}
static inline int mode_is_datab_(const ir_mode *mode)
{
return (get_mode_sort(mode) & irmsh_is_datab);
}
static inline ir_type *get_type_for_mode_(const ir_mode *mode)
{
return mode->type;
......
......@@ -89,7 +89,6 @@ struct ir_op {
enum ir_mode_sort_helper {
irmsh_is_num = 0x10, /**< mode represents a number */
irmsh_is_data = 0x20, /**< mode represents data (can be carried in registers) */
irmsh_is_datab = 0x40, /**< mode represents data or is internal boolean */
};
/**
......@@ -107,17 +106,17 @@ typedef enum ir_mode_sort {
/** Internal boolean representation.
Storing to memory impossible, convert first. (irm_b) */
irms_internal_boolean = 6 | irmsh_is_datab,
irms_internal_boolean = 6,
/** A mode to represent entities.
Restricted int computations can be performed */
irms_reference = 7 | irmsh_is_data | irmsh_is_datab,
irms_reference = 7 | irmsh_is_data,
/** A mode to represent int numbers.
Integer computations can be performed. */
irms_int_number = 8 | irmsh_is_data | irmsh_is_datab | irmsh_is_num,
irms_int_number = 8 | irmsh_is_data | irmsh_is_num,
/** A mode to represent float numbers.
Floating point computations can be performed. */
irms_float_number = 9 | irmsh_is_data | irmsh_is_datab | irmsh_is_num,
irms_float_number = 9 | irmsh_is_data | irmsh_is_num,
} ir_mode_sort;
/**
......
......@@ -492,6 +492,11 @@ static int verify_node_Raise(const ir_node *n)
return fine;
}
static int mode_is_datab(const ir_mode *mode)
{
return mode_is_data(mode) || mode == mode_b;
}
static int verify_node_Const(const ir_node *n)
{
bool fine = check_mode_func(n, mode_is_datab, "data or b");
......
......@@ -619,7 +619,7 @@ static void undate_block_info(ir_node *node, graph_entry_t *graph)
block = get_nodes_block(node);
b_entry = block_get_entry(&graph->recalc_cnts, get_irn_node_nr(block), graph->block_hash);
if (is_Phi(node) && mode_is_datab(get_irn_mode(node))) {
if (is_Phi(node) && get_irn_mode(node) != mode_M) {
/* count data Phi per block */
cnt_inc(&b_entry->cnt[bcnt_phi_data]);
}
......
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