# HG changeset patch # User Tom Rodriguez # Date 1430807411 25200 # Node ID 257fd6a4652580178c2de43395a5e127f94b4817 # Parent e11eb6ec180e7b68c657b6ba68f8157e38ec75a0 Add option to include LIR in final assembly as comments diff -r e11eb6ec180e -r 257fd6a46525 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java --- 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 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)); }