Added osr_flag_ignore_x86_shift flag that ignores multiplications by 2, 4, 8
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 16 Aug 2006 13:31:41 +0000 (13:31 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 16 Aug 2006 13:31:41 +0000 (13:31 +0000)
[r8127]

ir/opt/opt_osr.c
ir/opt/opt_osr.h

index 6a54ad2..3d20943 100644 (file)
@@ -290,7 +290,7 @@ static ir_node *do_apply(opcode code, dbg_info *db, ir_node *op1, ir_node *op2,
  *               the opcode, debug-info and mode of a newly created one
  * @param op1    the first operand
  * @param op2    the second operand
- * @param env     the environment
+ * @param env    the environment
  *
  * @return the newly created node
  */
@@ -443,8 +443,24 @@ static int check_replace(ir_node *irn, iv_env *env) {
                        iv = right; rc = left;
                }
 
-               if (iv)
+               if (iv) {
+                       if (env->flags & osr_flag_ignore_x86_shift) {
+                               if (is_Const(rc)) {
+                                       tarval *tv = get_Const_tarval(rc);
+
+                                       if (tarval_is_long(tv)) {
+                                               long value = get_tarval_long(tv);
+
+                                               if (value == 2 || value == 4 || value == 8) {
+                                                       /* do not reduce multiplications by 2, 4, 8 */
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
                        return replace(irn, iv, rc, env);
+               }
                break;
        default:
                break;
index 2454858..464caab 100644 (file)
@@ -20,6 +20,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... */