Пример #1
0
 public static Instruction Create(uint regdst, Parsing.ValBase value)
 {
     if (value is Parsing.ValReg)
     {
         var ins = new T
         {
             RegDst = regdst,
             RegSrc = (value as Parsing.ValReg).Index
         };
         return(ins);
     }
     else if (value is Parsing.ValInstant)
     {
         var val = (value as Parsing.ValInstant).Val;
         if (val < -(1 << 15) || val >= 1 << 15)
         {
             return(Failed.OutOfRange);
         }
         var ins = new AsmBinaryOpInstant <T>
         {
             RegDst = regdst,
             Value  = (value as Parsing.ValInstant).Val
         };
         return(ins);
     }
     else
     {
         return(Failed.NotImplemented);
     }
 }
Пример #2
0
        public static new Instruction Create(uint regdst, Parsing.ValBase value)
        {
            var ins = AsmMovCompressed.Create(regdst, value);

            if (ins.Success)
            {
                return(ins);
            }
            return(AsmBinaryOp <AsmMov> .Create(regdst, value));
        }
Пример #3
0
        public static Instruction Create(uint regdst, Parsing.ValBase value)
        {
            if (value is not Parsing.ValInstant)
            {
                return(Failed.InvalidArgument);
            }
            var val = (value as Parsing.ValInstant).Val;

            if (val < -(1 << 6) || val >= 1 << 6)
            {
                return(Failed.OutOfRange);
            }
            return(new AsmMovCompressed
            {
                RegDst = regdst,
                Value = val
            });
        }
Пример #4
0
 public static Instruction Create(uint regdst, Parsing.ValBase value)
 {
     if (value is Parsing.ValReg)
     {
         return(Failed.InvalidArgument);
     }
     else if (value is Parsing.ValInstant)
     {
         var val = (value as Parsing.ValInstant).Val;
         if (val < 0 || val >= 1 << 4)
         {
             return(Failed.OutOfRange);
         }
         var ins = new AsmBinaryOpInstant <T>();
         ins.RegDst = regdst;
         ins.Value  = val;
         return(ins);
     }
     else
     {
         return(Failed.NotImplemented);
     }
 }