2921
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1 /*
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
4 *
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
7 * published by the Free Software Foundation.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
8 *
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
13 * accompanied this code).
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
14 *
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
18 *
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
21 * questions.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
22 */
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
23 package com.oracle.max.graal.compiler.ir;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
24
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
25 import com.oracle.max.graal.compiler.debug.*;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
26 import com.oracle.max.graal.graph.*;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
27 import com.sun.cri.ci.*;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
28
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
29
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
30 public final class ClipNode extends Instruction {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
31 private static final int INPUT_COUNT = 1;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
32 private static final int INPUT_NODE = 0;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
33
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
34 private static final int SUCCESSOR_COUNT = 0;
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
35
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
36 /**
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
37 * The instruction that produces the object tested against null.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
38 */
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
39 public FloatingNode node() {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
40 return (FloatingNode) inputs().get(super.inputCount() + INPUT_NODE);
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
41 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
42
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
43 public FloatingNode setNode(FloatingNode n) {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
44 return (FloatingNode) inputs().set(super.inputCount() + INPUT_NODE, n);
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
45 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
46
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
47 public ClipNode(Graph graph) {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
48 super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph);
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
49 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
50
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
51 @Override
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
52 public void accept(ValueVisitor v) {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
53 // Do nothing.
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
54 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
55
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
56 @Override
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
57 public void print(LogStream out) {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
58 out.print("clip node ").print(node());
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
59 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
60
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
61 @Override
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
62 public Node copy(Graph into) {
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
63 return new ClipNode(into);
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
64 }
|
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
65 }
|