Commit 847c1b62 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

cleanup: Remove pointless assert(is_${NODE}(x)) just before...

cleanup: Remove pointless assert(is_${NODE}(x)) just before get_${NODE}_${FOO}(x), which do the same assert.
parent 7cf5d1ac
......@@ -249,14 +249,11 @@ static void sel_methods_init(void)
static ir_entity ** get_Sel_arr(ir_node * sel)
{
static ir_entity ** NULL_ARRAY = NULL;
ir_entity * ent;
ir_entity ** arr;
assert(is_Sel(sel));
ent = get_Sel_entity(sel);
ir_entity *const ent = get_Sel_entity(sel);
assert(is_Method_type(get_entity_type(ent))); /* what else? */
arr = (ir_entity**) get_entity_link(ent);
ir_entity **const arr = (ir_entity**)get_entity_link(ent);
if (arr) {
return arr;
} else {
......
......@@ -327,14 +327,11 @@ static inline void finish_scc(void)
*/
static int is_head(ir_node *n, ir_node *root)
{
int i, arity;
int some_outof_loop = 0, some_in_loop = 0;
(void) root;
assert(is_Block(n));
arity = get_Block_n_cfgpreds(n);
for (i = 0; i < arity; i++) {
int const arity = get_Block_n_cfgpreds(n);
for (int i = 0; i < arity; i++) {
ir_node *pred = get_Block_cfgpred_block(n, i);
/* ignore Bad control flow: it cannot happen */
if (is_Bad(pred))
......@@ -362,14 +359,12 @@ static int is_head(ir_node *n, ir_node *root)
*/
static int is_endless_head(ir_node *n, ir_node *root)
{
int i, arity;
int none_outof_loop = 1, some_in_loop = 0;
(void) root;
assert(is_Block(n));
/* Test for legal loop header: Block, Phi, ... */
arity = get_Block_n_cfgpreds(n);
for (i = 0; i < arity; i++) {
int const arity = get_Block_n_cfgpreds(n);
for (int i = 0; i < arity; i++) {
ir_node *pred = get_Block_cfgpred_block(n, i);
/* ignore Bad control flow: it cannot happen */
if (is_Bad(pred))
......
......@@ -44,7 +44,6 @@
ir_node *get_Block_idom(const ir_node *bl)
{
assert(is_Block(bl));
if (get_Block_dom_depth(bl) == -1) {
/* This block is not reachable from Start */
ir_graph *irg = get_irn_irg(bl);
......@@ -76,7 +75,6 @@ void set_Block_idom(ir_node *bl, ir_node *n)
ir_node *get_Block_ipostdom(const ir_node *bl)
{
assert(is_Block(bl));
if (get_Block_postdom_depth(bl) == -1) {
/* This block is not reachable from Start */
ir_graph *irg = get_irn_irg(bl);
......@@ -432,7 +430,6 @@ static void init_tmp_dom_info(ir_node *bl, tmp_dom_info *parent,
tmp_dom_info *tdi;
int i;
assert(is_Block(bl));
if (Block_block_visited(bl))
return;
mark_Block_block_visited(bl);
......@@ -471,7 +468,6 @@ static void init_tmp_pdom_info(ir_node *bl, tmp_dom_info *parent,
tmp_dom_info *tdi;
int i;
assert(is_Block(bl));
if (get_irg_block_visited(current_ir_graph) == get_Block_block_visited(bl))
return;
mark_Block_block_visited(bl);
......@@ -493,7 +489,6 @@ static void init_tmp_pdom_info(ir_node *bl, tmp_dom_info *parent,
ir_node *pred = get_Block_cfgpred_block(bl, i);
if (is_Bad(pred))
continue;
assert(is_Block(pred));
init_tmp_pdom_info(pred, tdi, tdi_list, used, n_blocks);
}
......
......@@ -219,22 +219,16 @@ static ir_node *gen_Cond(ir_node *node)
{
ir_node *selector = get_Cond_selector(node);
ir_mode *mode = get_irn_mode(selector);
ir_node *block;
ir_node *flag_node;
ir_relation relation;
dbg_info *dbgi;
if (mode != mode_b) {
panic ("create_Switch not implemented yet!");
// return gen_SwitchJmp(node);
}
assert(is_Cmp(selector));
block = be_transform_node(get_nodes_block(node));
dbgi = get_irn_dbg_info(node);
flag_node = be_transform_node(selector);
relation = get_Cmp_relation(selector);
ir_node *const block = be_transform_node(get_nodes_block(node));
dbg_info *const dbgi = get_irn_dbg_info(node);
ir_node *const flag_node = be_transform_node(selector);
ir_relation const relation = get_Cmp_relation(selector);
return new_bd_amd64_Jcc(dbgi, block, flag_node, relation);
}
......
......@@ -1065,19 +1065,11 @@ static ir_node *gen_Cmp(ir_node *node)
static ir_node *gen_Cond(ir_node *node)
{
ir_node *selector = get_Cond_selector(node);
ir_relation relation;
ir_node *block;
ir_node *flag_node;
dbg_info *dbgi;
assert(is_Cmp(selector));
block = be_transform_node(get_nodes_block(node));
dbgi = get_irn_dbg_info(node);
flag_node = be_transform_node(selector);
relation = get_Cmp_relation(selector);
ir_node *const block = be_transform_node(get_nodes_block(node));
dbg_info *const dbgi = get_irn_dbg_info(node);
ir_node *const selector = get_Cond_selector(node);
ir_node *const flag_node = be_transform_node(selector);
ir_relation const relation = get_Cmp_relation(selector);
return new_bd_arm_B(dbgi, block, flag_node, relation);
}
......
......@@ -505,12 +505,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
continue;
foreach_out_edge(irn, res_edge) {
int proj;
ir_node *res = get_edge_src_irn(res_edge);
assert(is_Proj(res));
proj = get_Proj_proj(res);
ir_node *const res = get_edge_src_irn(res_edge);
long const proj = get_Proj_proj(res);
assert(proj < n_res);
assert(res_projs[proj] == NULL);
res_projs[proj] = res;
......@@ -775,7 +771,6 @@ static ir_node *adjust_alloc(be_abi_irg_t *env, ir_node *alloc, ir_node *curr_sp
foreach_out_edge(alloc, edge) {
ir_node *irn = get_edge_src_irn(edge);
assert(is_Proj(irn));
switch (get_Proj_proj(irn)) {
case pn_Alloc_M:
alloc_mem = irn;
......
......@@ -142,10 +142,9 @@ static inline int was_edge_critical(const ir_node *bl, int pos)
{
const ir_edge_t *edge;
const ir_node *bl_at_pos, *bl_before;
assert(is_Block(bl));
/* Does bl have several predecessors ?*/
if (get_irn_arity(bl) <= 1)
if (get_Block_n_cfgpreds(bl) <= 1)
return 0;
/* Does the pred have exactly one predecessor */
......
......@@ -426,20 +426,16 @@ static void spill_phi(spill_env_t *env, spill_info_t *spillinfo)
ir_graph *irg = env->irg;
ir_node *phi = spillinfo->to_spill;
ir_node *block = get_nodes_block(phi);
ir_node *unknown;
ir_node **ins;
spill_t *spill;
int i;
int arity;
assert(is_Phi(phi));
assert(!get_opt_cse());
DBG((dbg, LEVEL_1, "spilling Phi %+F:\n", phi));
/* build a new PhiM */
arity = get_irn_arity(phi);
ins = ALLOCAN(ir_node*, arity);
unknown = new_r_Unknown(irg, mode_M);
int const arity = get_Phi_n_preds(phi);
ir_node **const ins = ALLOCAN(ir_node*, arity);
ir_node *const unknown = new_r_Unknown(irg, mode_M);
for (i = 0; i < arity; ++i) {
ins[i] = unknown;
}
......
......@@ -381,8 +381,6 @@ static void collect_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_nod
static void collect_memperm(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent)
{
assert(is_Proj(node));
ir_node *memperm = get_Proj_pred(node);
int out = get_Proj_proj(node);
......
......@@ -381,7 +381,6 @@ static void peephole_IncSP_Store_to_push(ir_node *irn)
{
int i;
int maxslot;
int inc_ofs;
ir_node *node;
ir_node *stores[MAXPUSH_OPTIMIZE];
ir_node *block;
......@@ -392,9 +391,7 @@ static void peephole_IncSP_Store_to_push(ir_node *irn)
memset(stores, 0, sizeof(stores));
assert(be_is_IncSP(irn));
inc_ofs = be_get_IncSP_offset(irn);
int inc_ofs = be_get_IncSP_offset(irn);
if (inc_ofs < 4)
return;
......@@ -653,16 +650,15 @@ static inline int mode_needs_gp_reg(ir_mode *mode)
static void peephole_Load_IncSP_to_pop(ir_node *irn)
{
const arch_register_t *esp = &ia32_registers[REG_ESP];
int i, maxslot, inc_ofs, ofs;
int i, maxslot, ofs;
ir_node *node, *pred_sp, *block;
ir_node *loads[MAXPUSH_OPTIMIZE];
unsigned regmask = 0;
unsigned copymask = ~0;
memset(loads, 0, sizeof(loads));
assert(be_is_IncSP(irn));
inc_ofs = -be_get_IncSP_offset(irn);
int inc_ofs = -be_get_IncSP_offset(irn);
if (inc_ofs < 4)
return;
......
......@@ -204,8 +204,6 @@ static ir_node *gen_Const(ir_node *node)
ir_mode *mode = get_irn_mode(node);
ir_tarval *tv = get_Const_tarval(node);
assert(is_Const(node));
if (mode_is_float(mode)) {
ir_graph *irg = get_irn_irg(node);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
......
......@@ -313,7 +313,6 @@ void mature_immBlock(ir_node *block)
ir_node *phi;
ir_graph *irg;
assert(is_Block(block));
if (get_Block_matured(block))
return;
......
......@@ -612,8 +612,6 @@ restart:
for (up_idx = 0; up_idx < n_cfgpreds; ++up_idx) {
ir_node *upper_block;
ir_node *upper_cf;
ir_node *upper_cond;
ir_node *upper_cond_selector;
ir_node *replacement;
cond_pair cpair;
......@@ -627,10 +625,8 @@ restart:
if (!block_dominates(upper_block, block))
continue;
assert(is_Proj(upper_cf));
upper_cond = get_Proj_pred(upper_cf);
assert(is_Cond(upper_cond));
upper_cond_selector = get_Cond_selector(upper_cond);
ir_node *const upper_cond = get_Proj_pred(upper_cf);
ir_node *const upper_cond_selector = get_Cond_selector(upper_cond);
if (get_irn_mode(upper_cond_selector) != mode_b)
continue;
......
......@@ -355,8 +355,6 @@ static void optimize_blocks(ir_node *b, void *ctx)
if (get_nodes_block(phi_pred) == pred) {
/* case Phi 2a: */
assert(is_Phi(phi_pred)); /* Block is empty!! */
in[p_preds++] = get_Phi_pred(phi_pred, j);
} else {
/* case Phi 2b: */
......
......@@ -100,10 +100,7 @@ void gc_irgs(size_t n_keep, ir_entity ** keep_arr)
/* iterate calls */
for (node = (ir_node*)get_irn_link(node); node != NULL;
node = (ir_node*)get_irn_link(node)) {
size_t i;
assert(is_Call(node));
for (i = get_Call_n_callees(node); i > 0;) {
for (size_t i = get_Call_n_callees(node); i > 0;) {
ir_entity *ent = get_Call_callee(node, --i);
if (get_entity_irg(ent) && get_entity_link(ent) != MARK) {
......
......@@ -58,14 +58,10 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg;)
static void add_pred(ir_node* node, ir_node* x)
{
ir_node** ins;
int n;
int i;
assert(is_Block(node));
n = get_irn_arity(node);
int const n = get_Block_n_cfgpreds(node);
NEW_ARR_A(ir_node*, ins, n + 1);
for (i = 0; i < n; i++)
for (int i = 0; i < n; i++)
ins[i] = get_irn_n(node, i);
ins[n] = x;
set_irn_in(node, n + 1, ins);
......@@ -298,13 +294,8 @@ static void copy_and_fix(const jumpthreading_env_t *env, ir_node *block,
* mode_bs which can't be handled in all backends. Instead we duplicate
* the node and move it to its users */
if (mode == mode_b) {
ir_node *pred;
int pn;
assert(is_Proj(node));
pred = get_Proj_pred(node);
pn = get_Proj_proj(node);
ir_node *const pred = get_Proj_pred(node);
long const pn = get_Proj_proj(node);
foreach_out_edge_safe(node, edge) {
ir_node *cmp_copy;
......
......@@ -330,7 +330,6 @@ static ir_entity *find_constant_entity(ir_node *ptr)
static long get_Sel_array_index_long(ir_node *n, int dim)
{
ir_node *index = get_Sel_index(n, dim);
assert(is_Const(index));
return get_tarval_long(get_Const_tarval(index));
}
......@@ -1431,12 +1430,9 @@ static unsigned optimize_phi(ir_node *phi, walk_env_t *wenv)
memory Proj.
*/
for (i = n - 1; i >= 0; --i) {
ir_node *store;
projMs[i] = get_Phi_pred(phi, i);
assert(is_Proj(projMs[i]));
store = get_Proj_pred(projMs[i]);
ir_node *const store = get_Proj_pred(projMs[i]);
info = (ldst_info_t*)get_irn_link(store);
inM[i] = get_Store_mem(store);
......
......@@ -595,7 +595,6 @@ static void extend_ins_by_copy(ir_node *block, int pos)
{
ir_node *new_in;
ir_node *phi;
assert(is_Block(block));
/* Extend block by copy of definition at pos */
ir_node *const pred = get_Block_cfgpred(block, pos);
......@@ -1554,12 +1553,11 @@ static void copy_loop(entry_edge *cur_loop_outs, int copies)
static ir_node *clone_phis_sans_bes(ir_node *phi, ir_node *be_block, ir_node *dest_block)
{
ir_node **ins;
int arity = get_irn_arity(phi);
int i, c = 0;
ir_node *newphi;
assert(get_irn_arity(phi) == get_irn_arity(be_block));
assert(is_Phi(phi));
int const arity = get_Phi_n_preds(phi);
assert(arity == get_Block_n_cfgpreds(be_block));
ins = NEW_ARR_F(ir_node *, arity);
for (i = 0; i < arity; ++i) {
......@@ -1581,12 +1579,11 @@ static ir_node *clone_phis_sans_bes(ir_node *phi, ir_node *be_block, ir_node *de
* using be_block as supplier of backedge informations. */
static ir_node *clone_block_sans_bes(ir_node *node, ir_node *be_block)
{
int arity = get_irn_arity(node);
int i, c = 0;
ir_node **ins;
assert(get_irn_arity(node) == get_irn_arity(be_block));
assert(is_Block(node));
int const arity = get_Block_n_cfgpreds(node);
assert(arity == get_irn_arity(be_block));
NEW_ARR_A(ir_node *, ins, arity);
for (i = 0; i < arity; ++i) {
......
......@@ -626,7 +626,6 @@ static ir_entity *find_constant_entity(ir_node *ptr)
static long get_Sel_array_index_long(ir_node *n, int dim)
{
ir_node *index = get_Sel_index(n, dim);
assert(is_Const(index));
return get_tarval_long(get_Const_tarval(index));
}
......
......@@ -514,7 +514,6 @@ static void reorder_weights(q_set *hmap, float threshold)
{
entry_t **adr, *p, *entry;
size_t i, len;
ir_entity *callee;
restart:
entry = hmap->heavy_uses;
......@@ -530,9 +529,8 @@ restart:
/* we know, that a SymConst is here */
ptr = get_Call_ptr(call);
assert(is_SymConst(ptr));
callee = get_SymConst_entity(ptr);
ir_entity *const callee = get_SymConst_entity(ptr);
if (callee != entry->q.ent) {
/*
* This call is already changed because of a previous
......
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