Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/graph/IR.java @ 2841:633e66de40fe
merge
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Tue, 31 May 2011 16:54:15 +0200 |
parents | 75e0d39833a0 adc4b3ec0a8c |
children | 7596ae867a7b |
comparison
equal
deleted
inserted
replaced
2840:75e0d39833a0 | 2841:633e66de40fe |
---|---|
87 // replacement.put(compilation.graph.start(), newGraph.start()); | 87 // replacement.put(compilation.graph.start(), newGraph.start()); |
88 // replacement.put(compilation.graph.end(), newGraph.end()); | 88 // replacement.put(compilation.graph.end(), newGraph.end()); |
89 // newGraph.addDuplicate(compilation.graph.getNodes(), replacement); | 89 // newGraph.addDuplicate(compilation.graph.getNodes(), replacement); |
90 // compilation.graph = newGraph; | 90 // compilation.graph = newGraph; |
91 | 91 |
92 Schedule schedule = new Schedule(this.compilation.graph); | 92 Graph graph = compilation.graph; |
93 | |
94 // Split critical edges. | |
95 List<Node> nodes = graph.getNodes(); | |
96 for (int i = 0; i < nodes.size(); ++i) { | |
97 Node n = nodes.get(i); | |
98 if (Schedule.trueSuccessorCount(n) > 1) { | |
99 for (int j = 0; j < n.successors().size(); ++j) { | |
100 Node succ = n.successors().get(j); | |
101 if (Schedule.truePredecessorCount(succ) > 1) { | |
102 Anchor a = new Anchor(null, graph); | |
103 a.successors().setAndClear(1, n, j); | |
104 n.successors().set(j, a); | |
105 } | |
106 } | |
107 } | |
108 } | |
109 | |
110 Schedule schedule = new Schedule(graph); | |
93 List<Block> blocks = schedule.getBlocks(); | 111 List<Block> blocks = schedule.getBlocks(); |
94 List<LIRBlock> lirBlocks = new ArrayList<LIRBlock>(); | 112 List<LIRBlock> lirBlocks = new ArrayList<LIRBlock>(); |
95 Map<Block, LIRBlock> map = new HashMap<Block, LIRBlock>(); | 113 Map<Block, LIRBlock> map = new HashMap<Block, LIRBlock>(); |
96 for (Block b : blocks) { | 114 for (Block b : blocks) { |
97 LIRBlock block = new LIRBlock(b.blockID()); | 115 LIRBlock block = new LIRBlock(b.blockID()); |
112 for (Block pred : b.getPredecessors()) { | 130 for (Block pred : b.getPredecessors()) { |
113 map.get(b).blockPredecessors().add(map.get(pred)); | 131 map.get(b).blockPredecessors().add(map.get(pred)); |
114 } | 132 } |
115 } | 133 } |
116 | 134 |
117 CriticalEdgeFinder finder = new CriticalEdgeFinder(lirBlocks, compilation.graph); | |
118 finder.splitCriticalEdges(); | |
119 | |
120 orderedBlocks = lirBlocks; | 135 orderedBlocks = lirBlocks; |
121 valueToBlock = new HashMap<Node, LIRBlock>(); | 136 valueToBlock = new HashMap<Node, LIRBlock>(); |
122 for (LIRBlock b : orderedBlocks) { | 137 for (LIRBlock b : orderedBlocks) { |
123 for (Node i : b.getInstructions()) { | 138 for (Node i : b.getInstructions()) { |
124 valueToBlock.put(i, b); | 139 valueToBlock.put(i, b); |
125 } | 140 } |
126 } | 141 } |
127 startBlock = lirBlocks.get(0); | 142 startBlock = lirBlocks.get(0); |
128 assert startBlock != null; | 143 assert startBlock != null; |
129 assert startBlock.blockPredecessors().size() == 0; | 144 assert startBlock.blockPredecessors().size() == 0; |
130 | |
131 /* if (startBlock.blockPredecessors().size() > 0) { | |
132 LIRBlock oldStartBlock = startBlock; | |
133 startBlock = new LIRBlock(orderedBlocks.size()); | |
134 startBlock.blockSuccessors().add(oldStartBlock); | |
135 | |
136 orderedBlocks.add(startBlock); | |
137 }*/ | |
138 | 145 |
139 ComputeLinearScanOrder clso = new ComputeLinearScanOrder(lirBlocks.size(), startBlock); | 146 ComputeLinearScanOrder clso = new ComputeLinearScanOrder(lirBlocks.size(), startBlock); |
140 orderedBlocks = clso.linearScanOrder(); | 147 orderedBlocks = clso.linearScanOrder(); |
141 this.compilation.stats.loopCount = clso.numLoops(); | 148 this.compilation.stats.loopCount = clso.numLoops(); |
142 | 149 |