Ejemplo n.º 1
0
        private Expression RewriteOperand(MachineOperand op, bool maybe0 = false)
        {
            switch (op)
            {
            case RegisterOperand rOp:
                if (maybe0 && rOp.Register.Number == 0)
                {
                    return(Constant.Zero(rOp.Register.DataType));
                }
                if (arch.IsCcField(rOp.Register))
                {
                    return(binder.EnsureFlagGroup(arch.GetCcFieldAsFlagGroup(rOp.Register)));
                }
                else
                {
                    return(binder.EnsureRegister(rOp.Register));
                }

            case ImmediateOperand iOp:
                // Extend the immediate value to word size. If this is not wanted,
                // convert the operand manually or use RewriteSignedOperand
                return(Constant.Create(arch.WordWidth, iOp.Value.ToUInt64()));

            case AddressOperand aOp:
                return(aOp.Address);

            default:
                throw new NotImplementedException($"RewriteOperand:{op} ({op.GetType()}");
            }
        }
Ejemplo n.º 2
0
        private Expression RewriteOperand(MachineOperand op, bool maybe0 = false)
        {
            switch (op)
            {
            case RegisterOperand rOp:
                if (maybe0 && rOp.Register.Number == 0)
                {
                    return(Constant.Zero(rOp.Register.DataType));
                }
                if (arch.IsCcField(rOp.Register))
                {
                    return(binder.EnsureFlagGroup(arch.GetCcFieldAsFlagGroup(rOp.Register)));
                }
                else
                {
                    return(binder.EnsureRegister(rOp.Register));
                }

            case ImmediateOperand iOp:
                // Sign-extend the bastard.
                return(SignExtend(iOp.Value));

            case AddressOperand aOp:
                return(aOp.Address);

            default:
                throw new NotImplementedException(
                          string.Format("RewriteOperand:{0} ({1}}}", op, op.GetType()));
            }
        }