Mercurial > hg > graal-jvmci-8
annotate graal/GraalCompiler/src/com/sun/c1x/ir/LoopEnd.java @ 2842:7596ae867a7b
basic inlining passes all tests, including optimistic inlining
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 01 Jun 2011 16:26:17 +0200 |
parents | bd17ac598c6e |
children | 14708c03abba |
rev | line source |
---|---|
2799
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
23 package com.sun.c1x.ir; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
25 import com.oracle.graal.graph.*; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
26 import com.sun.c1x.debug.*; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
27 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 public class LoopEnd extends Merge { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 private static final int INPUT_COUNT = 1; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 private static final int INPUT_LOOP_BEGIN = 0; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
33 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 private static final int SUCCESSOR_COUNT = 0; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 @Override |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 protected int inputCount() { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 return super.inputCount() + INPUT_COUNT; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
39 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 @Override |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 protected int successorCount() { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 return super.successorCount() + SUCCESSOR_COUNT; |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 /** |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 * The instruction which produces the input value to this instruction. |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 */ |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 public LoopBegin loopBegin() { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
50 return (LoopBegin) inputs().get(super.inputCount() + INPUT_LOOP_BEGIN); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
53 public LoopBegin setLoopBegin(LoopBegin n) { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
54 return (LoopBegin) inputs().set(super.inputCount() + INPUT_LOOP_BEGIN, n); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
55 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
56 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 public LoopEnd(Graph graph) { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
58 super(INPUT_COUNT, SUCCESSOR_COUNT, graph); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
59 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
60 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
61 @Override |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
62 public void accept(ValueVisitor v) { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
63 v.visitLoopEnd(this); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
65 |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
66 @Override |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
67 public void print(LogStream out) { |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
68 out.print("loopEnd ").print(loopBegin()); |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
69 } |
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
70 |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
71 @Override |
2842
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
72 public String shortName() { |
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
73 return "LoopEnd"; |
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
74 } |
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
75 |
7596ae867a7b
basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents:
2827
diff
changeset
|
76 @Override |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
77 public Node copy(Graph into) { |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
78 LoopEnd x = new LoopEnd(into); |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
79 x.setNonNull(isNonNull()); |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
80 return x; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2799
diff
changeset
|
81 } |
2799
e1dad0edd57a
first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
82 } |