Example #1
0
        public static AsmSignatureEnum[] Parse_Operand_Type_Enum(string str, bool strIsCapitals)
        {
            Contract.Requires(str != null);

            switch (AsmSourceTools.ToCapitals(str, strIsCapitals).Trim())
            {
                #region Memory
            case "M": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "MEM": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.M8 });

            case "M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.M16 });

            case "M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.M32 });

            case "M32{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.M32, AsmSignatureEnum.K });

            case "M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.M64 });

            case "M64{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.M64, AsmSignatureEnum.K });

            case "M80": return(new AsmSignatureEnum[] { AsmSignatureEnum.M80 });

            case "M128": return(new AsmSignatureEnum[] { AsmSignatureEnum.M128 });

            case "M128{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.M128, AsmSignatureEnum.K });

            case "M256": return(new AsmSignatureEnum[] { AsmSignatureEnum.M256 });

            case "M256{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.M256, AsmSignatureEnum.K });

            case "M512": return(new AsmSignatureEnum[] { AsmSignatureEnum.M512 });

            case "M512{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.M512, AsmSignatureEnum.K });

            case "M16&16": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M16&32": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M16&64": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M32&32": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M16:16": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M16:32": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "M16:64": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

            case "PTR16:16": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM });

            case "PTR16:32": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM });

            case "PTR16:64": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM });

                #endregion

                #region Register
            case "R8": return(new AsmSignatureEnum[] { AsmSignatureEnum.R8 });

            case "R16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16 });

            case "R32": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32 });

            case "R64": return(new AsmSignatureEnum[] { AsmSignatureEnum.R64 });

            case "R16/R32/R64": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16, AsmSignatureEnum.R32, AsmSignatureEnum.R64 });

            case "R32/64": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.R64 });

            case "REG": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32 });

            case "AL": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_AL });

            case "AX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_AX });

            case "EAX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_EAX });

            case "RAX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_RAX });

            case "CL": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_CL });

            case "CX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_CX });

            case "ECX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_ECX });

            case "RCX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_RCX });

            case "DX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_DX });

            case "EDX": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_EDX });

            case "CS": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_CS });

            case "DS": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_DS });

            case "ES": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_ES });

            case "SS": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_SS });

            case "FS": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_FS });

            case "GS": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_GS });

            case "REG_SREG":
            case "SREG": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_SREG });

            case "CR0–CR7": return(new AsmSignatureEnum[] { AsmSignatureEnum.CR0, AsmSignatureEnum.CR1, AsmSignatureEnum.CR2, AsmSignatureEnum.CR3, AsmSignatureEnum.CR4, AsmSignatureEnum.CR5, AsmSignatureEnum.CR6, AsmSignatureEnum.CR7 });

            case "CR8": return(new AsmSignatureEnum[] { AsmSignatureEnum.CR8 });

            case "REG_DREG":
            case "DR0–DR7": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_DREG });

                #endregion

                #region Register or Memory
            case "R/M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.R8, AsmSignatureEnum.M8 });

            case "R/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16, AsmSignatureEnum.M16 });

            case "R/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M32 });

            case "R/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.R64, AsmSignatureEnum.M64 });

            case "R/M32{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M32, AsmSignatureEnum.ER });

            case "R/M64{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.R64, AsmSignatureEnum.M64, AsmSignatureEnum.ER });

            case "REG/M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.R8, AsmSignatureEnum.M8 });

            case "REG/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16, AsmSignatureEnum.M16 });

            case "REG/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M32 });

            case "R16/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16, AsmSignatureEnum.M16 });

            case "R32/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M16 });

            case "R64/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R64, AsmSignatureEnum.M16 });

            case "R32/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M32 });

            case "R64/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.R64, AsmSignatureEnum.M64 });

            case "R32/M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.R32, AsmSignatureEnum.M8 });

            case "R16/R32/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.R16, AsmSignatureEnum.R32, AsmSignatureEnum.M16 });

                #endregion

                #region Constants Immediates
            case "0": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZERO });

            case "1": return(new AsmSignatureEnum[] { AsmSignatureEnum.UNITY });

            case "MOFFS8": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM8 });

            case "MOFFS16": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM16 });

            case "MOFFS32": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM32 });

            case "MOFFS64": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM64 });

            case "REL8": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM8 });

            case "REL16": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM16 });

            case "REL32": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM32 });

            case "REL64": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM64 });

            case "IMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM });

            case "IMM8": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM8 });

            case "IMM16": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM16 });

            case "IMM32": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM32 });

            case "IMM64": return(new AsmSignatureEnum[] { AsmSignatureEnum.IMM64 });

            case "IMM:IMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.imm_imm });

            case "IMM16:IMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.imm16_imm });

            case "IMM:IMM16": return(new AsmSignatureEnum[] { AsmSignatureEnum.imm_imm16 });

            case "IMM32:IMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.imm32_imm });

            case "IMM:IMM32": return(new AsmSignatureEnum[] { AsmSignatureEnum.imm_imm32 });

                #endregion

                #region FPU
            case "ST(I)": return(new AsmSignatureEnum[] { AsmSignatureEnum.FPUREG });

            case "ST(0)": return(new AsmSignatureEnum[] { AsmSignatureEnum.FPU0 });

            case "ST": return(new AsmSignatureEnum[] { AsmSignatureEnum.FPUREG });

            case "M32FP": return(new AsmSignatureEnum[] { AsmSignatureEnum.M32, AsmSignatureEnum.FPUREG });

            case "M64FP": return(new AsmSignatureEnum[] { AsmSignatureEnum.M64, AsmSignatureEnum.FPUREG });

            case "M80FP": return(new AsmSignatureEnum[] { AsmSignatureEnum.M80, AsmSignatureEnum.FPUREG });

            case "M16INT": return(new AsmSignatureEnum[] { AsmSignatureEnum.M16 });

            case "M32INT": return(new AsmSignatureEnum[] { AsmSignatureEnum.M32 });

            case "M64INT": return(new AsmSignatureEnum[] { AsmSignatureEnum.M64 });

            case "M14/28BYTE": return(new AsmSignatureEnum[] { AsmSignatureEnum.M14BYTE, AsmSignatureEnum.M28BYTE });

            case "M94/108BYTE": return(new AsmSignatureEnum[] { AsmSignatureEnum.M94BYTE, AsmSignatureEnum.M108BYTE });

            case "M2BYTE": return(new AsmSignatureEnum[] { AsmSignatureEnum.M2BYTE });

            case "M512BYTE": return(new AsmSignatureEnum[] { AsmSignatureEnum.M512BYTE });

            case "M80BCD": return(new AsmSignatureEnum[] { AsmSignatureEnum.M80 });

            case "M80DEC": return(new AsmSignatureEnum[] { AsmSignatureEnum.M80 });

                #endregion

                #region SIMD
            case "MM": return(new AsmSignatureEnum[] { AsmSignatureEnum.MMXREG });

            case "MM/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.MMXREG, AsmSignatureEnum.M32 });

            case "MM/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.MMXREG, AsmSignatureEnum.M64 });

            case "MM/MEM": return(new AsmSignatureEnum[] { AsmSignatureEnum.MMXREG, AsmSignatureEnum.M64 });

            case "Z": return(new AsmSignatureEnum[] { AsmSignatureEnum.Z });

            case "K": return(new AsmSignatureEnum[] { AsmSignatureEnum.K });

            case "K+1": return(new AsmSignatureEnum[] { AsmSignatureEnum.K });

            case "K{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.K });

            case "SAE": return(new AsmSignatureEnum[] { AsmSignatureEnum.SAE });

            case "ER": return(new AsmSignatureEnum[] { AsmSignatureEnum.ER });

            case "K/M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.K, AsmSignatureEnum.M8 });

            case "K/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.K, AsmSignatureEnum.M16 });

            case "K/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.K, AsmSignatureEnum.M32 });

            case "K/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.K, AsmSignatureEnum.M64 });

            case "VM32X": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32X });

            case "VM64X": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64X });

            case "VM32Y": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32Y });

            case "VM64Y": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64Y });

            case "VM32Z": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32Z });

            case "VM64Z": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64Z });

            case "VM32X{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32X, AsmSignatureEnum.K });

            case "VM64X{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64X, AsmSignatureEnum.K });

            case "VM32Y{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32Y, AsmSignatureEnum.K });

            case "VM64Y{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64Y, AsmSignatureEnum.K });

            case "VM32Z{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM32Z, AsmSignatureEnum.K });

            case "VM64Z{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.VM64Z, AsmSignatureEnum.K });

            case "XMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG });

            case "XMM_ZERO": return(new AsmSignatureEnum[] { AsmSignatureEnum.REG_XMM0 });

            case "XMM{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.K });

            case "XMM{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "XMM/M8": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M8 });

            case "XMM/M16": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M16 });

            case "XMM/M16{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M16 });

            case "XMM/M32": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M32, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "XMM/M32{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M32, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "XMM/M32{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M32, AsmSignatureEnum.ER });

            case "XMM/M32{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M32, AsmSignatureEnum.SAE });

            case "XMM/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M64 });

            case "XMM/M64{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M64, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "XMM/M64{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M64, AsmSignatureEnum.ER });

            case "XMM/M64{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M64, AsmSignatureEnum.SAE });

            case "XMM/M64/M32BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M64, AsmSignatureEnum.M32BCST });

            case "XMM/M128": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M128 });

            case "XMM/M128{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M128, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "XMM/M128/M32BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M128, AsmSignatureEnum.M32BCST });

            case "XMM/M128/M64BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.XMMREG, AsmSignatureEnum.M128, AsmSignatureEnum.M64BCST });

            case "YMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG });

            case "YMM{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.K });

            case "YMM{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "YMM/M256": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256 });

            case "YMM/M256{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.SAE });

            case "YMM/M256{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "YMM/M256/M32BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.M32BCST });

            case "YMM/M256/M32BCST{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.M32BCST, AsmSignatureEnum.ER });

            case "YMM/M256/M32BCST{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.M32BCST, AsmSignatureEnum.SAE });

            case "YMM/M256/M64BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.YMMREG, AsmSignatureEnum.M256, AsmSignatureEnum.M64BCST });

            case "ZMM": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG });

            case "ZMM{K}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.K });

            case "ZMM{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "ZMM{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.SAE });

            case "ZMM/M512": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "ZMM/M512{K}{Z}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.K, AsmSignatureEnum.Z });

            case "ZMM/M512/M32BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M32BCST });

            case "ZMM/M512/M32BCST{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M32BCST, AsmSignatureEnum.ER });

            case "ZMM/M512/M32BCST{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M32BCST, AsmSignatureEnum.SAE });

            case "ZMM/M512/M64BCST": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M64BCST });

            case "ZMM/M512/M64BCST{ER}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M64BCST, AsmSignatureEnum.ER });

            case "ZMM/M512/M64BCST{SAE}": return(new AsmSignatureEnum[] { AsmSignatureEnum.ZMMREG, AsmSignatureEnum.M512, AsmSignatureEnum.M64BCST, AsmSignatureEnum.SAE });

                #endregion

                #region Misc
            case "NEAR": return(new AsmSignatureEnum[] { AsmSignatureEnum.NEAR });

            case "FAR": return(new AsmSignatureEnum[] { AsmSignatureEnum.FAR });

            case "SHORT": return(new AsmSignatureEnum[] { AsmSignatureEnum.SHORT_ENUM });

            case "MEM_OFFS": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM_OFFSET });

            case "BND": return(new AsmSignatureEnum[] { AsmSignatureEnum.BNDREG });

            case "BND/M64": return(new AsmSignatureEnum[] { AsmSignatureEnum.BNDREG, AsmSignatureEnum.M64 });

            case "BND/M128": return(new AsmSignatureEnum[] { AsmSignatureEnum.BNDREG, AsmSignatureEnum.M128 });

            case "MIB": return(new AsmSignatureEnum[] { AsmSignatureEnum.MEM });

                #endregion

            case "NONE": return(new AsmSignatureEnum[] { AsmSignatureEnum.NONE });

            default:
                AsmDudeToolsStatic.Output_INFO("AsmSignatureTools:parseOperandTypeEnum: unknown content " + str);
                return(new AsmSignatureEnum[] { AsmSignatureEnum.UNKNOWN });
            }
        }