X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Flibfirm%2Firopt.h;h=a211cdaee95004313003e1c5efda851aaf82e4a2;hb=9a1c04e0bdc66d8fce339bc81408728b9459d033;hp=62889a92bd8efe5ff2c6e9c5e5717a0eb5ec611d;hpb=095bd4f24cdb5c1e350d9e2929619f54c7fa78d8;p=libfirm diff --git a/include/libfirm/iropt.h b/include/libfirm/iropt.h index 62889a92b..a211cdaee 100644 --- a/include/libfirm/iropt.h +++ b/include/libfirm/iropt.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -21,12 +21,18 @@ * @file * @brief iropt --- optimizations of an ir node. * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck - * @version $Id$ */ #ifndef FIRM_IR_IROPT_H #define FIRM_IR_IROPT_H #include "firm_types.h" +#include "begin.h" + +/** + * @ingroup iroptimize + * @defgroup iropt Local Optimizations + * @{ + */ /** * The Floating point model. @@ -52,18 +58,18 @@ * Fastest mode. Associative and distributive law allowed at the expense * of floating point accuracy and correctness. Explicit rounding is disabled. */ -typedef enum _fp_model_t { - fp_explicit_rounding = 1, /**< Explicit rounding at assignments, typecasts, return +typedef enum fp_model_t { + fp_explicit_rounding = (1u << 0), /**< Explicit rounding at assignments, typecasts, return and function calls. Conv nodes may NOT be removed, even if they look useless. */ - fp_strict_algebraic = 2, /**< Strict adherence to non-associative and non-distributive + fp_strict_algebraic = (1u << 1), /**< Strict adherence to non-associative and non-distributive algebra unless the same result is guaranteed. */ - fp_contradictions = 4, /**< FP contradictions are enabled. Only for backend. */ - fp_strict_eval_order = 8, /**< FP instructions must be strict evaluated in given order. */ - fp_exceptions = 16, /**< FP exceptions are supported. No reordering that changes + fp_contradictions = (1u << 2), /**< FP contradictions are enabled. Only for backend. */ + fp_strict_eval_order = (1u << 3), /**< FP instructions must be strict evaluated in given order. */ + fp_exceptions = (1u << 4), /**< FP exceptions are supported. No reordering that changes the exception flow are allowed. Backends must generate synchronized exception code. */ - fp_environment_access = 32, /**< FPU environment can be accessed. Even Constant folding + fp_environment_access = (1u << 5), /**< FPU environment can be accessed. Even Constant folding cannot be done. */ /** Precise floating point model. Default. */ @@ -72,13 +78,13 @@ typedef enum _fp_model_t { fp_model_strict = fp_explicit_rounding|fp_strict_algebraic|fp_strict_eval_order| fp_exceptions|fp_environment_access, /** Fast floating point model. */ - fp_model_fast = fp_contradictions, + fp_model_fast = fp_contradictions } fp_model_t; /** If the expression referenced can be evaluated statically * computed_value returns a tarval representing the result. * Else returns tarval_bad. */ -tarval *computed_value(ir_node *n); +FIRM_API ir_tarval *computed_value(const ir_node *n); /** Applies all optimizations to n that are expressible as a pattern * in Firm, i.e., they need not a walk of the graph. @@ -88,6 +94,22 @@ tarval *computed_value(ir_node *n); * An equivalent optimization is applied in the constructors defined in * ircons.ch. There n is freed if a better node could be found. */ -ir_node *optimize_in_place(ir_node *n); +FIRM_API ir_node *optimize_in_place(ir_node *n); + +/** + * checks whether 1 value is the negated other value + */ +FIRM_API int ir_is_negated_value(const ir_node *a, const ir_node *b); + +/** + * (conservatively) approximates all possible relations when comparing + * the value @p left and @p right + */ +FIRM_API ir_relation ir_get_possible_cmp_relations(const ir_node *left, + const ir_node *right); + +/** @} */ + +#include "end.h" #endif