< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/gen/LIRGenerationResult.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.lir.gen;
  26 
  27 import jdk.internal.vm.compiler.collections.EconomicMap;
  28 import jdk.internal.vm.compiler.collections.Equivalence;
  29 import org.graalvm.compiler.core.common.CompilationIdentifier;
  30 import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity;

  31 import org.graalvm.compiler.debug.DebugContext;
  32 import org.graalvm.compiler.lir.LIR;
  33 import org.graalvm.compiler.lir.LIRInstruction;
  34 import org.graalvm.compiler.lir.framemap.FrameMap;
  35 import org.graalvm.compiler.lir.framemap.FrameMapBuilder;
  36 
  37 import jdk.vm.ci.code.CallingConvention;
  38 import jdk.vm.ci.code.RegisterConfig;
  39 
  40 public class LIRGenerationResult {
  41 
  42     private final LIR lir;
  43     private final FrameMapBuilder frameMapBuilder;
  44     private FrameMap frameMap;

  45     private final CallingConvention callingConvention;
  46     /**
  47      * Records whether the code being generated makes at least one foreign call.
  48      */
  49     private boolean hasForeignCall;
  50     /**
  51      * Unique identifier of this compilation.
  52      */
  53     private CompilationIdentifier compilationId;
  54 
  55     /**
  56      * Stores comments about a {@link LIRInstruction} , e.g., which phase created it.
  57      */
  58     private EconomicMap<LIRInstruction, String> comments;
  59 
  60     public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention) {
  61         this.lir = lir;
  62         this.frameMapBuilder = frameMapBuilder;

  63         this.callingConvention = callingConvention;
  64         this.compilationId = compilationId;




  65     }
  66 
  67     /**
  68      * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced.
  69      */
  70     public final void setComment(LIRInstruction op, String comment) {
  71         DebugContext debug = lir.getDebug();
  72         if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) {
  73             if (comments == null) {
  74                 comments = EconomicMap.create(Equivalence.IDENTITY);
  75             }
  76             comments.put(op, comment);
  77         }
  78     }
  79 
  80     /**
  81      * Gets the comment attached to a {@link LIRInstruction}.
  82      */
  83     public final String getComment(LIRInstruction op) {
  84         if (comments == null) {


   1 /*
   2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.lir.gen;
  26 
  27 import jdk.internal.vm.compiler.collections.EconomicMap;
  28 import jdk.internal.vm.compiler.collections.Equivalence;
  29 import org.graalvm.compiler.core.common.CompilationIdentifier;
  30 import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity;
  31 import org.graalvm.compiler.core.common.alloc.RegisterAllocationConfig;
  32 import org.graalvm.compiler.debug.DebugContext;
  33 import org.graalvm.compiler.lir.LIR;
  34 import org.graalvm.compiler.lir.LIRInstruction;
  35 import org.graalvm.compiler.lir.framemap.FrameMap;
  36 import org.graalvm.compiler.lir.framemap.FrameMapBuilder;
  37 
  38 import jdk.vm.ci.code.CallingConvention;
  39 import jdk.vm.ci.code.RegisterConfig;
  40 
  41 public class LIRGenerationResult {
  42 
  43     private final LIR lir;
  44     private final FrameMapBuilder frameMapBuilder;
  45     private FrameMap frameMap;
  46     private final RegisterAllocationConfig registerAllocationConfig;
  47     private final CallingConvention callingConvention;
  48     /**
  49      * Records whether the code being generated makes at least one foreign call.
  50      */
  51     private boolean hasForeignCall;
  52     /**
  53      * Unique identifier of this compilation.
  54      */
  55     private CompilationIdentifier compilationId;
  56 
  57     /**
  58      * Stores comments about a {@link LIRInstruction} , e.g., which phase created it.
  59      */
  60     private EconomicMap<LIRInstruction, String> comments;
  61 
  62     public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, RegisterAllocationConfig registerAllocationConfig, CallingConvention callingConvention) {
  63         this.lir = lir;
  64         this.frameMapBuilder = frameMapBuilder;
  65         this.registerAllocationConfig = registerAllocationConfig;
  66         this.callingConvention = callingConvention;
  67         this.compilationId = compilationId;
  68     }
  69 
  70     public RegisterAllocationConfig getRegisterAllocationConfig() {
  71         return registerAllocationConfig;
  72     }
  73 
  74     /**
  75      * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced.
  76      */
  77     public final void setComment(LIRInstruction op, String comment) {
  78         DebugContext debug = lir.getDebug();
  79         if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) {
  80             if (comments == null) {
  81                 comments = EconomicMap.create(Equivalence.IDENTITY);
  82             }
  83             comments.put(op, comment);
  84         }
  85     }
  86 
  87     /**
  88      * Gets the comment attached to a {@link LIRInstruction}.
  89      */
  90     public final String getComment(LIRInstruction op) {
  91         if (comments == null) {


< prev index next >