# HG changeset patch # User Josef Eisl # Date 1395233452 -3600 # Node ID fafbff0eeebf4433bc8baeb6be3dbeadfebc8fa4 # Parent 20dcae7f93ebb32b9d36a83c1053bed2a3c6e003 Removed NodeLIRGenerator again. diff -r 20dcae7f93eb -r fafbff0eeebf graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Mar 19 13:35:13 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Mar 19 13:50:52 2014 +0100 @@ -145,10 +145,10 @@ throw Debug.handle(e); } try (TimerCloseable a = BackEnd.start()) { - LIRGenerationResult lirGen = null; - lirGen = emitLIR(backend, target, schedule, graph, stub, cc); - try (Scope s = Debug.scope("CodeGen", lirGen)) { - emitCode(backend, assumptions, lirGen, compilationResult, installedCodeOwner, factory); + LIRGenerationResult lirGenRes = null; + lirGenRes = emitLIR(backend, target, schedule, graph, stub, cc); + try (Scope s = Debug.scope("CodeGen", lirGenRes)) { + emitCode(backend, assumptions, lirGenRes, compilationResult, installedCodeOwner, factory); } catch (Throwable e) { throw Debug.handle(e); } @@ -210,6 +210,17 @@ } + private static void emitBlock(LIRGenerator lirGen, LIRGenerationResult lirGenRes, Block b, StructuredGraph graph, BlockMap> blockMap) { + if (lirGenRes.getLIR().getLIRforBlock(b) == null) { + for (Block pred : b.getPredecessors()) { + if (!b.isLoopHeader() || !pred.isLoopEnd()) { + emitBlock(lirGen, lirGenRes, pred, graph, blockMap); + } + } + lirGen.doBlock(b, graph, blockMap); + } + } + public static LIRGenerationResult emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, Object stub, CallingConvention cc) { Block[] blocks = schedule.getCFG().getBlocks(); Block startBlock = schedule.getCFG().getStartBlock(); @@ -236,12 +247,13 @@ } try (Scope ds = Debug.scope("BackEnd", lir)) { FrameMap frameMap = backend.newFrameMap(); - LIRGenerationResult lirRes = backend.newLIRGenerationResult(lir, frameMap, stub); - LIRGenerator lirGen = backend.newLIRGenerator(graph, cc, lirRes); - NodeLIRGenerator nodeLirGen = new NodeLIRGenerator(); + LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMap, stub); + LIRGenerator lirGen = backend.newLIRGenerator(graph, cc, lirGenRes); try (Scope s = Debug.scope("LIRGen", lirGen)) { - nodeLirGen.generate(graph, lirRes, lirGen, linearScanOrder, schedule.getBlockToNodesMap()); + for (Block b : linearScanOrder) { + emitBlock(lirGen, lirGenRes, b, graph, schedule.getBlockToNodesMap()); + } lirGen.beforeRegisterAllocation(); Debug.dump(lir, "After LIR generation"); @@ -269,7 +281,7 @@ } catch (Throwable e) { throw Debug.handle(e); } - return lirRes; + return lirGenRes; } catch (Throwable e) { throw Debug.handle(e); } diff -r 20dcae7f93eb -r fafbff0eeebf graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRGenerator.java Wed Mar 19 13:35:13 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.compiler.gen; - -import java.util.*; - -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.cfg.*; - -public class NodeLIRGenerator { - - public LIRGenerationResult generate(StructuredGraph graph, LIRGenerationResult lirRes, LIRGenerator lirGen, List linearScanOrder, BlockMap> blockMap) { - - for (Block b : linearScanOrder) { - emitBlock(lirRes, lirGen, b, graph, blockMap); - } - return null; - } - - private static void emitBlock(LIRGenerationResult lirRes, LIRGenerator lirGen, Block b, StructuredGraph graph, BlockMap> blockMap) { - if (lirRes.getLIR().getLIRforBlock(b) == null) { - for (Block pred : b.getPredecessors()) { - if (!b.isLoopHeader() || !pred.isLoopEnd()) { - emitBlock(lirRes, lirGen, pred, graph, blockMap); - } - } - lirGen.doBlock(b, graph, blockMap); - } - - } -}