From 854e25593766c0e302befc8e397d99861cf90710 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 12 Apr 2010 19:00:58 +0000 Subject: [PATCH] Add pass constructor C99 feature removed. [r27381] --- include/libfirm/iroptimize.h | 13 +++++++++++++ ir/opt/fp-vrp.c | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/libfirm/iroptimize.h b/include/libfirm/iroptimize.h index 9d841ad84..e4d064ff1 100644 --- a/include/libfirm/iroptimize.h +++ b/include/libfirm/iroptimize.h @@ -1083,4 +1083,17 @@ ir_graph_pass_t *place_code_pass(const char *name); */ void fixpoint_vrp(ir_graph*); +/** + * Creates an ir_graph pass for fixpoint_vrp(). + * This pass dDetermines information about the values of nodes + * and perform simplications using this information. + * This optimization performs a data-flow analysis to + * find the minimal fixpoint. + * + * @param name the name of this pass or NULL + * + * @return the newly created ir_graph pass + */ +ir_graph_pass_t *fixpoint_vrp_irg_pass(const char *name); + #endif diff --git a/ir/opt/fp-vrp.c b/ir/opt/fp-vrp.c index bd8d5f392..232deba51 100644 --- a/ir/opt/fp-vrp.c +++ b/ir/opt/fp-vrp.c @@ -40,6 +40,7 @@ #include "iroptimize.h" #include "irtools.h" #include "tv.h" +#include "irpass.h" /* TODO: * - Implement cleared/set bit calculation for Add, Sub, Minus, Mul, Div, Mod, Shl, Shr, Shrs, Rotl @@ -314,8 +315,8 @@ result_unknown_X: * range the addition is disjoint and therefore Add behaves like Or. */ tarval* const low_zero_mask = tarval_or(no_c_in_no_c_out, tarval_neg(no_c_in_no_c_out)); - z = tarval_or( tarval_or(lz, rz), low_zero_mask); tarval* const low_one_mask = tarval_not(low_zero_mask); + z = tarval_or( tarval_or(lz, rz), low_zero_mask); o = tarval_and(tarval_or(lo, ro), low_one_mask); } break; @@ -684,3 +685,8 @@ void fixpoint_vrp(ir_graph* const irg) obstack_free(&obst, NULL); } + +ir_graph_pass_t *fixpoint_vrp_irg_pass(const char *name) +{ + return def_graph_pass(name ? name : "fixpoint_vrp", fixpoint_vrp); +} -- 2.20.1