Пример #1
0
        public CompilerJmpInstruction(Compiler compiler, InstructionCode code, Operand[] operands)
            : base(compiler, code, operands)
        {
            if (code < InstructionDescription.JumpBegin || code > InstructionDescription.JumpEnd)
                throw new ArgumentException("The specified instruction code is not a valid jump.");
            Contract.Requires(compiler != null);
            Contract.Requires(operands != null);
            Contract.EndContractBlock();

            _jumpTarget = compiler.GetTarget(Operands[0].Id);
            _jumpTarget.JumpsCount++;

            _jumpNext = _jumpTarget.From;
            _jumpTarget.From = this;

            _isTaken =
                Code == InstructionCode.Jmp
                || (Operands.Length > 1 && Operands[1].IsImm && ((Imm)Operands[1]).Value == (IntPtr)Hint.Taken);
        }
Пример #2
0
        public void AddForwardJump(CompilerJmpInstruction instruction)
        {
            ForwardJumpData j = new ForwardJumpData()
            {
                Inst = instruction,
                State = SaveState(),
                Next = _forwardJumps,
            };

            _forwardJumps = j;
        }
Пример #3
0
        public void AddBackwardCode(CompilerJmpInstruction from)
        {
            if (from == null)
                throw new ArgumentNullException("from");
            Contract.EndContractBlock();

            _backCode.Add(from);
        }