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

            opcodeEncoder.Append4Bits(GetConditionCode(node.ConditionCode));
            opcodeEncoder.Append4Bits(0b1010);
            opcodeEncoder.EmitRelative24(node.BranchTargets[0].Label);
        }
Пример #2
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.IsConstant)
            {
                opcodeEncoder.Append4Bits(GetConditionCode(node.ConditionCode));
                opcodeEncoder.Append4Bits(0b1011);
                opcodeEncoder.EmitRelative24(node.BranchTargets[0].Label);
                return;
            }

            throw new Compiler.Common.Exceptions.CompilerException("Invalid Opcode");
        }