X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fscalar_replace.c;h=8ffa6da3ff60fae3872fb03bd089fcfd7df7a3a5;hb=44fec44bd47ef88ae276179866d4a65cda6e0253;hp=fb24fafbaf34fe5ca4bf7e0813e743d206c0162f;hpb=3098b3057f3a97f0356e4bf94911bb7584fe7887;p=libfirm diff --git a/ir/opt/scalar_replace.c b/ir/opt/scalar_replace.c index fb24fafba..8ffa6da3f 100644 --- a/ir/opt/scalar_replace.c +++ b/ir/opt/scalar_replace.c @@ -37,9 +37,10 @@ #include "irgwalk.h" #include "irgmod.h" #include "irnode_t.h" +#include "irtools.h" -#define SET_VNUM(node, vnum) set_irn_link(node, (void *)vnum) -#define GET_VNUM(node) (unsigned)get_irn_link(node) +#define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum)) +#define GET_VNUM(node) (unsigned)PTR_TO_INT(get_irn_link(node)) /** * A path element entry: it is either an entity @@ -63,7 +64,7 @@ typedef struct _path_t { typedef struct _scalars_t { entity *ent; /**< A entity for scalar replacement. */ - type *ent_owner; /**< The owner of this entity. */ + ir_type *ent_owner; /**< The owner of this entity. */ } scalars_t; @@ -103,7 +104,7 @@ static unsigned path_hash(const path_t *path) unsigned i; for (i = 0; i < path->path_len; ++i) - hash ^= (unsigned)path->path[i].ent; + hash ^= (unsigned)PTR_TO_INT(path->path[i].ent); return hash >> 4; } @@ -125,21 +126,18 @@ static int is_const_sel(ir_node *sel) { return 1; } -/** +/* * Returns non-zero, if the address of an entity * represented by a Sel node (or it's successor Sels) is taken. - * - * @param sel the Sel node */ -static int is_address_taken(ir_node *sel) +int is_address_taken(ir_node *sel) { - int i, n; + int i; if (! is_const_sel(sel)) return 1; - n = get_irn_n_outs(sel); - for (i = 0; i < n; ++i) { + for (i = get_irn_n_outs(sel) - 1; i >= 0; --i) { ir_node *succ = get_irn_out(sel, i); switch (get_irn_opcode(succ)) { @@ -270,7 +268,7 @@ static int find_possible_replacements(ir_graph *irg) if (get_irn_op(succ) == op_Sel) { entity *ent = get_Sel_entity(succ); - type *ent_type; + ir_type *ent_type; if (get_entity_link(ent) == ADDRESS_TAKEN) continue; @@ -388,7 +386,7 @@ static unsigned allocate_value_numbers(pset *sels, entity *ent, unsigned vnum, i else printf("[%ld]", get_tarval_long(key->path[i].tv)); } - printf(" = %u (%s)\n", (int)get_irn_link(sel), get_mode_name((*modes)[key->vnum])); + printf(" = %u (%s)\n", PTR_TO_INT(get_irn_link(sel)), get_mode_name((*modes)[key->vnum])); } #endif /* DEBUG_libfirm */ } @@ -676,7 +674,7 @@ void scalar_replacement_opt(ir_graph *irg) ir_mode **modes; set *set_ent; pset *sels; - type *ent_type; + ir_type *ent_type; ir_graph *rem; if (! get_opt_scalar_replacement())