Exemple #1
0
        private Type GetVecType(AOpCode OpCode, AIoType IoType)
        {
            if (!(OpCode is IAOpCodeSimd Op))
            {
                return(typeof(AVec));
            }

            int Size = Op.Size;

            if (Op.Emitter == AInstEmit.Fmov_Ftoi ||
                Op.Emitter == AInstEmit.Fmov_Itof)
            {
                Size |= 2;
            }

            if ((Op is AOpCodeMem || Op is IAOpCodeLit) &&
                !(Op is AOpCodeSimdMemMs || Op is AOpCodeSimdMemSs))
            {
                return(Size < 4 ? typeof(ulong) : typeof(AVec));
            }
            else if (IoType == AIoType.VectorI)
            {
                return(GetIntType(Size));
            }
            else if (IoType == AIoType.VectorF)
            {
                return(GetFloatType(Size));
            }

            return(typeof(AVec));
        }
Exemple #2
0
 private Type GetOutOperType(AIoType IoType)
 {
     //This instruction is used to convert between floating point
     //types, so the input and output types are different.
     if (CurrOp.Emitter == AInstEmit.Fcvt_S)
     {
         return(GetFloatType(((AOpCodeSimd)CurrOp).Opc));
     }
     else
     {
         return(GetOperType(IoType));
     }
 }
Exemple #3
0
        private Type GetOperType(AIoType IoType)
        {
            switch (IoType & AIoType.Mask)
            {
            case AIoType.Flag:   return(typeof(bool));

            case AIoType.Int:    return(GetIntType(CurrOp));

            case AIoType.Vector: return(GetVecType(CurrOp, IoType));
            }

            throw new ArgumentException(nameof(IoType));
        }
Exemple #4
0
 private void Stloc(int Index, AIoType IoType)
 {
     ILBlock.Add(new AILOpCodeStore(Index, IoType, CurrOp.RegisterSize));
 }
Exemple #5
0
 private void Ldloc(int Index, AIoType IoType, ARegisterSize RegisterSize)
 {
     ILBlock.Add(new AILOpCodeLoad(Index, IoType, RegisterSize));
 }
Exemple #6
0
 public AILOpCodeLoad(int Index, AIoType IoType, ARegisterSize RegisterSize)
 {
     this.IoType       = IoType;
     this.Index        = Index;
     this.RegisterSize = RegisterSize;
 }
Exemple #7
0
 public AILOpCodeLoad(int Index, AIoType IoType) : this(Index, IoType, ARegisterSize.Int64)
 {
 }
Exemple #8
0
 public AILOpCodeStore(int Index, AIoType IoType, ARegisterSize RegisterSize = ARegisterSize.Int64)
 {
     this.IoType       = IoType;
     this.Index        = Index;
     this.RegisterSize = RegisterSize;
 }
Exemple #9
0
 private void Stloc(int Index, AIoType IoType)
 {
     ILBlock.Add(new AILOpCodeStore(Index, IoType, GetOutOperType(IoType)));
 }
Exemple #10
0
 private void Ldloc(int Index, AIoType IoType, Type Type)
 {
     ILBlock.Add(new AILOpCodeLoad(Index, IoType, Type));
 }
Exemple #11
0
 public AILOpCodeLoad(int Index, AIoType IoType, Type OperType)
 {
     this.IoType   = IoType;
     this.Index    = Index;
     this.OperType = OperType;
 }
Exemple #12
0
 public AILOpCodeLoad(int Index, AIoType IoType) : this(Index, IoType, null)
 {
 }
Exemple #13
0
 public AILOpCodeStore(int Index, AIoType IoType) : this(Index, IoType, null)
 {
 }