comparison graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java @ 2703:42450f536d24

More cleanup towards separation of graphbuilding<>graph<>lirgeneration
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 18 May 2011 17:04:47 +0200
parents 773189811d10
children efbdb3ea95c9
comparison
equal deleted inserted replaced
2702:618f545fcac5 2703:42450f536d24
227 int loopIdx = loopStart.loopIndex(); 227 int loopIdx = loopStart.loopIndex();
228 228
229 if (C1XOptions.TraceLinearScanLevel >= 3) { 229 if (C1XOptions.TraceLinearScanLevel >= 3) {
230 TTY.println("Processing loop from B%d to B%d (loop %d):", loopStart.blockID, loopEnd.blockID, loopIdx); 230 TTY.println("Processing loop from B%d to B%d (loop %d):", loopStart.blockID, loopEnd.blockID, loopIdx);
231 } 231 }
232 assert loopEnd.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd) : "loop end flag must be set"; 232 assert loopEnd.isLinearScanLoopEnd() : "loop end flag must be set";
233 assert loopStart.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "loop header flag must be set"; 233 assert loopStart.isLinearScanLoopHeader() : "loop header flag must be set";
234 assert loopIdx >= 0 && loopIdx < numLoops : "loop index not set"; 234 assert loopIdx >= 0 && loopIdx < numLoops : "loop index not set";
235 assert workList.isEmpty() : "work list must be empty before processing"; 235 assert workList.isEmpty() : "work list must be empty before processing";
236 236
237 // add the end-block of the loop to the working list 237 // add the end-block of the loop to the working list
238 workList.add(loopEnd); 238 workList.add(loopEnd);
339 int curBit = 15; 339 int curBit = 15;
340 340
341 // this is necessary for the (very rare) case that two successive blocks have 341 // this is necessary for the (very rare) case that two successive blocks have
342 // the same loop depth, but a different loop index (can happen for endless loops 342 // the same loop depth, but a different loop index (can happen for endless loops
343 // with exception handlers) 343 // with exception handlers)
344 if (!cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader)) { 344 if (!cur.isLinearScanLoopHeader()) {
345 weight |= (1 << curBit); 345 weight |= (1 << curBit);
346 } 346 }
347 curBit--; 347 curBit--;
348 348
349 // loop end blocks (blocks that end with a backward branch) are added 349 // loop end blocks (blocks that end with a backward branch) are added
350 // after all other blocks of the loop. 350 // after all other blocks of the loop.
351 if (!cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd)) { 351 if (!cur.isLinearScanLoopEnd()) {
352 weight |= (1 << curBit); 352 weight |= (1 << curBit);
353 } 353 }
354 curBit--; 354 curBit--;
355 355
356 // critical edge split blocks are preferred because then they have a greater 356 // critical edge split blocks are preferred because then they have a greater
503 for (BlockBegin cur : linearScanOrder) { 503 for (BlockBegin cur : linearScanOrder) {
504 TTY.print(String.format("%4d: B%02d loop: %2d depth: %2d", cur.linearScanNumber(), cur.blockID, cur.loopIndex(), cur.loopDepth())); 504 TTY.print(String.format("%4d: B%02d loop: %2d depth: %2d", cur.linearScanNumber(), cur.blockID, cur.loopIndex(), cur.loopDepth()));
505 505
506 TTY.print(cur.isExceptionEntry() ? " ex" : " "); 506 TTY.print(cur.isExceptionEntry() ? " ex" : " ");
507 TTY.print(cur.isCriticalEdgeSplit() ? " ce" : " "); 507 TTY.print(cur.isCriticalEdgeSplit() ? " ce" : " ");
508 TTY.print(cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) ? " lh" : " "); 508 TTY.print(cur.isLinearScanLoopHeader() ? " lh" : " ");
509 TTY.print(cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd) ? " le" : " "); 509 TTY.print(cur.isLinearScanLoopEnd() ? " le" : " ");
510 510
511 if (cur.numberOfPreds() > 0) { 511 if (cur.numberOfPreds() > 0) {
512 TTY.print(" preds: "); 512 TTY.print(" preds: ");
513 for (int j = 0; j < cur.numberOfPreds(); j++) { 513 for (int j = 0; j < cur.numberOfPreds(); j++) {
514 BlockBegin pred = cur.predAt(j).begin(); 514 BlockBegin pred = cur.predAt(j).begin();