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 package org.graalvm.compiler.lir.gen; 24 25 import org.graalvm.compiler.core.common.CompilationIdentifier; 26 import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity; 27 import org.graalvm.compiler.debug.Debug; 28 import org.graalvm.compiler.lir.LIR; 29 import org.graalvm.compiler.lir.LIRInstruction; 30 import org.graalvm.compiler.lir.framemap.FrameMap; 31 import org.graalvm.compiler.lir.framemap.FrameMapBuilder; 32 import org.graalvm.util.EconomicMap; 33 import org.graalvm.util.Equivalence; 34 35 import jdk.vm.ci.code.CallingConvention; 36 37 public class LIRGenerationResult { 38 39 private final LIR lir; 40 private final FrameMapBuilder frameMapBuilder; 41 private FrameMap frameMap; 42 private final CallingConvention callingConvention; 43 /** 44 * Records whether the code being generated makes at least one foreign call. 45 */ 46 private boolean hasForeignCall; 47 /** 48 * Unique identifier of this compilation. 49 */ 50 private CompilationIdentifier compilationId; 51 52 /** 53 * Stores comments about a {@link LIRInstruction} , e.g., which phase created it. 54 */ 55 private EconomicMap<LIRInstruction, String> comments; 56 57 public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention) { 58 this.lir = lir; 59 this.frameMapBuilder = frameMapBuilder; 60 this.callingConvention = callingConvention; 61 this.compilationId = compilationId; 62 } 63 64 /** 65 * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced. 66 */ 67 public final void setComment(LIRInstruction op, String comment) { 68 if (Debug.isDumpEnabled(Debug.BASIC_LEVEL)) { 69 if (comments == null) { 70 comments = EconomicMap.create(Equivalence.IDENTITY); 71 } 72 comments.put(op, comment); 73 } 74 } 75 76 /** 77 * Gets the comment attached to a {@link LIRInstruction}. 78 */ 79 public final String getComment(LIRInstruction op) { 80 if (comments == null) { 81 return null; 82 } 83 return comments.get(op); 84 } 85 86 /** 87 * Returns the incoming calling convention for the parameters of the method that is compiled. 88 */ | 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 package org.graalvm.compiler.lir.gen; 24 25 import org.graalvm.compiler.core.common.CompilationIdentifier; 26 import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity; 27 import org.graalvm.compiler.debug.DebugContext; 28 import org.graalvm.compiler.lir.LIR; 29 import org.graalvm.compiler.lir.LIRInstruction; 30 import org.graalvm.compiler.lir.framemap.FrameMap; 31 import org.graalvm.compiler.lir.framemap.FrameMapBuilder; 32 import org.graalvm.util.EconomicMap; 33 import org.graalvm.util.Equivalence; 34 35 import jdk.vm.ci.code.CallingConvention; 36 37 public class LIRGenerationResult { 38 39 private final LIR lir; 40 private final FrameMapBuilder frameMapBuilder; 41 private FrameMap frameMap; 42 private final CallingConvention callingConvention; 43 /** 44 * Records whether the code being generated makes at least one foreign call. 45 */ 46 private boolean hasForeignCall; 47 /** 48 * Unique identifier of this compilation. 49 */ 50 private CompilationIdentifier compilationId; 51 52 /** 53 * Stores comments about a {@link LIRInstruction} , e.g., which phase created it. 54 */ 55 private EconomicMap<LIRInstruction, String> comments; 56 57 public LIRGenerationResult(CompilationIdentifier compilationId, LIR lir, FrameMapBuilder frameMapBuilder, CallingConvention callingConvention) { 58 this.lir = lir; 59 this.frameMapBuilder = frameMapBuilder; 60 this.callingConvention = callingConvention; 61 this.compilationId = compilationId; 62 } 63 64 /** 65 * Adds a comment to a {@link LIRInstruction}. Existing comments are replaced. 66 */ 67 public final void setComment(LIRInstruction op, String comment) { 68 DebugContext debug = lir.getDebug(); 69 if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) { 70 if (comments == null) { 71 comments = EconomicMap.create(Equivalence.IDENTITY); 72 } 73 comments.put(op, comment); 74 } 75 } 76 77 /** 78 * Gets the comment attached to a {@link LIRInstruction}. 79 */ 80 public final String getComment(LIRInstruction op) { 81 if (comments == null) { 82 return null; 83 } 84 return comments.get(op); 85 } 86 87 /** 88 * Returns the incoming calling convention for the parameters of the method that is compiled. 89 */ |