annotate graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/EndNode.java @ 3516:9b59afa78775

Remove copy method from nodes.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 08 Aug 2011 23:27:54 +0200
parents d95db56f8deb
children 6b841b6b2437
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1 /*
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
4 *
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
7 * published by the Free Software Foundation.
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
8 *
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
13 * accompanied this code).
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
14 *
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
18 *
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
21 * questions.
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
22 */
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
23 package com.oracle.max.graal.compiler.ir;
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
24
3081
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
25 import java.util.*;
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
26
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
27 import com.oracle.max.graal.compiler.debug.*;
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 import com.oracle.max.graal.graph.*;
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
29 import com.sun.cri.ci.*;
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
30
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
31
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
32 public final class EndNode extends FixedNode {
3047
4dd57c0f94a8 Debuggin state
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3008
diff changeset
33
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
34 public EndNode(Graph graph) {
3480
2423a432fa6b changes to Node structure (incomplete)
Lukas Stadler <lukas.stadler@jku.at>
parents: 3225
diff changeset
35 super(CiKind.Illegal, graph);
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36 }
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
37
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
38 @Override
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
39 public void accept(ValueVisitor v) {
2974
d69b4d2eb499 Cleaned up code around moveToPhi. The function is now explicitely called for EndNode and LoopEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2967
diff changeset
40 v.visitEndNode(this);
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
41 }
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
42
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
43 @Override
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
44 public void print(LogStream out) {
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
45 out.print("end");
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
46 }
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
47
2966
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
48 public Merge merge() {
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
49 if (usages().size() == 0) {
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
50 return null;
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
51 } else {
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
52 assert usages().size() == 1;
3481
d95db56f8deb more work on new node structure, executes scimark, fop, avrora, luindex, lusearch, pmd, h2 and xalan
Lukas Stadler <lukas.stadler@jku.at>
parents: 3480
diff changeset
53 return (Merge) usages().iterator().next();
2966
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
54 }
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
55 }
3008
53dcb0794619 Added node verification (and tentative interface for VerificationListener). Fixed regression in dead code elimination.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2974
diff changeset
56
53dcb0794619 Added node verification (and tentative interface for VerificationListener). Fixed regression in dead code elimination.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2974
diff changeset
57 @Override
53dcb0794619 Added node verification (and tentative interface for VerificationListener). Fixed regression in dead code elimination.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2974
diff changeset
58 public boolean verify() {
3013
5ee0f57bb18c added message to verification error, InliningPhase uses TTY
Lukas Stadler <lukas.stadler@jku.at>
parents: 3008
diff changeset
59 assertTrue(usages().size() <= 1, "at most one usage");
3008
53dcb0794619 Added node verification (and tentative interface for VerificationListener). Fixed regression in dead code elimination.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2974
diff changeset
60 return true;
53dcb0794619 Added node verification (and tentative interface for VerificationListener). Fixed regression in dead code elimination.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2974
diff changeset
61 }
3081
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
62
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
63 @Override
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
64 public Iterable< ? extends Node> dataUsages() {
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
65 return Collections.emptyList();
0a5776813ff0 Loop peeling work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3048
diff changeset
66 }
3199
494f0ff09b14 More precise inOrBefore, make both inOrBefore and inOrAfter accessible on Loop, compute inOrAfter, inOrBefore and full loop nodes only if needed
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3081
diff changeset
67
494f0ff09b14 More precise inOrBefore, make both inOrBefore and inOrAfter accessible on Loop, compute inOrAfter, inOrBefore and full loop nodes only if needed
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3081
diff changeset
68 @Override
494f0ff09b14 More precise inOrBefore, make both inOrBefore and inOrAfter accessible on Loop, compute inOrAfter, inOrBefore and full loop nodes only if needed
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3081
diff changeset
69 public Iterable< ? extends Node> cfgSuccessors() {
3225
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3211
diff changeset
70 Merge merge = this.merge();
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3211
diff changeset
71 if (merge == null) {
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3211
diff changeset
72 return Collections.emptyList();
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3211
diff changeset
73 }
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3211
diff changeset
74 return Arrays.asList(merge);
3199
494f0ff09b14 More precise inOrBefore, make both inOrBefore and inOrAfter accessible on Loop, compute inOrAfter, inOrBefore and full loop nodes only if needed
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3081
diff changeset
75 }
2963
fc66984c2f31 Added declaration of EndNode.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
76 }