Mercurial > hg > truffle
annotate graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java @ 2832:775c31be565c
Clean up. Removed special exception successors in LIRBlock. Throw no longer a BlockEnd.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 31 May 2011 11:50:19 +0200 |
parents | c3f64b66fc78 |
children | 1cd59ca9ac86 |
rev | line source |
---|---|
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1 /* |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
4 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
8 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
13 * accompanied this code). |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
14 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
18 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
21 * questions. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
22 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
23 package com.sun.c1x.lir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
24 |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
25 import java.util.*; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
26 |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
27 import com.oracle.graal.graph.*; |
2677
0ea5f12e873a
use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents:
2509
diff
changeset
|
28 import com.oracle.max.asm.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
29 import com.sun.c1x.alloc.*; |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
30 import com.sun.c1x.debug.*; |
2761
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
31 import com.sun.c1x.util.*; |
2783
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
32 import com.sun.c1x.value.*; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
33 import com.sun.cri.ci.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
34 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
35 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
36 * The {@code LIRBlock} class definition. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
37 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
38 public final class LIRBlock { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
39 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
40 public final Label label = new Label(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
41 private LIRList lir; |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
42 private final int blockID; |
2783
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
43 private FrameState lastState; |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
44 private List<Node> instructions = new ArrayList<Node>(4); |
2768
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2761
diff
changeset
|
45 private List<LIRBlock> predecessors = new ArrayList<LIRBlock>(4); |
43ffa0e47a46
Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2761
diff
changeset
|
46 private List<LIRBlock> successors = new ArrayList<LIRBlock>(4); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
47 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
48 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
49 * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
50 * These are values used in this block or any of its successors where such value are not defined |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
51 * in this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
52 * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
53 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
54 public CiBitMap liveIn; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
55 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
56 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
57 * Bit map specifying which {@linkplain OperandPool operands} are live upon exit from this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
58 * These are values used in a successor block that are either defined in this block or were live |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
59 * upon entry to this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
60 * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
61 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
62 public CiBitMap liveOut; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
63 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
64 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
65 * Bit map specifying which {@linkplain OperandPool operands} are used (before being defined) in this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
66 * That is, these are the values that are live upon entry to the block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
67 * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
68 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
69 public CiBitMap liveGen; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
70 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
71 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
72 * Bit map specifying which {@linkplain OperandPool operands} are defined/overwritten in this block. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
73 * The bit index of an operand is its {@linkplain OperandPool#operandNumber(com.sun.cri.ci.CiValue) operand number}. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
74 */ |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
75 public CiBitMap liveKill; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
76 |
2703
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
77 private int firstLirInstructionID; |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
78 private int lastLirInstructionID; |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2677
diff
changeset
|
79 public int blockEntryPco; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
80 |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
81 public LIRBlock(int blockID) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
82 this.blockID = blockID; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
83 loopIndex = -1; |
2760
127db58b044e
One more step towards schedule.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2718
diff
changeset
|
84 linearScanNumber = blockID; |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
85 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
86 |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
87 public List<Node> getInstructions() { |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
88 return instructions; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
89 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
90 |
2703
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
91 public int firstLirInstructionId() { |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
92 return firstLirInstructionID; |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
93 } |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
94 |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
95 public void setFirstLirInstructionId(int firstLirInstructionId) { |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
96 this.firstLirInstructionID = firstLirInstructionId; |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
97 } |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
98 |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
99 public int lastLirInstructionId() { |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
100 return lastLirInstructionID; |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
101 } |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
102 |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
103 public void setLastLirInstructionId(int lastLirInstructionId) { |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
104 this.lastLirInstructionID = lastLirInstructionId; |
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
105 } |
2700 | 106 |
107 public int loopDepth; | |
108 | |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
109 public LIRList lir() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
110 return lir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
111 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
112 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
113 public void setLir(LIRList lir) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
114 this.lir = lir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
115 } |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
116 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
117 public void setBlockEntryPco(int codePos) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
118 this.blockEntryPco = codePos; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
119 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
120 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
121 public void printWithoutPhis(LogStream out) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
122 out.println("LIR Block " + blockID()); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
123 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
124 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
125 public int blockID() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
126 return blockID; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
127 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
128 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
129 public int numberOfPreds() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
130 return predecessors.size(); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
131 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
132 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
133 public int numberOfSux() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
134 return successors.size(); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
135 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
136 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
137 public boolean isPredecessor(LIRBlock block) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
138 return predecessors.contains(block); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
139 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
140 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
141 public LIRBlock predAt(int i) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
142 return predecessors.get(i); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
143 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
144 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
145 public LIRBlock suxAt(int i) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
146 return successors.get(i); |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
147 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
148 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
149 public List<LIRBlock> blockSuccessors() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
150 return successors; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
151 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
152 |
2778
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
153 @Override |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
154 public String toString() { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
155 return "B" + blockID(); |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
156 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
157 |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
158 public List<LIRBlock> blockPredecessors() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
159 return predecessors; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
160 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
161 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
162 public int loopDepth() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
163 // TODO(tw): Set correct loop depth. |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
164 return 0; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
165 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
166 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
167 public int loopIndex() { |
2778
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
168 return loopIndex; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
169 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
170 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
171 public void setLoopIndex(int v) { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
172 loopIndex = v; |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
173 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
174 |
2778
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
175 public void setLoopDepth(int v) { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
176 this.loopDepth = v; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
177 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
178 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
179 private int loopIndex; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
180 |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
181 public Label label() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
182 return label; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
183 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
184 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
185 private int linearScanNumber = -1; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
186 private boolean linearScanLoopEnd; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
187 private boolean linearScanLoopHeader; |
2778
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
188 private boolean exceptionEntry; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
189 private boolean backwardBranchTarget; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
190 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
191 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
192 public void setExceptionEntry(boolean b) { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
193 this.exceptionEntry = b; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
194 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
195 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
196 public boolean isExceptionEntry() { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
197 return exceptionEntry; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
198 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
199 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
200 public void setBackwardBranchTarget(boolean b) { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
201 this.backwardBranchTarget = b; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
202 } |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
203 |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
204 public boolean backwardBranchTarget() { |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
205 return backwardBranchTarget; |
2ac7b30b7290
Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2777
diff
changeset
|
206 } |
2718
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
207 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
208 public void setLinearScanNumber(int v) { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
209 linearScanNumber = v; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
210 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
211 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
212 public int linearScanNumber() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
213 return linearScanNumber; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
214 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
215 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
216 public void setLinearScanLoopEnd() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
217 linearScanLoopEnd = true; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
218 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
219 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
220 public boolean isLinearScanLoopEnd() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
221 return linearScanLoopEnd; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
222 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
223 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
224 public void setLinearScanLoopHeader() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
225 this.linearScanLoopHeader = true; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
226 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
227 |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
228 public boolean isLinearScanLoopHeader() { |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
229 return linearScanLoopHeader; |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
230 } |
c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
231 |
2761
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
232 public void replaceWith(LIRBlock other) { |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
233 for (LIRBlock pred : predecessors) { |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
234 Util.replaceAllInList(this, other, pred.successors); |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
235 } |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
236 for (int i = 0; i < other.predecessors.size(); ++i) { |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
237 if (other.predecessors.get(i) == this) { |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
238 other.predecessors.remove(i); |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
239 other.predecessors.addAll(i, this.predecessors); |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
240 } |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
241 } |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
242 successors.clear(); |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
243 predecessors.clear(); |
d3398b21faf9
Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2760
diff
changeset
|
244 } |
2777
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
245 |
2801
2af109bec0c0
Make block contains a list of nodes instead a list of instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2789
diff
changeset
|
246 public void setInstructions(List<Node> list) { |
2777
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
247 instructions = list; |
3e4d992fd312
towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2768
diff
changeset
|
248 } |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
249 |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
250 public void substituteSuccessor(LIRBlock target, LIRBlock newSucc) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
251 for (int i = 0; i < successors.size(); ++i) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
252 if (successors.get(i) == target) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
253 successors.set(i, newSucc); |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
254 break; |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
255 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
256 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
257 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
258 |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
259 public void substitutePredecessor(LIRBlock source, LIRBlock newSucc) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
260 for (int i = 0; i < predecessors.size(); ++i) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
261 if (predecessors.get(i) == source) { |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
262 predecessors.set(i, newSucc); |
2789
aeccd2af4e9e
Fixes around critical edge split and placeholder removal after goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2783
diff
changeset
|
263 break; |
2779
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
264 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
265 } |
93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2778
diff
changeset
|
266 } |
2783
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
267 |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
268 public void setLastState(FrameState fs) { |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
269 lastState = fs; |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
270 } |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
271 |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
272 public FrameState lastState() { |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
273 return lastState; |
9bc0c2eb00d6
Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2779
diff
changeset
|
274 } |
2805
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
275 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
276 private Node first; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
277 private Node last; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
278 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
279 public Node firstInstruction() { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
280 return first; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
281 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
282 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
283 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
284 public Node lastInstruction() { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
285 return last; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
286 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
287 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
288 public void setFirstInstruction(Node n) { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
289 first = n; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
290 } |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
291 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
292 |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
293 public void setLastInstruction(Node n) { |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
294 last = n; |
c3f64b66fc78
Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2801
diff
changeset
|
295 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
296 } |