Mercurial > hg > graal-jvmci-8
annotate graal/GraalCompiler/src/com/sun/c1x/ir/ValueAnchor.java @ 2866:7f14e6b48a9c
added dead code elimination
added ValueAnchor (temp workaround)
more inlining logic (now uses DCE)
IdealGraphPrinter: print even if Scheduler fails
added inlining and DCE tracing options to C1XOptions
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Tue, 07 Jun 2011 16:27:08 +0200 |
parents | |
children | 5c545fef2c81 |
rev | line source |
---|---|
2866
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
23 package com.sun.c1x.ir; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
25 import com.oracle.graal.graph.*; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
26 import com.sun.c1x.debug.*; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
27 import com.sun.cri.ci.*; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 /** |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 * The ValueAnchor instruction keeps non-CFG nodes above a certain point in the graph. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 */ |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 public final class ValueAnchor extends Instruction { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
33 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 private static final int INPUT_COUNT = 1; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 private static final int INPUT_OBJECT = 0; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 private static final int SUCCESSOR_COUNT = 0; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
39 @Override |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 protected int inputCount() { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 return super.inputCount() + INPUT_COUNT; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 @Override |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 protected int successorCount() { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 return super.successorCount() + SUCCESSOR_COUNT; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 /** |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
50 * The instruction that should be scheduled before this anchor. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 */ |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 public Value object() { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
53 return (Value) inputs().get(super.inputCount() + INPUT_OBJECT); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
54 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
55 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
56 public Value setObject(Value n) { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
58 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
59 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
60 /** |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
61 * Constructs a new Anchor instruction. |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
62 * @param succ the successor block of the anchor |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
63 * @param graph |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 */ |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
65 public ValueAnchor(Value object, Graph graph) { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
66 super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
67 setObject(object); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
68 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
69 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
70 @Override |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
71 public void accept(ValueVisitor v) { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
72 v.visitValueAnchor(this); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
73 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
74 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
75 @Override |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
76 public void print(LogStream out) { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
77 out.print("value_anchor ").print(object()); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
78 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
79 |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
80 @Override |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
81 public Node copy(Graph into) { |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
82 ValueAnchor x = new ValueAnchor(null, into); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
83 x.setNonNull(isNonNull()); |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
84 return x; |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
85 } |
7f14e6b48a9c
added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
86 } |