Base code emitter.
상속: IDisposable, ICodeEmitter
예제 #1
0
        protected override void Run()
        {
            codeEmitter = MethodCompiler.Pipeline.FindFirst<CodeGenerationStage>().CodeEmitter;

            // Step 1 - Sort the exception clauses into postorder-traversal
            //PER SPEC: The exception clauses table should already be sorted
            //BuildSort();

            // Step 2 - Assign blocks to innermost exception clause
            AssignBlocksToClauses();

            // Step 3 - Emit table of PC ranges and the clause handler
            EmitProtectedBlockTable();
        }
예제 #2
0
        protected override void EmitInstruction(Context context, BaseCodeEmitter codeEmitter)
        {
            long start = codeEmitter.CurrentPosition;

            base.EmitInstruction(context, codeEmitter);

            long end = codeEmitter.CurrentPosition;
            byte opcodeSize = (byte)(end - start);

            var instruction = simAdapter.Convert(context, MethodCompiler.Method, BasicBlocks, opcodeSize);
            instruction.Source = context.ToString(); // context.Instruction.ToString(context);

            simAdapter.SimCPU.AddInstruction((ulong)(sectionAddress + startPosition + start), instruction);

            return;
        }
        protected override void EmitInstruction(InstructionNode node, BaseCodeEmitter codeEmitter)
        {
            long start = codeEmitter.CurrentPosition;

            base.EmitInstruction(node, codeEmitter);

            long end = codeEmitter.CurrentPosition;

            var instruction = simAdapter.Convert(node, MethodCompiler.Method, BasicBlocks, (byte)(end - start));

            if (instruction != null)
            {
                simLinker.AddInstruction(symbol, start, instruction);
            }

            simLinker.AddSourceInformation(symbol, start, node.SlotNumber.ToString() + "\t0x" + node.SlotNumber.ToString("X") + "\t" + node.Block.ToString() + "\t" + symbol + "\t" + node.ToString());
        }
예제 #4
0
 /// <summary>
 /// Emits the specified platform instruction.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="emitter">The emitter.</param>
 public override void Emit(Context context, BaseCodeEmitter emitter)
 {
     Emit(context, emitter as MachineCodeEmitter);
 }
예제 #5
0
 /// <summary>
 /// Emits the specified platform instruction.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="emitter">The emitter.</param>
 public override void Emit(InstructionNode node, BaseCodeEmitter emitter)
 {
     Emit(node, emitter as MachineCodeEmitter);
 }
예제 #6
0
 public OpcodeEncoder(BaseCodeEmitter emitter)
 {
     Emitter      = emitter;
     SuppressFlag = false;
     Reset();
 }