Commit 233d0973 authored by Matthias Braun's avatar Matthias Braun
Browse files

cleanup, use C99

parent ad0dcd8e
......@@ -207,10 +207,10 @@ void analyze_irg_args(ir_graph *irg)
return;
ir_entity *entity = get_irg_entity(irg);
if (! entity)
if (entity == NULL)
return;
if (! entity->attr.mtd_attr.param_access)
if (!entity->attr.mtd_attr.param_access)
analyze_ent_args(entity);
}
......
......@@ -647,7 +647,7 @@ static ir_graph *find_tail(const ir_graph *n)
if (is_head(m, n)) {
found = smallest_dfn_pred(m, get_irg_dfn(m) + 1, &res_index);
if (! found) /* no smallest dfn pred found. */
if (!found) /* no smallest dfn pred found. */
found = largest_dfn_pred(m, &res_index);
break;
......@@ -662,7 +662,7 @@ static ir_graph *find_tail(const ir_graph *n)
}
if (! found) {
if (!found) {
/* A dead loop not reachable from Start. */
for (size_t i = tos-1; i > 0;) {
m = stack[--i];
......
......@@ -620,7 +620,7 @@ static void callee_ana_node(ir_node *node, pset *methods)
*/
static void callee_walker(ir_node *call, void *env)
{
(void) env;
(void)env;
if (!is_Call(call))
return;
......
......@@ -277,7 +277,7 @@ static double max_freq;
static void collect_freqs(ir_node *node, void *data)
{
(void) data;
(void)data;
double freq = get_block_execfreq(node);
if (freq > max_freq)
max_freq = freq;
......
......@@ -42,9 +42,9 @@ static int current_dfn = 1;
* construction.
*/
typedef struct scc_info {
int in_stack; /**< Marks whether node is on the stack. */
int dfn; /**< Depth first search number. */
int uplink; /**< dfn number of ancestor. */
bool in_stack; /**< Marks whether node is on the stack. */
int dfn; /**< Depth first search number. */
int uplink; /**< dfn number of ancestor. */
} scc_info;
/** Allocate a new scc_info on the given obstack */
......@@ -59,7 +59,7 @@ static inline scc_info *new_scc_info(struct obstack *obst)
static inline void mark_irn_in_stack(ir_node *n)
{
scc_info *info = (scc_info*) get_irn_link(n);
info->in_stack = 1;
info->in_stack = true;
}
/**
......@@ -68,13 +68,13 @@ static inline void mark_irn_in_stack(ir_node *n)
static inline void mark_irn_not_in_stack(ir_node *n)
{
scc_info *info = (scc_info*) get_irn_link(n);
info->in_stack = 0;
info->in_stack = false;
}
/**
* Returns whether node n is on the stack.
*/
static inline int irn_is_in_stack(ir_node *n)
static inline bool irn_is_in_stack(const ir_node *n)
{
scc_info *info = (scc_info*) get_irn_link(n);
return info->in_stack;
......@@ -293,10 +293,9 @@ static inline void finish_scc(void)
*/
static int is_head(ir_node *n, ir_node *root)
{
(void) root;
(void)root;
bool some_outof_loop = false;
bool some_in_loop = false;
for (int i = 0, arity = get_Block_n_cfgpreds(n); i < arity; i++) {
ir_node *pred = get_Block_cfgpred_block(n, i);
/* ignore Bad control flow: it cannot happen */
......@@ -325,11 +324,11 @@ static int is_head(ir_node *n, ir_node *root)
*/
static int is_endless_head(ir_node *n, ir_node *root)
{
(void) root;
bool none_outof_loop = true;
bool some_in_loop = false;
(void)root;
/* Test for legal loop header: Block, Phi, ... */
bool none_outof_loop = true;
bool some_in_loop = false;
for (int i = 0, arity = get_Block_n_cfgpreds(n); i < arity; i++) {
ir_node *pred = get_Block_cfgpred_block(n, i);
/* ignore Bad control flow: it cannot happen */
......@@ -400,7 +399,7 @@ static int largest_dfn_pred(ir_node *n)
*/
static ir_node *find_tail(ir_node *n)
{
int res_index = -2;
int res_index = -2;
ir_node *m = stack[tos - 1]; /* tos = top of stack */
if (is_head(m, n)) {
......@@ -458,7 +457,7 @@ static ir_node *find_tail(ir_node *n)
/**
* returns non.zero if l is the outermost loop.
*/
inline static int is_outermost_loop(ir_loop *l)
inline static bool is_outermost_loop(const ir_loop *l)
{
return l == get_loop_outer_loop(l);
}
......
......@@ -98,7 +98,7 @@ static void handle_case(ir_node *block, ir_node *switchn, unsigned pn, env_t *en
foreach_out_edge_safe(selector, edge) {
ir_node *succ = get_edge_src_irn(edge);
int pos = get_edge_src_pos(edge);
int pos = get_edge_src_pos(edge);
ir_node *blk = get_effective_use_block(succ, pos);
if (block_dominates(block, blk)) {
......@@ -138,7 +138,7 @@ static void handle_modeb(ir_node *block, ir_node *selector, pn_Cond pnc, env_t *
foreach_out_edge_safe(selector, edge) {
ir_node *user = get_edge_src_irn(edge);
int pos = get_edge_src_pos(edge);
int pos = get_edge_src_pos(edge);
ir_node *user_blk = get_effective_use_block(user, pos);
if (block_dominates(block, user_blk)) {
......@@ -243,11 +243,9 @@ static void handle_modeb(ir_node *block, ir_node *selector, pn_Cond pnc, env_t *
*/
static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
{
/* Beware of Bads */
ir_node *left = get_Cmp_left(cmp);
ir_node *right = get_Cmp_right(cmp);
ir_node *cond_block;
/* Beware of Bads */
if (is_Bad(left) || is_Bad(right))
return;
......@@ -280,7 +278,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
* replace the left one by the right (potentially const) one.
*/
if (rel == ir_relation_equal) {
cond_block = get_Block_cfgpred_block(block, 0);
ir_node *cond_block = get_Block_cfgpred_block(block, 0);
foreach_out_edge_safe(left, edge) {
ir_node *user = get_edge_src_irn(edge);
int pos = get_edge_src_pos(edge);
......@@ -339,7 +337,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
foreach_out_edge_safe(left, edge) {
ir_node *succ = get_edge_src_irn(edge);
int pos = get_edge_src_pos(edge);
int pos = get_edge_src_pos(edge);
ir_node *blk = get_effective_use_block(succ, pos);
if (block_dominates(block, blk)) {
......@@ -348,7 +346,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
* dominated by the branch block.
* We can replace the input with a Confirm(left, pnc, right).
*/
if (! c)
if (c == NULL)
c = new_r_Confirm(block, left, right, rel);
pos = get_edge_src_pos(edge);
......@@ -359,7 +357,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
}
}
if (! is_Const(right)) {
if (!is_Const(right)) {
/* also construct inverse Confirms */
ir_node *rc = NULL;
......@@ -378,7 +376,7 @@ static void handle_if(ir_node *block, ir_node *cmp, ir_relation rel, env_t *env)
* dominated by the branch block.
* We can replace the input with a Confirm(right, rel^-1, left).
*/
if (! rc)
if (rc == NULL)
rc = new_r_Confirm(block, right, left, rel);
pos = get_edge_src_pos(edge);
......@@ -405,7 +403,7 @@ static void insert_Confirm_in_block(ir_node *block, void *data)
return;
ir_node *proj = get_Block_cfgpred(block, 0);
if (! is_Proj(proj))
if (!is_Proj(proj))
return;
env_t *env = (env_t*)data;
......@@ -415,19 +413,15 @@ static void insert_Confirm_in_block(ir_node *block, void *data)
handle_case(block, cond, proj_nr, env);
} else if (is_Cond(cond)) {
ir_node *selector = get_Cond_selector(cond);
ir_relation rel;
handle_modeb(block, selector, (pn_Cond) get_Proj_num(proj), env);
if (! is_Cmp(selector))
if (!is_Cmp(selector))
return;
rel = get_Cmp_relation(selector);
ir_relation rel = get_Cmp_relation(selector);
if (get_Proj_num(proj) != pn_Cond_true) {
/* it's the false branch */
/* it's the false branch */
if (get_Proj_num(proj) != pn_Cond_true)
rel = get_negated_relation(rel);
}
DB((dbg, LEVEL_2, "At %+F using %+F Confirm %=\n", block, selector, rel));
handle_if(block, selector, rel, env);
......@@ -440,7 +434,7 @@ static void insert_Confirm_in_block(ir_node *block, void *data)
static bool is_non_null_Confirm(const ir_node *ptr)
{
for (;;) {
if (! is_Confirm(ptr))
if (!is_Confirm(ptr))
break;
if (get_Confirm_relation(ptr) == ir_relation_less_greater) {
ir_node *bound = get_Confirm_bound(ptr);
......@@ -474,7 +468,7 @@ static void insert_non_null(ir_node *ptr, ir_node *block, env_t *env)
foreach_out_edge_safe(ptr, edge) {
/* for now, we place a Confirm only in front of a Cmp */
ir_node *succ = get_edge_src_irn(edge);
if (! is_Cmp(succ))
if (!is_Cmp(succ))
continue;
int pos = get_edge_src_pos(edge);
......@@ -514,13 +508,13 @@ static void insert_Confirm(ir_node *node, void *data)
break;
case iro_Load: {
ir_node *ptr = get_Load_ptr(node);
if (! is_non_null_Confirm(ptr))
if (!is_non_null_Confirm(ptr))
insert_non_null(ptr, get_nodes_block(node), env);
break;
}
case iro_Store: {
ir_node *ptr = get_Store_ptr(node);
if (! is_non_null_Confirm(ptr))
if (!is_non_null_Confirm(ptr))
insert_non_null(ptr, get_nodes_block(node), env);
break;
}
......@@ -539,8 +533,7 @@ void construct_confirms(ir_graph *irg)
| IR_GRAPH_PROPERTY_NO_BADS
| IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES);
assert(get_irg_pinned(irg) == op_pin_state_pinned &&
"Nodes must be placed to insert Confirms");
assert(get_irg_pinned(irg) == op_pin_state_pinned);
env_t env;
env.num_confirms = 0;
......@@ -566,7 +559,7 @@ void construct_confirms(ir_graph *irg)
static void remove_confirm(ir_node *n, void *env)
{
(void) env;
(void)env;
if (!is_Confirm(n))
return;
......
......@@ -308,7 +308,7 @@ unsigned lv_chk_bl_xxx(lv_chk_t *lv, const ir_node *bl, const ir_node *var)
*/
const bl_info_t *bli = get_block_info(lv, bl);
const bl_info_t *def = get_block_info(lv, def_bl);
(void) def;
(void)def;
DBG((lv->dbg, LEVEL_2,
"lv check %+F (def in %+F #%d) in different block %+F #%d\n",
var, def_bl, def->id, bl, bli->id));
......
......@@ -837,7 +837,7 @@ static void print_entity_usage_flags(const ir_type *tp)
*/
static void check_global_address(ir_node *irn, void *data)
{
(void) data;
(void)data;
if (!is_Address(irn))
return;
......
......@@ -360,7 +360,7 @@ static bool is_head(ir_node *n, ir_node *root)
if (is_backedge(n, i))
continue;
pred = get_irn_n(n, i);
if (! irn_is_in_stack(pred)) {
if (!irn_is_in_stack(pred)) {
some_outof_loop = true;
} else {
assert(get_irn_uplink(pred) >= uplink);
......
......@@ -482,7 +482,7 @@ static void vrp_first_pass(ir_node *n, void *e)
static void dump_vrp_info(void *ctx, FILE *F, const ir_node *node)
{
(void) ctx;
(void)ctx;
if (!mode_is_int(get_irn_mode(node)))
return;
......
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