changeset 2527:15936867feb5

Removed global value numberer.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Apr 2011 16:57:50 +0200
parents 0b57dac65b27
children 6edc0306038e
files graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java graal/GraalCompiler/src/com/sun/c1x/graph/IR.java graal/GraalCompiler/src/com/sun/c1x/opt/GlobalValueNumberer.java
diffstat 3 files changed, 2 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java	Wed Apr 27 16:56:33 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java	Wed Apr 27 16:57:50 2011 +0200
@@ -106,7 +106,6 @@
     public static boolean OptLocalValueNumbering;
     public static boolean OptLocalLoadElimination;
     public static boolean OptCSEArrayLength;
-    public static boolean OptGlobalValueNumbering;
     public static boolean OptBlockSkipping;
     public static boolean OptIterativeNCE;
     public static boolean OptFlowSensitiveNCE;
@@ -194,7 +193,6 @@
         OptFlowSensitiveNCE             = lll;
         OptDeadCodeElimination1         = lll;
         OptDeadCodeElimination2         = lll;
-        OptGlobalValueNumbering         = lll;
         OptBlockSkipping                = lll;
     }
 }
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Wed Apr 27 16:56:33 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Wed Apr 27 16:57:50 2011 +0200
@@ -143,11 +143,11 @@
 
     private void optimize2() {
         // do more advanced, dominator-based optimizations
-        if (C1XOptions.OptGlobalValueNumbering) {
+        /*if (C1XOptions.OptGlobalValueNumbering) {
             makeLinearScanOrder();
             new GlobalValueNumberer(this);
             verifyAndPrint("After global value numbering");
-        }
+        }*/
         if (C1XOptions.OptDeadCodeElimination2) {
             new LivenessMarker(this).removeDeadCode();
             verifyAndPrint("After dead code elimination 2");
--- a/graal/GraalCompiler/src/com/sun/c1x/opt/GlobalValueNumberer.java	Wed Apr 27 16:56:33 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.c1x.opt;
-
-import java.util.*;
-
-import com.sun.c1x.*;
-import com.sun.c1x.graph.*;
-import com.sun.c1x.ir.*;
-
-/**
- * Implements global value numbering based on dominators.
- *
- * @author Ben L. Titzer
- */
-public class GlobalValueNumberer {
-
-    final IR ir;
-    final HashMap<BlockBegin, ValueMap> valueMaps;
-    final InstructionSubstituter subst;
-    ValueMap currentMap;
-
-    /**
-     * Creates a new GlobalValueNumbering pass and performs it on the IR.
-     *
-     * @param ir the IR on which to perform global value numbering
-     */
-    public GlobalValueNumberer(IR ir) {
-        this.ir = ir;
-        this.subst = new InstructionSubstituter(ir);
-        List<BlockBegin> blocks = ir.linearScanOrder();
-        valueMaps = new HashMap<BlockBegin, ValueMap>(blocks.size());
-        optimize(blocks);
-        subst.finish();
-    }
-
-    void optimize(List<BlockBegin> blocks) {
-        int numBlocks = blocks.size();
-        BlockBegin startBlock = blocks.get(0);
-        assert startBlock == ir.startBlock && startBlock.numberOfPreds() == 0 && startBlock.dominator() == null : "start block incorrect";
-
-        // initial value map, with nesting 0
-        valueMaps.put(startBlock, new ValueMap());
-
-        for (int i = 1; i < numBlocks; i++) {
-            // iterate through all the blocks
-            BlockBegin block = blocks.get(i);
-
-            int numPreds = block.numberOfPreds();
-            assert numPreds > 0 : "block must have predecessors";
-
-            BlockBegin dominator = block.dominator();
-            assert dominator != null : "dominator must exist";
-            assert valueMaps.get(dominator) != null : "value map of dominator must exist";
-
-            // create new value map with increased nesting
-            currentMap = new ValueMap(valueMaps.get(dominator));
-
-            assert numPreds > 1 || dominator == block.predAt(0) || block.isExceptionEntry() : "dominator must be equal to predecessor";
-
-            // visit all instructions of this block
-            for (Instruction instr = block.next(); instr != null; instr = instr.next()) {
-                assert !instr.hasSubst() : "substitution already set";
-
-                // attempt value numbering
-                Instruction f = currentMap.findInsert(instr);
-                if (f != instr) {
-                    C1XMetrics.GlobalValueNumberHits++;
-                    assert !subst.hasSubst(f) : "can't have a substitution";
-                    subst.setSubst(instr, f);
-                }
-            }
-
-            // remember value map for successors
-            valueMaps.put(block, currentMap);
-        }
-    }
-}