changeset 21257:257fd6a46525

Add option to include LIR in final assembly as comments
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 04 May 2015 23:30:11 -0700
parents e11eb6ec180e
children 25d71cc054e5
files graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java	Mon May 04 23:15:42 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java	Mon May 04 23:30:11 2015 -0700
@@ -38,6 +38,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.framemap.*;
+import com.oracle.graal.options.*;
 
 /**
  * Fills in a {@link CompilationResult} as its code is being assembled.
@@ -46,6 +47,11 @@
  */
 public class CompilationResultBuilder {
 
+    // @formatter:off
+    @Option(help = "Include the LIR as comments with the final assembly.", type = OptionType.Debug)
+    public static final OptionValue<Boolean> PrintLIRWithAssembly = new OptionValue<>(false);
+    // @formatter:on
+
     private static class ExceptionInfo {
 
         public final int codeOffset;
@@ -353,12 +359,12 @@
     }
 
     private void emitBlock(AbstractBlockBase<?> block) {
-        if (Debug.isDumpEnabled()) {
+        if (Debug.isDumpEnabled() || PrintLIRWithAssembly.getValue()) {
             blockComment(String.format("block B%d %s", block.getId(), block.getLoop()));
         }
 
         for (LIRInstruction op : lir.getLIRforBlock(block)) {
-            if (Debug.isDumpEnabled()) {
+            if (Debug.isDumpEnabled() || PrintLIRWithAssembly.getValue()) {
                 blockComment(String.format("%d %s", op.id(), op));
             }