コード例 #1
0
 protected virtual bool CallGenCreateMemory64 => false;          // The methods are deprecated
 protected virtual void GenCreateMemory64(FileWriter writer, CreateMethod method)
 {
     if (CallGenCreateMemory64)
     {
         throw new InvalidOperationException();
     }
 }
コード例 #2
0
        static CreateMethod GetMethod(InstructionGroup group, bool unsigned)
        {
            var(regCount, immCount, memCount) = GetOpKindCount(group);
            int    regId = 1, immId = 1, memId = 1;
            string doc = group.Operands.Length switch {
                0 => "Creates an instruction with no operands",
                1 => "Creates an instruction with 1 operand",
                _ => $"Creates an instruction with {group.Operands.Length} operands",
            };
            var method = new CreateMethod(doc);

            AddCodeArg(method);
            int opNum = -1;

            foreach (var op in group.Operands)
            {
                opNum++;
                switch (op)
                {
                case InstructionOperand.Register:
                    method.Args.Add(new MethodArg($"op{opNum}: Register", MethodArgType.Register, GetArgName("register", regCount, regId++)));
                    break;

                case InstructionOperand.Memory:
                    method.Args.Add(new MethodArg($"op{opNum}: Memory operand", MethodArgType.Memory, GetArgName("memory", memCount, memId++)));
                    break;

                case InstructionOperand.Imm32:
                    method.Args.Add(new MethodArg($"op{opNum}: Immediate value", unsigned ? MethodArgType.UInt32 : MethodArgType.Int32, GetArgName("immediate", immCount, immId++)));
                    break;

                case InstructionOperand.Imm64:
                    method.Args.Add(new MethodArg($"op{opNum}: Immediate value", unsigned ? MethodArgType.UInt64 : MethodArgType.Int64, GetArgName("immediate", immCount, immId++)));
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
            return(method);
コード例 #3
0
 protected abstract void GenCreateFarBranch(FileWriter writer, CreateMethod method);
コード例 #4
0
 protected abstract void GenCreate(FileWriter writer, CreateMethod method, InstructionGroup group);
コード例 #5
0
 void AddRepPrefixArg(CreateMethod method) => method.Args.Add(new MethodArg("Rep prefix or #(e:RepPrefixKind.None)#", MethodArgType.RepPrefixKind, "repPrefix", genTypes[TypeIds.RepPrefixKind][nameof(RepPrefixKind.None)]));
コード例 #6
0
 void AddSegmentPrefixArg(CreateMethod method) => method.Args.Add(new MethodArg("Segment override or #(e:Register.None)#", MethodArgType.Register, "segmentPrefix", genTypes[TypeIds.Register][nameof(Register.None)]));
コード例 #7
0
 static void AddRepPrefixArg(CreateMethod method) => method.Args.Add(new MethodArg("Rep prefix or #(e:RepPrefixKind.None)#", MethodArgType.RepPrefixKind, "repPrefix", RepPrefixKindEnum.Instance[nameof(RepPrefixKind.None)]));
コード例 #8
0
 protected abstract void GenCreateString_ESRDI_Reg(FileWriter writer, CreateMethod method, StringMethodKind kind, string methodBaseName, EnumValue code, EnumValue register);
コード例 #9
0
 static void AddAddressSizeArg(CreateMethod method) => method.Args.Add(new MethodArg("16, 32, or 64", MethodArgType.PreferedInt32, "addressSize"));
コード例 #10
0
 static void AddCodeArg(CreateMethod method) => method.Args.Add(new MethodArg("Code value", MethodArgType.Code, "code"));
コード例 #11
0
 protected abstract void GenCreateDeclareDataArrayLength(FileWriter writer, CreateMethod method, DeclareDataKind kind, ArrayType arrayType);
コード例 #12
0
 protected abstract void GenCreateDeclareData(FileWriter writer, CreateMethod method, DeclareDataKind kind);
コード例 #13
0
 protected abstract void GenCreateMaskmov(FileWriter writer, CreateMethod method, string methodBaseName, EnumValue code);
コード例 #14
0
 protected abstract void GenCreateXbegin(FileWriter writer, CreateMethod method);
コード例 #15
0
 static void AddTargetArg(CreateMethod method) => method.Args.Add(new MethodArg("Target address", MethodArgType.UInt64, "target"));
コード例 #16
0
 protected abstract void GenCreateMemory64(FileWriter writer, CreateMethod method);
コード例 #17
0
 static void AddBitnessArg(CreateMethod method) => method.Args.Add(new MethodArg("16, 32, or 64", MethodArgType.PreferedInt32, "bitness"));
コード例 #18
0
 protected abstract void GenCreateString_SegRSI_ESRDI(FileWriter writer, CreateMethod method, StringMethodKind kind, string methodBaseName, EnumValue code);
コード例 #19
0
 static void AddSegmentPrefixArg(CreateMethod method) => method.Args.Add(new MethodArg("Segment override or #(e:Register.None)#", MethodArgType.Register, "segmentPrefix", RegisterEnum.Instance[nameof(Register.None)]));