annotate graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java @ 16217:561070049e73

implement Canonicalizable.Binary in the BinaryNode hierarchy
author Lukas Stadler <lukas.stadler@oracle.com>
date Wed, 25 Jun 2014 16:54:56 +0200
parents df6f2365b153
children 00460aab5c96
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
1 /*
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
4 *
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
8 *
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
13 * accompanied this code).
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
14 *
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
18 *
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
21 * questions.
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
22 */
6523
c8763a2deb0c rename packages in graal.loop to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6522
diff changeset
23 package com.oracle.graal.loop;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
24
5732
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
25 import java.util.*;
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
26
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
27 import com.oracle.graal.api.meta.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15192
diff changeset
28 import com.oracle.graal.compiler.common.*;
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
29 import com.oracle.graal.compiler.common.calc.*;
15192
644dfe49c0f4 Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents: 15157
diff changeset
30 import com.oracle.graal.compiler.common.cfg.*;
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
31 import com.oracle.graal.debug.*;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
32 import com.oracle.graal.graph.*;
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
33 import com.oracle.graal.graph.iterators.*;
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
34 import com.oracle.graal.loop.InductionVariable.Direction;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
35 import com.oracle.graal.nodes.*;
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
36 import com.oracle.graal.nodes.calc.*;
6529
2e96dc4eb8e2 renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents: 6523
diff changeset
37 import com.oracle.graal.nodes.cfg.*;
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
38 import com.oracle.graal.nodes.extended.*;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
39
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
40 public class LoopEx {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6537
diff changeset
41
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
42 private final Loop<Block> loop;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
43 private LoopFragmentInside inside;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
44 private LoopFragmentWhole whole;
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6537
diff changeset
45 private CountedLoopInfo counted; // TODO (gd) detect
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
46 private LoopsData data;
9446
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
47 private InductionVariables ivs;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
48
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
49 LoopEx(Loop<Block> loop, LoopsData data) {
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
50 this.loop = loop;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
51 this.data = data;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
52 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
53
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
54 public Loop<Block> loop() {
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
55 return loop;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
56 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
57
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
58 public LoopFragmentInside inside() {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
59 if (inside == null) {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
60 inside = new LoopFragmentInside(this);
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
61 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
62 return inside;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
63 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
64
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
65 public LoopFragmentWhole whole() {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
66 if (whole == null) {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
67 whole = new LoopFragmentWhole(this);
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
68 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
69 return whole;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
70 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
71
12750
c61d1f1bbee0 Invalidate cached nodes after canonicalization in full unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
72 public void invalidateFragments() {
c61d1f1bbee0 Invalidate cached nodes after canonicalization in full unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
73 inside = null;
c61d1f1bbee0 Invalidate cached nodes after canonicalization in full unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
74 whole = null;
c61d1f1bbee0 Invalidate cached nodes after canonicalization in full unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
75 }
c61d1f1bbee0 Invalidate cached nodes after canonicalization in full unrolling.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
76
5498
eb0d4946a1ea Fix compiler warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5489
diff changeset
77 @SuppressWarnings("unused")
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
78 public LoopFragmentInsideFrom insideFrom(FixedNode point) {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
79 // TODO (gd)
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
80 return null;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
81 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
82
5498
eb0d4946a1ea Fix compiler warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5489
diff changeset
83 @SuppressWarnings("unused")
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
84 public LoopFragmentInsideBefore insideBefore(FixedNode point) {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
85 // TODO (gd)
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
86 return null;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
87 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
88
5610
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
89 public boolean isOutsideLoop(Node n) {
13320
c258331fdde6 removed support for external nodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents: 12761
diff changeset
90 return !whole().contains(n);
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
91 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
92
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
93 public LoopBeginNode loopBegin() {
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
94 return (LoopBeginNode) loop().getHeader().getBeginNode();
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
95 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
96
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
97 public FixedNode predecessor() {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
98 return (FixedNode) loopBegin().forwardEnd().predecessor();
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
99 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
100
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
101 public FixedNode entryPoint() {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
102 return loopBegin().forwardEnd();
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
103 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
104
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
105 public boolean isCounted() {
5610
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
106 return counted != null;
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
107 }
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
108
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
109 public CountedLoopInfo counted() {
9f3250602d69 Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5520
diff changeset
110 return counted;
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
111 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
112
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
113 public LoopEx parent() {
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
114 if (loop.getParent() == null) {
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
115 return null;
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
116 }
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
117 return data.loop(loop.getParent());
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
118 }
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
119
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
120 public int size() {
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
121 return whole().nodes().count();
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
122 }
5519
cedae73d9c2a Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5489
diff changeset
123
cedae73d9c2a Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5489
diff changeset
124 @Override
cedae73d9c2a Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5489
diff changeset
125 public String toString() {
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
126 return (isCounted() ? "CountedLoop [" + counted() + "] " : "Loop ") + "(depth=" + loop().getDepth() + ") " + loopBegin();
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
127 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
128
15136
140bd4b4e3c6 Make NodePredicate an interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15108
diff changeset
129 private class InvariantPredicate implements NodePredicate {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6537
diff changeset
130
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
131 @Override
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
132 public boolean apply(Node n) {
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
133 return isOutsideLoop(n);
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
134 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
135 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
136
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
137 public void reassociateInvariants() {
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
138 InvariantPredicate invariant = new InvariantPredicate();
9602
19c5a07c7843 Introduce a graph() method that returns a StructuredGraph, to make many explicit casts unnecessary
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9446
diff changeset
139 StructuredGraph graph = loopBegin().graph();
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
140 for (BinaryNode binary : whole().nodes().filter(BinaryNode.class)) {
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
141 if (!BinaryNode.canTryReassociate(binary)) {
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
142 continue;
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
143 }
16217
561070049e73 implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
144 BinaryNode result = BinaryNode.reassociate(binary, invariant, binary.getX(), binary.getY());
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
145 if (result != binary) {
6537
14c952ec53a3 Fix NullPointerException when disabling Debug
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6529
diff changeset
146 if (Debug.isLogEnabled()) {
14708
0f73f8b75b81 printing fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14636
diff changeset
147 Debug.log("%s : Reassociated %s into %s", MetaUtil.format("%H::%n", graph.method()), binary, result);
6537
14c952ec53a3 Fix NullPointerException when disabling Debug
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6529
diff changeset
148 }
16217
561070049e73 implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
149 if (!result.isAlive()) {
561070049e73 implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
150 assert !result.isDeleted();
561070049e73 implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
151 result = graph.addOrUniqueWithInputs(result);
561070049e73 implement Canonicalizable.Binary in the BinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
152 }
5675
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
153 graph.replaceFloating(binary, result);
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
154 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
155 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
156 }
776366f3a41a A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5610
diff changeset
157
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
158 public boolean detectCounted() {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
159 LoopBeginNode loopBegin = loopBegin();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
160 FixedNode next = loopBegin.next();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
161 while (next instanceof FixedGuardNode || next instanceof ValueAnchorNode) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
162 next = ((FixedWithNextNode) next).next();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
163 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
164 if (next instanceof IfNode) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
165 IfNode ifNode = (IfNode) next;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
166 boolean negated = false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
167 if (!loopBegin.isLoopExit(ifNode.falseSuccessor())) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
168 if (!loopBegin.isLoopExit(ifNode.trueSuccessor())) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
169 return false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
170 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
171 negated = true;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
172 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
173 LogicNode ifTest = ifNode.condition();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
174 if (!(ifTest instanceof IntegerLessThanNode)) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
175 if (ifTest instanceof IntegerBelowThanNode) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
176 Debug.log("Ignored potential Counted loop at %s with |<|", loopBegin);
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
177 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
178 return false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
179 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
180 IntegerLessThanNode lessThan = (IntegerLessThanNode) ifTest;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
181 Condition condition = null;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
182 InductionVariable iv = null;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
183 ValueNode limit = null;
16207
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
184 if (isOutsideLoop(lessThan.getX())) {
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
185 iv = getInductionVariables().get(lessThan.getY());
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
186 if (iv != null) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
187 condition = lessThan.condition().mirror();
16207
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
188 limit = lessThan.getX();
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
189 }
16207
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
190 } else if (isOutsideLoop(lessThan.getY())) {
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
191 iv = getInductionVariables().get(lessThan.getX());
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
192 if (iv != null) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
193 condition = lessThan.condition();
16207
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16194
diff changeset
194 limit = lessThan.getY();
12761
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
195 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
196 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
197 if (condition == null) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
198 return false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
199 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
200 if (negated) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
201 condition = condition.negate();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
202 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
203 boolean oneOff = false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
204 switch (condition) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
205 case LE:
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
206 oneOff = true; // fall through
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
207 case LT:
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
208 if (iv.direction() != Direction.Up) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
209 return false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
210 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
211 break;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
212 case GE:
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
213 oneOff = true; // fall through
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
214 case GT:
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
215 if (iv.direction() != Direction.Down) {
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
216 return false;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
217 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
218 break;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
219 default:
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
220 throw GraalInternalError.shouldNotReachHere();
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
221 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
222 counted = new CountedLoopInfo(this, iv, limit, oneOff, negated ? ifNode.falseSuccessor() : ifNode.trueSuccessor());
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
223 return true;
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
224 }
8b82bdad798a Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents: 12750
diff changeset
225 return false;
5519
cedae73d9c2a Fix problem with jython and tmt
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5489
diff changeset
226 }
5732
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
227
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
228 public LoopsData loopsData() {
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
229 return data;
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
230 }
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
231
15145
df2ef5204f2b Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15136
diff changeset
232 public NodeBitMap nodesInLoopFrom(BeginNode point, BeginNode until) {
df2ef5204f2b Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15136
diff changeset
233 Collection<BeginNode> blocks = new LinkedList<>();
df2ef5204f2b Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15136
diff changeset
234 Collection<LoopExitNode> exits = new LinkedList<>();
5732
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
235 Queue<Block> work = new LinkedList<>();
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
236 ControlFlowGraph cfg = loopsData().controlFlowGraph();
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
237 work.add(cfg.blockFor(point));
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
238 Block untilBlock = until != null ? cfg.blockFor(until) : null;
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
239 while (!work.isEmpty()) {
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
240 Block b = work.remove();
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
241 if (b == untilBlock) {
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
242 continue;
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
243 }
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
244 if (loop().getExits().contains(b)) {
15145
df2ef5204f2b Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15136
diff changeset
245 exits.add((LoopExitNode) b.getBeginNode());
16191
3e3578bc8f9b rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents: 15534
diff changeset
246 } else if (loop().getBlocks().contains(b)) {
5732
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
247 blocks.add(b.getBeginNode());
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
248 work.addAll(b.getDominated());
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
249 }
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
250 }
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
251 return LoopFragment.computeNodes(point.graph(), blocks, exits);
e1d5c642d022 Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5719
diff changeset
252 }
9446
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
253
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
254 public InductionVariables getInductionVariables() {
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
255 if (ivs == null) {
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
256 ivs = new InductionVariables(this);
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
257 }
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
258 return ivs;
27733a62ba72 Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9436
diff changeset
259 }
16194
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
260
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
261 /**
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
262 * Deletes any nodes created within the scope of this object that have no usages.
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
263 */
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
264 public void deleteUnusedNodes() {
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
265 if (ivs != null) {
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
266 ivs.deleteUnusedNodes();
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
267 }
7fb828b4c32b made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents: 16191
diff changeset
268 }
5489
5d0d72b37f88 Switch to new loop transformation framework, use it for peeling and full unrolling for snippets
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff changeset
269 }