annotate graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ClipNode.java @ 2921:d01b4f441613

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