public void Dump(IrPrintingPolicy printingPolicy)
        {
            if (!printingPolicy.ColorEnabled)
            {
                Console.Out.Write(printingPolicy.IndentationString + this);
                return;
            }

            Console.Out.Write(printingPolicy.IndentationString);
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Out.Write(Label + ": ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.Out.Write(" " + OutputRegisterString);
            Console.ResetColor();

            if (OutputRegisters.Count() > 0)
            {
                Console.Out.Write(" <- ");
            }

            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.Out.Write(this.OpCodeAndOperandString + " ");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Blue;
            Console.Out.Write(InputRegisterString);
            Console.ResetColor();
        }
        /// <summary>
        ///  Dumps the linear ir representation of a method to stdout.
        /// </summary>
        public void Dump(IrPrintingPolicy printingPolicy)
        {
            var @out = Console.Out;

            @out.WriteLine(printingPolicy.IndentationString + MethodDefinition.FullName);
            @out.WriteLine(printingPolicy.IndentationString + "{");
            printingPolicy.IncrementIndentation();
            foreach (var instruction in this.Instructions)
            {
                instruction.Dump(printingPolicy);
                @out.WriteLine();
            }
            printingPolicy.DecrementIndentation();
            @out.WriteLine(printingPolicy.IndentationString + "}");
        }
Example #3
0
        /// <summary>
        ///   Dumps linear ir for a type definition.
        /// </summary>
        public void Dump(TypeDefinition typeDefinition)
        {
            var @out = Console.Out;

            @out.WriteLine(typeDefinition.FullName);
            @out.WriteLine("{");
            IrPrintingPolicy.IncrementIndentation();
            foreach (var methodDefinition in typeDefinition.Methods.Where(x => x.HasBody))
            {
                Dump(methodDefinition);
                @out.WriteLine();
            }
            IrPrintingPolicy.DecrementIndentation();
            @out.WriteLine("}");
        }
Example #4
0
 /// <summary>
 ///   Construct an object based on a module filename and a printing policy.
 /// </summary>
 public LinearIrDump(String filename, IrPrintingPolicy policy)
     : this(filename)
 {
     IrPrintingPolicy = policy;
 }
Example #5
0
 /// <summary>
 ///   Construct an object based on a module filename.
 /// </summary>
 /// <param name="filename"> The module filename </param>
 public LinearIrDump(String filename)
 {
     moduleDefinition = ModuleDefinition.ReadModule(filename);
     IrPrintingPolicy = new IrPrintingPolicy();
 }