public AsmInstructionParser()
        {
            foreach (var insKvp in _insCache)
            {
                var(opCode, insData) = insKvp;

                var insCacheEntry =
                    new InsCacheEntry(insData.AsmName,
                                      insData.ArgumentTypes,
                                      insData.ArgumentRefTypes);

                _insCacheEntries.Add(insCacheEntry, opCode);
            }

            var registers = (Registers[])Enum.GetValues(typeof(Registers));

            foreach (var register in registers)
            {
                _registerLookUp.Add(register.ToString().ToLower(), register);
            }

            var sizeHints =
                (InstructionSizeHint[])Enum.GetValues(typeof(InstructionSizeHint));

            foreach (var sizeHint in sizeHints)
            {
                _sizeHintLookUp.Add(sizeHint.ToString().ToLower(), sizeHint);
            }
        }
Beispiel #2
0
        public bool Equals([AllowNull] InsCacheEntry aOther)
        {
            // Check for null and compare run-time types.
            if (aOther is null || GetType() != aOther.GetType())
            {
                return(false);
            }

            var p = aOther;

            if (ArgTypes.Length != p.ArgTypes.Length ||
                ArgRefTypes.Length != p.ArgRefTypes.Length)
            {
                return(false);
            }

            return
                (InsAsmName == p.InsAsmName &&
                 ArgTypes.SequenceEqual(p.ArgTypes) &&
                 ArgRefTypes.SequenceEqual(p.ArgRefTypes));
        }