X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_osr.c;h=101fb54c3f21210487d59b31ef6c2a9db82de842;hb=d16d39df6772995a29ecdc8de1904ccb2e523599;hp=a79ca2027d88d27dd90eba0abb9958f25f8ed0fe;hpb=4894813d230d1d8cbfcf1efef29119cee5e8fa80;p=libfirm diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index a79ca2027..101fb54c3 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -14,13 +14,6 @@ #include "config.h" #endif -#ifdef HAVE_MALLOC_H -#include -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif - #include "opt_osr.h" #include "irgraph.h" #include "ircons.h" @@ -40,6 +33,7 @@ #include "irloop_t.h" #include "array.h" #include "firmstat.h" +#include "xmalloc.h" /** The debug handle. */ DEBUG_ONLY(static firm_dbg_module_t *dbg;) @@ -79,22 +73,22 @@ typedef struct iv_env { /** * An entry in the (op, node, node) -> node map. */ -typedef struct quad_t { - opcode code; /**< the opcode of the reduced operation */ - ir_node *op1; /**< the first operand the reduced operation */ - ir_node *op2; /**< the second operand of the reduced operation */ +typedef struct quadruple_t { + ir_opcode code; /**< the opcode of the reduced operation */ + ir_node *op1; /**< the first operand the reduced operation */ + ir_node *op2; /**< the second operand of the reduced operation */ - ir_node *res; /**< the reduced operation */ -} quad_t; + ir_node *res; /**< the reduced operation */ +} quadruple_t; /** * A LFTR edge. */ typedef struct LFTR_edge { - ir_node *src; /**< the source node */ - ir_node *dst; /**< the destination node */ - opcode code; /**< the opcode that must be applied */ - ir_node *rc; /**< the region const that must be applied */ + ir_node *src; /**< the source node */ + ir_node *dst; /**< the destination node */ + ir_opcode code; /**< the opcode that must be applied */ + ir_node *rc; /**< the region const that must be applied */ } LFTR_edge; /* forward */ @@ -110,6 +104,7 @@ static int LFTR_cmp(const void *e1, const void *e2, size_t size) { return l1->src != l2->src; } +#if 0 /** * Find a LFTR edge. */ @@ -120,11 +115,12 @@ static LFTR_edge *LFTR_find(ir_node *src, iv_env *env) { return set_find(env->lftr_edges, &key, sizeof(key), HASH_PTR(src)); } +#endif /** * Add a LFTR edge. */ -static void LFTR_add(ir_node *src, ir_node *dst, opcode code, ir_node *rc, iv_env *env) { +static void LFTR_add(ir_node *src, ir_node *dst, ir_opcode code, ir_node *rc, iv_env *env) { LFTR_edge key; key.src = src; @@ -183,8 +179,8 @@ static int is_rc(ir_node *irn, ir_node *header_block) { * Set compare function for the quad set. */ static int quad_cmp(const void *e1, const void *e2, size_t size) { - const quad_t *c1 = e1; - const quad_t *c2 = e2; + const quadruple_t *c1 = e1; + const quadruple_t *c2 = e2; return c1->code != c2->code || c1->op1 != c2->op1 || c1->op2 != c2->op2; } @@ -199,8 +195,8 @@ static int quad_cmp(const void *e1, const void *e2, size_t size) { * * @return the already reduced node or NULL if this operation is not yet reduced */ -static ir_node *search(opcode code, ir_node *op1, ir_node *op2, iv_env *env) { - quad_t key, *entry; +static ir_node *search(ir_opcode code, ir_node *op1, ir_node *op2, iv_env *env) { + quadruple_t key, *entry; key.code = code; key.op1 = op1; @@ -222,8 +218,8 @@ static ir_node *search(opcode code, ir_node *op1, ir_node *op2, iv_env *env) { * @param result the result of the reduced operation * @param env the environment */ -static void add(opcode code, ir_node *op1, ir_node *op2, ir_node *result, iv_env *env) { - quad_t key; +static void add(ir_opcode code, ir_node *op1, ir_node *op2, ir_node *result, iv_env *env) { + quadruple_t key; key.code = code; key.op1 = op1; @@ -263,7 +259,7 @@ static ir_node *find_location(ir_node *block1, ir_node *block2) { * * @return the newly created node */ -static ir_node *do_apply(opcode code, dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode) { +static ir_node *do_apply(ir_opcode code, dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode) { ir_graph *irg = current_ir_graph; ir_node *result; ir_node *block = find_location(get_nodes_block(op1), get_nodes_block(op2)); @@ -297,7 +293,7 @@ static ir_node *do_apply(opcode code, dbg_info *db, ir_node *op1, ir_node *op2, * @return the newly created node */ static ir_node *apply(ir_node *orig, ir_node *op1, ir_node *op2, iv_env *env) { - opcode code = get_irn_opcode(orig); + ir_opcode code = get_irn_opcode(orig); ir_node *result = search(code, op1, op2, env); if (! result) { @@ -330,7 +326,7 @@ static ir_node *apply(ir_node *orig, ir_node *op1, ir_node *op2, iv_env *env) { * @return the reduced node */ static ir_node *reduce(ir_node *orig, ir_node *iv, ir_node *rc, iv_env *env) { - opcode code = get_irn_opcode(orig); + ir_opcode code = get_irn_opcode(orig); ir_node *result = search(code, iv, rc, env); if (! result) { @@ -420,10 +416,10 @@ static int replace(ir_node *irn, ir_node *iv, ir_node *rc, iv_env *env) { * @return non-zero if irn should be Replace'd */ static int check_replace(ir_node *irn, iv_env *env) { - ir_node *left, *right, *iv, *rc; - ir_op *op = get_irn_op(irn); - opcode code = get_op_code(op); - ir_node *liv, *riv; + ir_node *left, *right, *iv, *rc; + ir_op *op = get_irn_op(irn); + ir_opcode code = get_op_code(op); + ir_node *liv, *riv; switch (code) { case iro_Mul: @@ -822,6 +818,7 @@ static void assign_po(ir_node *block, void *ctx) { e->POnum = env->POnum++; } +#if 0 /** * Follows the LFTR edges and return the last node in the chain. * @@ -993,6 +990,7 @@ static void do_lftr(ir_node *cmp, void *ctx) { static void lftr(ir_graph *irg, iv_env *env) { irg_walk_graph(irg, NULL, do_lftr, env); } +#endif /** * Pre-walker: set all node links to NULL and fix the