replace is_no_Block() with !is_Block()
[libfirm] / ir / ana / irsimpletype.c
index 136d01c..54ffe48 100644 (file)
@@ -23,7 +23,7 @@
  * @author    Goetz Lindenmaier
  * @date      22.8.2003
  * @version   $Id$
- * @summary
+ * @brief
  *  Runs most simple type analyses.
  *
  *  We compute type information for each node.  It is derived from the
@@ -55,7 +55,8 @@ static ir_type *phi_cycle_type = NULL;
 /**
  * init type link field so that types point to their pointers.
  */
-static void precompute_pointer_types(void) {
+static void precompute_pointer_types(void)
+{
 #if 0
        int i;
        set_type_link(firm_unknown_type, firm_unknown_type);
@@ -78,7 +79,8 @@ static void precompute_pointer_types(void) {
  * Returns a pointer to type which was stored in the link field
  * to speed up search.
  */
-static ir_type *find_pointer_type_to (ir_type *tp) {
+static ir_type *find_pointer_type_to (ir_type *tp)
+{
 #if 0
        return (ir_type *)get_type_link(tp);
 #else
@@ -95,7 +97,8 @@ static ir_type *compute_irn_type(ir_node *n);
  * Try to determine a type for a Proj node.
  * If a type cannot be determined, return @p firm_none_type.
  */
-static ir_type *find_type_for_Proj(ir_node *n) {
+static ir_type *find_type_for_Proj(ir_node *n)
+{
        ir_type *tp;
 
        /* Avoid nested Tuples. */
@@ -167,7 +170,8 @@ static ir_type *find_type_for_Proj(ir_node *n) {
  * Try to determine the type of a node.
  * If a type cannot be determined, return @p firm_none_type.
  */
-static ir_type *find_type_for_node(ir_node *n) {
+static ir_type *find_type_for_node(ir_node *n)
+{
        ir_type *tp = firm_unknown_type;
        ir_type *tp1 = NULL, *tp2 = NULL;
        ir_node *a = NULL, *b = NULL;
@@ -200,7 +204,6 @@ static ir_type *find_type_for_node(ir_node *n) {
                ir_type *ana_res_type = get_irn_type(get_Return_res(n, i));
                if (ana_res_type == firm_unknown_type) continue;
                if (res_type != ana_res_type && "return value has wrong type") {
-               DDMN(n);
                assert(res_type == ana_res_type && "return value has wrong type");
                }
                }
@@ -220,15 +223,11 @@ static ir_type *find_type_for_node(ir_node *n) {
        case iro_Tuple:
        case iro_Bad:
        case iro_NoMem:
-       case iro_Break:
-       case iro_CallBegin:
-       case iro_EndReg:
-       case iro_EndExcept:
                break;
 
                /* compute the type */
        case iro_Const:
-               tp = get_Const_type(n);
+               tp = get_Const_type(n);
                break;
        case iro_SymConst:
                tp = get_SymConst_value_type(n);
@@ -280,8 +279,7 @@ static ir_type *find_type_for_node(ir_node *n) {
 
                if (tp1 == tp2) { tp = tp1; break; }
 
-               DB((dbg, SET_LEVEL_2, "Phi %ld with two different types: %s, %s: unknown type.\n", get_irn_node_nr(n),
-                       get_type_name(tp1), get_type_name(tp2)));
+               DB((dbg, SET_LEVEL_2, "Phi %ld with two different types: %+F, %+F: unknown type.\n", get_irn_node_nr(n), tp1, tp2));
                tp = firm_unknown_type;   /* Test for supertypes? */
                break;
        }
@@ -311,9 +309,6 @@ static ir_type *find_type_for_node(ir_node *n) {
        case iro_Unknown:
                tp = firm_unknown_type;
                break;
-       case iro_Filter:
-               assert(0 && "Filter not implemented");
-               break;
 
                /* catch special cases with fallthrough to binop/unop cases in default. */
        case iro_Sub:
@@ -381,21 +376,20 @@ default_code:
                                tp = phi_cycle_type;
                                break;
                        }
-                       DB((dbg, SET_LEVEL_2, "Binop %ld with two different types: %s, %s: unknown type \n", get_irn_node_nr(n),
-                               get_type_name(tp1), get_type_name(tp2)));
+                       DB((dbg, SET_LEVEL_2, "Binop %ld with two different types: %+F, %+F: unknown type\n", get_irn_node_nr(n), tp1, tp2));
                        tp = firm_unknown_type;
                        break;
                }
 
                panic(" not implemented: %+F", n);
-               break;
        } /* end switch */
 
        return tp;
 }
 
 /** Compute the type of an IR node. */
-static ir_type *compute_irn_type(ir_node *n) {
+static ir_type *compute_irn_type(ir_node *n)
+{
        ir_type *tp = get_irn_typeinfo_type(n);
 
        if (tp == initial_type) {
@@ -411,11 +405,11 @@ static ir_type *compute_irn_type(ir_node *n) {
  * Post-walking ensures that the types for all predecessor
  * nodes are already computed.
  */
-static void compute_type(ir_node *n, void *env) {
+static void compute_type(ir_node *n, void *env)
+{
        ir_type *tp = get_irn_typeinfo_type(n);
        (void) env;
        if (tp ==  phi_cycle_type) {
-               /* printf(" recomputing for phi_cycle_type "); DDMN(n); */
                set_irn_typeinfo_type(n, initial_type);
        }
        compute_irn_type(n);
@@ -424,7 +418,8 @@ static void compute_type(ir_node *n, void *env) {
 /**
  * Compute the types for all nodes of a graph.
  */
-static void analyse_irg (ir_graph *irg) {
+static void analyse_irg (ir_graph *irg)
+{
        set_irg_typeinfo_state(irg, ir_typeinfo_consistent);
        irg_walk_graph(irg, NULL, compute_type, NULL);
 }
@@ -433,7 +428,8 @@ static void analyse_irg (ir_graph *irg) {
  * Initialize the analysis by creating a phi_cycle_type and
  * computing pointer types for all class and struct types.
  */
-static void init_irsimpletype(void) {
+static void init_irsimpletype(void)
+{
        init_irtypeinfo();
        if (!phi_cycle_type)
                phi_cycle_type = new_type_class(new_id_from_str("phi_cycle_type"));
@@ -441,7 +437,8 @@ static void init_irsimpletype(void) {
 }
 
 /* Computes type information for each node in all ir graphs. */
-void simple_analyse_types(void) {
+void simple_analyse_types(void)
+{
        int i;
        FIRM_DBG_REGISTER(dbg, "firm.ana.simpletype");
 
@@ -453,7 +450,8 @@ void simple_analyse_types(void) {
        set_irp_typeinfo_state(ir_typeinfo_consistent);
 }
 
-void free_simple_type_information(void) {
+void free_simple_type_information(void)
+{
        free_irtypeinfo();
 
        if (phi_cycle_type) {