Add and fix some comments.
[libfirm] / ir / lower / lower_intrinsics.c
index 09faa9d..d612343 100644 (file)
@@ -57,7 +57,7 @@ typedef struct walker_env {
  */
 static void call_mapper(ir_node *node, void *env)
 {
-       walker_env_t *wenv = env;
+       walker_env_t *wenv = (walker_env_t*)env;
        ir_op *op = get_irn_op(node);
 
        if (op == op_Call) {
@@ -74,7 +74,7 @@ static void call_mapper(ir_node *node, void *env)
                p   = pmap_find(wenv->c_map, ent);
 
                if (p) {
-                       r = p->value;
+                       r = (const i_call_record*)p->value;
                        wenv->nr_of_intrinsics += r->i_mapper(node, r->ctx) ? 1 : 0;
                }
        } else {
@@ -86,7 +86,7 @@ static void call_mapper(ir_node *node, void *env)
                                        ++wenv->nr_of_intrinsics;
                                        break;
                                }
-                               r = r->link;
+                               r = (const i_instr_record*)r->link;
                        }
                }
        }
@@ -163,20 +163,20 @@ unsigned lower_intrinsics(i_record *list, int length, int part_block_used)
        return nr_of_intrinsics;
 }  /* lower_intrinsics */
 
-struct pass_t {
+typedef struct pass_t {
        ir_prog_pass_t pass;
 
        int part_block_used;
        int      length;
        i_record list[1];
-};
+} pass_t;
 
 /**
  * Wrapper for running lower_intrinsics() as an ir_prog pass.
  */
 static int pass_wrapper(ir_prog *irp, void *context)
 {
-       struct pass_t *pass = context;
+       pass_t *pass = (pass_t*)context;
        (void) irp; /* TODO: set current irp, or remove parameter */
        lower_intrinsics(pass->list, pass->length, pass->part_block_used);
        /* probably this pass should not run again */
@@ -195,7 +195,7 @@ ir_prog_pass_t *lower_intrinsics_pass(
        const char *name,
        i_record *list, int length, int part_block_used)
 {
-       struct pass_t *pass = xmalloc(sizeof(*pass) + (length-1) * sizeof(pass->list[0]));
+       pass_t *pass = (pass_t*)xmalloc(sizeof(*pass) + (length-1) * sizeof(pass->list[0]));
 
        memcpy(pass->list, list, sizeof(list[0]) * length);
        pass->length          = length;
@@ -317,9 +317,9 @@ int i_mapper_alloca(ir_node *call, void *ctx)
 /* A mapper for the floating point sqrt. */
 int i_mapper_sqrt(ir_node *call, void *ctx)
 {
-       ir_node *mem;
-       tarval *tv;
-       ir_node *op = get_Call_param(call, 0);
+       ir_node   *mem;
+       ir_tarval *tv;
+       ir_node   *op = get_Call_param(call, 0);
        (void) ctx;
 
        if (!is_Const(op))
@@ -340,9 +340,9 @@ int i_mapper_sqrt(ir_node *call, void *ctx)
 /* A mapper for the floating point cbrt. */
 int i_mapper_cbrt(ir_node *call, void *ctx)
 {
-       ir_node *mem;
-       tarval *tv;
-       ir_node *op = get_Call_param(call, 0);
+       ir_node   *mem;
+       ir_tarval *tv;
+       ir_node   *op = get_Call_param(call, 0);
        (void) ctx;
 
        if (!is_Const(op))
@@ -376,7 +376,7 @@ int i_mapper_pow(ir_node *call, void *ctx)
                /* pow (1.0, x) = 1.0 */
                irn = left;
        } else if (is_Const(right)) {
-               tarval *tv = get_Const_tarval(right);
+               ir_tarval *tv = get_Const_tarval(right);
                if (tarval_is_null(tv)) {
                        /* pow(x, 0.0) = 1.0 */
                        ir_mode *mode = get_tarval_mode(tv);
@@ -608,7 +608,7 @@ static ir_entity *get_const_entity(ir_node *ptr)
 
 static bool initializer_val_is_null(ir_initializer_t *init)
 {
-       tarval *tv;
+       ir_tarval *tv;
 
        if (get_initializer_kind(init) == IR_INITIALIZER_NULL)
                return true;
@@ -674,7 +674,7 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp)
                        }
                }
                if (len >= 0) {
-                       tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp));
+                       ir_tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp));
                        return new_r_Const(irg, tv);
                }
                return NULL;
@@ -688,7 +688,7 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp)
        for (i = 0; i < size; ++i) {
                ir_initializer_t *val = get_initializer_compound_value(initializer, i);
                if (initializer_val_is_null(val)) {
-                       tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
+                       ir_tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
                        return new_r_Const(irg, tv);
                }
        }
@@ -775,7 +775,7 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right,
                for (i = 0; i < n; ++i) {
                        ir_node *irn;
                        long v_l, v_r;
-                       tarval *tv;
+                       ir_tarval *tv;
 
                        irn = get_compound_ent_value(left, i);
                        if (! is_Const(irn))
@@ -805,7 +805,7 @@ static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right,
                }
                if (i < n) {
                        /* we found an end */
-                       tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp));
+                       ir_tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp));
                        return new_r_Const(irg, tv);
                }
                return NULL;
@@ -927,7 +927,7 @@ replace_by_call:
                        mode  = get_type_mode(char_tp);
 
                        /* replace the strcmp by (*x) */
-                       irn = new_rd_Load(dbg, block, mem, v, mode, 0);
+                       irn = new_rd_Load(dbg, block, mem, v, mode, cons_none);
                        mem = new_r_Proj(irn, mode_M, pn_Load_M);
                        exc = new_r_Proj(irn, mode_X, pn_Load_X_except);
                        reg = new_r_Proj(irn, mode_X, pn_Load_X_regular);