Mercurial > hg > truffle
annotate graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java @ 18408:2c3666f44855
Truffle: initial commit of object API implementation
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 18 Nov 2014 23:19:43 +0100 |
parents | 1518c3296cc8 |
children | 86269e451920 |
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 |
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
|
25 import java.util.*; |
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
|
26 |
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
|
27 import com.oracle.graal.compiler.common.cfg.*; |
18383
1518c3296cc8
use deterministic iteration order Set and Map data structures when in the scope of a replay compilation context
Doug Simon <doug.simon@oracle.com>
parents:
16194
diff
changeset
|
28 import com.oracle.graal.compiler.common.remote.*; |
5610
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
29 import com.oracle.graal.debug.*; |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
30 import com.oracle.graal.debug.Debug.Scope; |
18383
1518c3296cc8
use deterministic iteration order Set and Map data structures when in the scope of a replay compilation context
Doug Simon <doug.simon@oracle.com>
parents:
16194
diff
changeset
|
31 import com.oracle.graal.graph.*; |
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.nodes.*; |
6529
2e96dc4eb8e2
renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents:
6523
diff
changeset
|
33 import com.oracle.graal.nodes.cfg.*; |
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
|
34 |
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 public class LoopsData { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6563
diff
changeset
|
36 |
18383
1518c3296cc8
use deterministic iteration order Set and Map data structures when in the scope of a replay compilation context
Doug Simon <doug.simon@oracle.com>
parents:
16194
diff
changeset
|
37 private Map<Loop<Block>, LoopEx> loopToEx = Context.newIdentityMap(); |
1518c3296cc8
use deterministic iteration order Set and Map data structures when in the scope of a replay compilation context
Doug Simon <doug.simon@oracle.com>
parents:
16194
diff
changeset
|
38 private Map<LoopBeginNode, LoopEx> loopBeginToEx = Node.newIdentityMap(); |
5732
e1d5c642d022
Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
39 private ControlFlowGraph cfg; |
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
|
40 |
5675
776366f3a41a
A bit of work on counted loops
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5613
diff
changeset
|
41 public LoopsData(final StructuredGraph graph) { |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
42 try (Scope s = Debug.scope("ControlFlowGraph")) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
43 cfg = ControlFlowGraph.compute(graph, true, true, true, true); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
44 } catch (Throwable e) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
45 throw Debug.handle(e); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12761
diff
changeset
|
46 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6563
diff
changeset
|
47 |
16191
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
48 for (Loop<Block> loop : cfg.getLoops()) { |
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
49 LoopEx ex = new LoopEx(loop, this); |
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
50 loopToEx.put(loop, ex); |
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 loopBeginToEx.put(ex.loopBegin(), ex); |
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 } |
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
|
54 |
16191
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
55 public LoopEx loop(Loop<?> loop) { |
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
56 return loopToEx.get(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
|
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 |
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 public LoopEx loop(LoopBeginNode loopBegin) { |
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 return loopBeginToEx.get(loopBegin); |
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 |
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 public Collection<LoopEx> loops() { |
16191
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
64 return loopToEx.values(); |
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
|
65 } |
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 |
16192
8588f460fa9b
spelling fix: outterFirst -> outerFirst
Doug Simon <doug.simon@oracle.com>
parents:
16191
diff
changeset
|
67 public List<LoopEx> outerFirst() { |
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
|
68 ArrayList<LoopEx> loops = new ArrayList<>(loops()); |
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 Collections.sort(loops, new Comparator<LoopEx>() { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6563
diff
changeset
|
70 |
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
|
71 @Override |
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
|
72 public int compare(LoopEx o1, LoopEx o2) { |
16191
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
73 return o1.loop().getDepth() - o2.loop().getDepth(); |
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
|
74 } |
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
|
75 }); |
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
|
76 return loops; |
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
|
77 } |
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 |
11347
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
79 public List<LoopEx> innerFirst() { |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
80 ArrayList<LoopEx> loops = new ArrayList<>(loops()); |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
81 Collections.sort(loops, new Comparator<LoopEx>() { |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
82 |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
83 @Override |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
84 public int compare(LoopEx o1, LoopEx o2) { |
16191
3e3578bc8f9b
rename: lirLoop* -> loop*
Doug Simon <doug.simon@oracle.com>
parents:
15551
diff
changeset
|
85 return o2.loop().getDepth() - o1.loop().getDepth(); |
11347
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
86 } |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
87 }); |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
88 return loops; |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
89 } |
231c8a83cf41
Samll additions to Loops api, make IntegerExactArithmeticNodes iterable
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9446
diff
changeset
|
90 |
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 public Collection<LoopEx> countedLoops() { |
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 List<LoopEx> counted = new LinkedList<>(); |
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 for (LoopEx loop : loops()) { |
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
|
94 if (loop.isCounted()) { |
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 counted.add(loop); |
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 } |
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 counted; |
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 } |
5610
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
100 |
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
101 public void detectedCountedLoops() { |
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
102 for (LoopEx loop : loops()) { |
12761
8b82bdad798a
Make it possible to run counted loop detection on a single loop.
Roland Schatz <roland.schatz@oracle.com>
parents:
11347
diff
changeset
|
103 loop.detectCounted(); |
5610
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
104 } |
9f3250602d69
Preliminary counted loop detection
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5489
diff
changeset
|
105 } |
5732
e1d5c642d022
Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
106 |
e1d5c642d022
Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
107 public ControlFlowGraph controlFlowGraph() { |
e1d5c642d022
Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
108 return cfg; |
e1d5c642d022
Started to draft a loop unswitching policy
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5675
diff
changeset
|
109 } |
9446
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
110 |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
111 public InductionVariable getInductionVariable(ValueNode value) { |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
112 InductionVariable match = null; |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
113 for (LoopEx loop : loops()) { |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
114 InductionVariable iv = loop.getInductionVariables().get(value); |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
115 if (iv != null) { |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
116 if (match != null) { |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
117 return null; |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
118 } |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
119 match = iv; |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
120 } |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
121 } |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
122 return match; |
27733a62ba72
Fixes and improvements for induction variables
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9234
diff
changeset
|
123 } |
16194
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
124 |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
125 /** |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
126 * 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:
16192
diff
changeset
|
127 */ |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
128 public void deleteUnusedNodes() { |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
129 for (LoopEx loop : loops()) { |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
130 loop.deleteUnusedNodes(); |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
131 } |
7fb828b4c32b
made LoopsData clients clean up dead nodes created during loop analysis
Doug Simon <doug.simon@oracle.com>
parents:
16192
diff
changeset
|
132 } |
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
|
133 } |