Пример #1
0
        public override void Emit(InstructionNode node, OpcodeEncoder opcodeEncoder)
        {
            System.Diagnostics.Debug.Assert(node.ResultCount == 0);
            System.Diagnostics.Debug.Assert(node.OperandCount == 1);

            if (node.Operand1.IsCPURegister)
            {
                opcodeEncoder.SuppressByte(0x40);
                opcodeEncoder.Append4Bits(0b0100);
                opcodeEncoder.Append1Bit(0b0);
                opcodeEncoder.Append1Bit(0b0);
                opcodeEncoder.Append1Bit(0b0);
                opcodeEncoder.Append1Bit((node.Operand1.Register.RegisterCode >> 3) & 0x1);
                opcodeEncoder.Append8Bits(0xFF);
                opcodeEncoder.Append2Bits(0b11);
                opcodeEncoder.Append3Bits(0b100);
                opcodeEncoder.Append3Bits(node.Operand1.Register.RegisterCode);
                return;
            }

            if (node.Operand1.IsConstant)
            {
                opcodeEncoder.Append8Bits(0xE9);
                opcodeEncoder.EmitRelative32(node.Operand1);
                return;
            }

            throw new Compiler.Common.Exceptions.CompilerException("Invalid Opcode");
        }
Пример #2
0
        public override void Emit(InstructionNode node, OpcodeEncoder opcodeEncoder)
        {
            System.Diagnostics.Debug.Assert(node.ResultCount == 0);
            System.Diagnostics.Debug.Assert(node.OperandCount == 0);

            opcodeEncoder.Append8Bits(0xE9);
            opcodeEncoder.EmitRelative32(node.BranchTargets[0].Label);
        }