annotate graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java @ 2779:93ec3f067420

Changed CriticalEdgeFinder to use LIRBlock.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 25 May 2011 11:04:59 +0200
parents 2ac7b30b7290
children 9bc0c2eb00d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2677
0ea5f12e873a use com.oracle.max.asm project for assembler
Christian.Wimmer@Oracle.com
parents: 2509
diff changeset
27 import com.oracle.max.asm.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 import com.sun.c1x.alloc.*;
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
29 import com.sun.c1x.debug.*;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
30 import com.sun.c1x.ir.*;
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.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
32 import com.sun.cri.ci.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
33
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 * The {@code LIRBlock} class definition.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
37 public final class LIRBlock {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
38
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
39 public final Label label = new Label();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
40 private LIRList lir;
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
41 private final int blockID;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
42 private List<Instruction> instructions = new ArrayList<Instruction>(4);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2761
diff changeset
43 private List<LIRBlock> predecessors = new ArrayList<LIRBlock>(4);
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2761
diff changeset
44 private List<LIRBlock> successors = new ArrayList<LIRBlock>(4);
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
45 private List<LIRBlock> exceptionHandlerSuccessors = new ArrayList<LIRBlock>(4);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
46
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 * 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
49 * 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
50 * in this block.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
51 * 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
52 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
53 public CiBitMap liveIn;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
54
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 * 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
57 * 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
58 * upon entry to this block.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
59 * 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
60 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
61 public CiBitMap liveOut;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
62
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 * 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
65 * 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
66 * 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
67 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
68 public CiBitMap liveGen;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
69
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 * 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
72 * 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
73 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
74 public CiBitMap liveKill;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
75
2703
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
76 private int firstLirInstructionID;
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
77 private int lastLirInstructionID;
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2677
diff changeset
78 public int blockEntryPco;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
79
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
80 public List<LIRBlock> getExceptionHandlerSuccessors() {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
81 return exceptionHandlerSuccessors;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
82 }
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
83
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
84 public LIRBlock(int blockID) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
85 this.blockID = blockID;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
86 loopIndex = -1;
2760
127db58b044e One more step towards schedule.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2718
diff changeset
87 linearScanNumber = blockID;
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
88 }
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 public List<Instruction> getInstructions() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
91 return instructions;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
92 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
93
2703
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
94 public int firstLirInstructionId() {
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
95 return firstLirInstructionID;
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
96 }
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 public void setFirstLirInstructionId(int firstLirInstructionId) {
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
99 this.firstLirInstructionID = firstLirInstructionId;
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
100 }
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 public int lastLirInstructionId() {
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
103 return lastLirInstructionID;
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
104 }
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
105
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
106 public void setLastLirInstructionId(int lastLirInstructionId) {
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
107 this.lastLirInstructionID = lastLirInstructionId;
42450f536d24 More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2700
diff changeset
108 }
2700
d06cff53b77e More cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2677
diff changeset
109
d06cff53b77e More cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2677
diff changeset
110 public int loopDepth;
d06cff53b77e More cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2677
diff changeset
111
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 public LIRList lir() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
113 return lir;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
114 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
115
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
116 public void setLir(LIRList lir) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
117 this.lir = lir;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
118 }
2718
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 public void setBlockEntryPco(int codePos) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
121 this.blockEntryPco = codePos;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
122 }
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 public void printWithoutPhis(LogStream out) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
125 out.println("LIR Block " + blockID());
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
126 }
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 public int blockID() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
129 return blockID;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
130 }
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 public int numberOfPreds() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
133 return predecessors.size();
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
134 }
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 public int numberOfSux() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
137 return successors.size();
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
138 }
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 public boolean isPredecessor(LIRBlock block) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
141 return predecessors.contains(block);
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
142 }
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 public LIRBlock predAt(int i) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
145 return predecessors.get(i);
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
146 }
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 public LIRBlock suxAt(int i) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
149 return successors.get(i);
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
150 }
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 public List<LIRBlock> blockSuccessors() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
153 return successors;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
154 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
155
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
156 @Override
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
157 public String toString() {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
158 return "B" + blockID();
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
159 }
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
160
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
161 public List<LIRBlock> blockPredecessors() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
162 return predecessors;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
163 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
164
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
165 public int loopDepth() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
166 // TODO(tw): Set correct loop depth.
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
167 return 0;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
168 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
169
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
170 public int loopIndex() {
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
171 return loopIndex;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
172 }
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
173
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
174 public void setLoopIndex(int v) {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
175 loopIndex = v;
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
176 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
177
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
178 public void setLoopDepth(int v) {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
179 this.loopDepth = v;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
180 }
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
181
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
182 private int loopIndex;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
183
2718
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
184 public Label label() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
185 return label;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
186 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
187
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
188 private int linearScanNumber = -1;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
189 private boolean linearScanLoopEnd;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
190 private boolean linearScanLoopHeader;
2778
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
191 private boolean exceptionEntry;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
192 private boolean backwardBranchTarget;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
193
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 public void setExceptionEntry(boolean b) {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
196 this.exceptionEntry = b;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
197 }
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 public boolean isExceptionEntry() {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
200 return exceptionEntry;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
201 }
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 public void setBackwardBranchTarget(boolean b) {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
204 this.backwardBranchTarget = b;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
205 }
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
206
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
207 public boolean backwardBranchTarget() {
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
208 return backwardBranchTarget;
2ac7b30b7290 Enabled new block finding algorithm.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2777
diff changeset
209 }
2718
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 public void setLinearScanNumber(int v) {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
212 linearScanNumber = v;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
213 }
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 public int linearScanNumber() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
216 return linearScanNumber;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
217 }
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 public void setLinearScanLoopEnd() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
220 linearScanLoopEnd = true;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
221 }
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 public boolean isLinearScanLoopEnd() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
224 return linearScanLoopEnd;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
225 }
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 public void setLinearScanLoopHeader() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
228 this.linearScanLoopHeader = true;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
229 }
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 public boolean isLinearScanLoopHeader() {
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
232 return linearScanLoopHeader;
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
233 }
c1ce2a53d6c3 Attempt to remove dependency between backend and BlockBegin.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
234
2761
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
235 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
236 for (LIRBlock pred : predecessors) {
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
237 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
238 }
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
239 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
240 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
241 other.predecessors.remove(i);
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
242 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
243 }
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
244 }
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
245 successors.clear();
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
246 predecessors.clear();
d3398b21faf9 Re-enabled CFG optimization (now only on LIRBlock data structure).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2760
diff changeset
247 }
2777
3e4d992fd312 towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
248
3e4d992fd312 towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
249 public void setInstructions(List<Instruction> list) {
3e4d992fd312 towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
250 instructions = list;
3e4d992fd312 towards replacing computelinearscanorder with scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
251 }
2779
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
252
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
253 public void substituteSuccessor(LIRBlock target, LIRBlock newSucc) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
254 for (int i = 0; i < successors.size(); ++i) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
255 if (successors.get(i) == target) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
256 successors.set(i, newSucc);
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 }
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
260
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
261 public void substitutePredecessor(LIRBlock source, LIRBlock newSucc) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
262 for (int i = 0; i < predecessors.size(); ++i) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
263 if (predecessors.get(i) == source) {
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
264 predecessors.set(i, newSucc);
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 }
93ec3f067420 Changed CriticalEdgeFinder to use LIRBlock.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2778
diff changeset
267 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
268 }