remove a bunch of pointless asserts for non-NULL pointers
authorMatthias Braun <matze@braunis.de>
Mon, 26 Nov 2012 14:24:35 +0000 (15:24 +0100)
committerMatthias Braun <matze@braunis.de>
Mon, 26 Nov 2012 16:50:00 +0000 (17:50 +0100)
We get a clean SIGSEGV anyway, if they're not fulfilled

ir/ir/irnode_t.h
ir/ir/irprog_t.h
ir/tr/entity_t.h
ir/tr/type_t.h

index 434c097..37d8a1b 100644 (file)
@@ -147,7 +147,6 @@ static inline unsigned get_irn_idx_(const ir_node *node)
  */
 static inline ir_op *get_irn_op_(const ir_node *node)
 {
-       assert(node);
        return node->op;
 }
 
@@ -156,7 +155,6 @@ static inline ir_op *get_irn_op_(const ir_node *node)
 
 static inline void set_irn_op_(ir_node *node, ir_op *op)
 {
-       assert(node);
        node->op = op;
 }
 
@@ -178,7 +176,6 @@ static inline void copy_node_attr_(ir_graph *irg, const ir_node *old_node,
 static inline unsigned get_irn_opcode_(const ir_node *node)
 {
        assert(k_ir_node == get_kind(node));
-       assert(node->op);
        return node->op->code;
 }
 
@@ -221,7 +218,6 @@ static inline int get_irn_deps_(const ir_node *node)
 
 static inline ir_node *get_irn_dep_(const ir_node *node, int pos)
 {
-       assert(node->deps && "dependency array node yet allocated. use add_irn_dep()");
        assert(pos >= 0 && pos < (int)ARR_LEN(node->deps) && "dependency index out of range");
        return node->deps[pos];
 }
@@ -246,7 +242,6 @@ static inline ir_node *get_irn_in_or_dep_(const ir_node *irn, int pos)
  */
 static inline ir_mode *get_irn_mode_(const ir_node *node)
 {
-       assert(node);
        return node->mode;
 }
 
@@ -256,7 +251,6 @@ static inline ir_mode *get_irn_mode_(const ir_node *node)
  */
 static inline void set_irn_mode_(ir_node *node, ir_mode *mode)
 {
-       assert(node);
        node->mode = mode;
 }
 
@@ -285,7 +279,6 @@ static inline ir_graph *get_irn_irg_(const ir_node *node)
  */
 static inline ir_visited_t get_irn_visited_(const ir_node *node)
 {
-       assert(node);
        return node->visited;
 }
 
@@ -295,7 +288,6 @@ static inline ir_visited_t get_irn_visited_(const ir_node *node)
  */
 static inline void set_irn_visited_(ir_node *node, ir_visited_t visited)
 {
-       assert(node);
        node->visited = visited;
 }
 
@@ -332,7 +324,6 @@ static inline int irn_visited_else_mark_(ir_node *node)
  */
 static inline void set_irn_link_(ir_node *node, void *link)
 {
-       assert(node);
        node->link = link;
 }
 
@@ -342,7 +333,7 @@ static inline void set_irn_link_(ir_node *node, void *link)
  */
 static inline void *get_irn_link_(const ir_node *node)
 {
-       assert(node && is_ir_node_(node));
+       assert(is_ir_node_(node));
        return node->link;
 }
 
@@ -355,7 +346,7 @@ static inline void *get_irn_link_(const ir_node *node)
 static inline op_pin_state get_irn_pinned_(const ir_node *node)
 {
        op_pin_state state;
-       assert(node && is_ir_node_(node));
+       assert(is_ir_node_(node));
        /* Check opcode */
        state = get_op_pinned_(get_irn_op_(node));
 
@@ -374,13 +365,13 @@ static inline op_pin_state is_irn_pinned_in_irg_(const ir_node *node)
 
 static inline int is_unop_(const ir_node *node)
 {
-       assert(node && is_ir_node_(node));
+       assert(is_ir_node_(node));
        return (node->op->opar == oparity_unary);
 }
 
 static inline int is_binop_(const ir_node *node)
 {
-       assert(node && is_ir_node_(node));
+       assert(is_ir_node_(node));
        return (node->op->opar == oparity_binary);
 }
 
index 2dd3d44..b5560ac 100644 (file)
@@ -65,7 +65,6 @@ static inline ir_type *get_tls_type_(void)
 
 static inline size_t get_irp_n_irgs_(void)
 {
-       assert(irp && irp->graphs);
        return ARR_LEN(irp->graphs);
 }
 
@@ -77,13 +76,11 @@ static inline ir_graph *get_irp_irg_(size_t pos)
 
 static inline size_t get_irp_n_types_(void)
 {
-       assert(irp && irp->types);
        return ARR_LEN(irp->types);
 }
 
 static inline ir_type *get_irp_type_(size_t pos)
 {
-       assert(irp->types);
        assert(pos < ARR_LEN(irp->types));
        /* Don't set the skip_tid result so that no double entries are generated. */
        return irp->types[pos];
@@ -92,13 +89,11 @@ static inline ir_type *get_irp_type_(size_t pos)
 /** Returns a new, unique number to number nodes or the like. */
 static inline long get_irp_new_node_nr(void)
 {
-       assert(irp);
        return irp->max_node_nr++;
 }
 
 static inline size_t get_irp_new_irg_idx(void)
 {
-       assert(irp);
        return irp->max_irg_idx++;
 }
 
@@ -110,7 +105,6 @@ static inline ir_graph *get_const_code_irg_(void)
 /** Returns a new, unique label number. */
 static inline ir_label_t get_irp_next_label_nr_(void)
 {
-       assert(irp);
        return ++irp->last_label_nr;
 }
 
index 2cadec2..ea87cee 100644 (file)
@@ -231,31 +231,31 @@ static inline int _is_entity(const void *thing)
 
 static inline ident *_get_entity_ident(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->name;
 }
 
 static inline const char *_get_entity_name(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return get_id_str(get_entity_ident(ent));
 }
 
 static inline void _set_entity_ident(ir_entity *ent, ident *id)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->name = id;
 }
 
 static inline ir_type *_get_entity_owner(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->owner;
 }
 
 static inline ident *_get_entity_ld_ident(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        if (ent->ld_name == NULL)
                return ent->name;
        return ent->ld_name;
@@ -263,127 +263,127 @@ static inline ident *_get_entity_ld_ident(const ir_entity *ent)
 
 static inline void _set_entity_ld_ident(ir_entity *ent, ident *ld_ident)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->ld_name = ld_ident;
 }
 
 static inline const char *_get_entity_ld_name(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return get_id_str(get_entity_ld_ident(ent));
 }
 
 static inline ir_type *_get_entity_type(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->type;
 }
 
 static inline ir_linkage _get_entity_linkage(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return (ir_linkage) ent->linkage;
 }
 
 static inline ir_volatility _get_entity_volatility(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return (ir_volatility) ent->volatility;
 }
 
 static inline void _set_entity_volatility(ir_entity *ent, ir_volatility vol)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->volatility = vol;
 }
 
 static inline unsigned _get_entity_alignment(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->alignment;
 }
 
 static inline void _set_entity_alignment(ir_entity *ent, unsigned alignment)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->alignment = alignment;
 }
 
 static inline ir_align _get_entity_aligned(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return (ir_align) ent->aligned;
 }
 
 static inline void _set_entity_aligned(ir_entity *ent, ir_align a)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->aligned = a;
 }
 
 static inline int _is_entity_compiler_generated(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->compiler_gen;
 }
 
 static inline void _set_entity_compiler_generated(ir_entity *ent, int flag)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->compiler_gen = flag ? 1 : 0;
 }
 
 static inline ir_entity_usage _get_entity_usage(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return (ir_entity_usage) ent->usage;
 }
 
 static inline void _set_entity_usage(ir_entity *ent, ir_entity_usage state)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->usage = state;
 }
 
 static inline int _get_entity_offset(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->offset;
 }
 
 static inline void _set_entity_offset(ir_entity *ent, int offset)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->offset = offset;
 }
 
 static inline unsigned char _get_entity_offset_bits_remainder(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->offset_bit_remainder;
 }
 
 static inline void _set_entity_offset_bits_remainder(ir_entity *ent, unsigned char offset)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->offset_bit_remainder = offset;
 }
 
 static inline void *_get_entity_link(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->link;
 }
 
 static inline void _set_entity_link(ir_entity *ent, void *l)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->link = l;
 }
 
 static inline ir_graph *_get_entity_irg(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        if (!is_Method_type(ent->type) || is_unknown_entity(ent)) {
                return NULL;
        }
@@ -393,19 +393,19 @@ static inline ir_graph *_get_entity_irg(const ir_entity *ent)
 
 static inline ir_visited_t _get_entity_visited(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->visit;
 }
 
 static inline void _set_entity_visited(ir_entity *ent, ir_visited_t num)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->visit = num;
 }
 
 static inline void _mark_entity_visited(ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        ent->visit = firm_type_visited;
 }
 
@@ -432,7 +432,7 @@ static inline size_t _get_entity_parameter_number(const ir_entity *entity)
 
 static inline ir_type *_get_entity_repr_class(const ir_entity *ent)
 {
-       assert(ent && ent->kind == k_entity);
+       assert(ent->kind == k_entity);
        return ent->repr_class;
 }
 
index 1383638..a256f47 100644 (file)
@@ -322,80 +322,80 @@ static inline void set_higher_type(ir_type *tp, ir_type *higher_type)
 
 static inline void *_get_type_link(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return(tp -> link);
 }
 
 static inline void _set_type_link(ir_type *tp, void *l)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        tp -> link = l;
 }
 
 static inline const tp_op *_get_type_tpop(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->type_op;
 }
 
 static inline ident *_get_type_tpop_nameid(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return get_tpop_ident(tp->type_op);
 }
 
 static inline tp_opcode _get_type_tpop_code(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return get_tpop_code(tp->type_op);
 }
 
 static inline ir_mode *_get_type_mode(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->mode;
 }
 
 static inline unsigned _get_type_size_bytes(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->size;
 }
 
 static inline ir_type_state _get_type_state(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->flags & tf_layout_fixed ? layout_fixed : layout_undefined;
 }
 
 static inline ir_visited_t _get_type_visited(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->visit;
 }
 
 static inline void _set_type_visited(ir_type *tp, ir_visited_t num)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        tp->visit = num;
 }
 
 static inline void _mark_type_visited(ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        assert(tp->visit < firm_type_visited);
        tp->visit = firm_type_visited;
 }
 
 static inline int _type_visited(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->visit >= firm_type_visited;
 }
 
 static inline int _type_not_visited(const ir_type *tp)
 {
-       assert(tp && tp->kind == k_type);
+       assert(tp->kind == k_type);
        return tp->visit  < firm_type_visited;
 }