Added new Proj_X_regular for all nodes producing a Proj_X_exc to support the new...
[libfirm] / ir / opt / opt_osr.h
index 2454858..564d982 100644 (file)
@@ -1,17 +1,34 @@
+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
 /**
- * Project:     libFIRM
- * File name:   ir/opt/opt_osr.h
- * Purpose:     Operator Strength Reduction,
- *              Keith D. Cooper, L. Taylor Simpson, Christopher A. Vick
- * Author:      Michael Beck
- * Modified by:
- * Created:     12.5.2006
- * CVS-ID:      $Id$
- * Copyright:   (c) 2006 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * @file
+ * @brief   Operator Strength Reduction.
+ * @date    12.5.2006
+ * @author  Michael Beck
+ * @version $Id$
+ * @summary
+ *  Implementation of the Operator Strength Reduction algorithm
+ *  by Keith D. Cooper, L. Taylor Simpson, Christopher A. Vick.
  */
-#ifndef _OPT_OSR_H_
-#define _OPT_OSR_H_
+#ifndef FIRM_OPT_OPT_OSR_H
+#define FIRM_OPT_OPT_OSR_H
 
 #include "firm_types.h"
 
@@ -20,6 +37,7 @@ typedef enum osr_flags {
        osr_flag_none               = 0,  /**< no additional flags */
        osr_flag_lftr_with_ov_check = 1,  /**< do linear function test replacement
                                               only if no overflow can occur. */
+       osr_flag_ignore_x86_shift   = 2   /**< ignore Multiplications by 2, 4, 8 */
 } osr_flags;
 
 /* FirmJNI cannot handle identical enum values... */
@@ -30,9 +48,11 @@ typedef enum osr_flags {
 /**
  * Do the Operator Scalar Replacement optimization and linear
  * function test replacement for loop control.
+ * Can be switched off using the set_opt_strength_red() flag.
+ * In that case, only remove_phi_cycles() is executed.
  *
  * @param irg    the graph which should be optimized
- * @param flags  one of osr_flags
+ * @param flags  set of osr_flags
  *
  * The linear function replacement test is controlled by the flags.
  * If the osr_flag_lftr_with_ov_check is set, the replacement is only
@@ -78,11 +98,23 @@ typedef enum osr_flags {
  * Note that i < a + 400 is also not possible with the current implementation
  * although this might be allowed by other compilers...
  *
- * Note further that tests for equality can be handled some simplier (but are not
+ * Note further that tests for equality can be handled some simpler (but are not
  * implemented yet).
  *
- * This algorithm destoyes the link field of nodes.
+ * This algorithm destroys the link field of nodes.
  */
 void opt_osr(ir_graph *irg, unsigned flags);
 
-#endif /* _OPT_OSR_H_ */
+/**
+ * Removes useless Phi cycles, i.e cycles of Phi nodes with only one
+ * non-Phi node.
+ * This is automatically done in opt_osr(), so there is no need to call it
+ * additionally.
+ *
+ * @param irg    the graph which should be optimized
+ *
+ * This algorithm destroys the link field of nodes.
+ */
+void remove_phi_cycles(ir_graph *irg);
+
+#endif /* FIRM_OPT_OPT_OSR_H */