private static InstructionSetFlags ComputeNonSpecifiableInstructionSetSupportForArch(TargetArchitecture architecture) { var support = new InstructionSetFlags(); foreach (var instructionSet in InstructionSetFlags.ArchitectureToValidInstructionSets(architecture)) { // Only instruction sets with associated R2R enum values are are specifiable if (!instructionSet.Specifiable) { support.AddInstructionSet(instructionSet.InstructionSet); } } return(support); }
/// <summary> /// Seal modifications to instruction set support /// </summary> /// <returns>returns "false" if instruction set isn't valid on this architecture</returns> public bool ComputeInstructionSetFlags(out InstructionSetFlags supportedInstructionSets, out InstructionSetFlags unsupportedInstructionSets, Action <string, string> invalidInstructionSetImplication) { supportedInstructionSets = new InstructionSetFlags(); unsupportedInstructionSets = new InstructionSetFlags(); Dictionary <string, InstructionSet> instructionSetConversion = s_instructionSetSupport[_architecture]; foreach (string unsupported in _unsupportedInstructionSets) { unsupportedInstructionSets.AddInstructionSet(instructionSetConversion[unsupported]); } unsupportedInstructionSets.ExpandInstructionSetByReverseImplication(_architecture); unsupportedInstructionSets.Set64BitInstructionSetVariants(_architecture); if ((_architecture == TargetArchitecture.X86) || (_architecture == TargetArchitecture.ARM)) { unsupportedInstructionSets.Set64BitInstructionSetVariantsUnconditionally(_architecture); } foreach (string supported in _supportedInstructionSets) { supportedInstructionSets.AddInstructionSet(instructionSetConversion[supported]); supportedInstructionSets.ExpandInstructionSetByImplication(_architecture); foreach (string unsupported in _unsupportedInstructionSets) { InstructionSetFlags checkForExplicitUnsupport = new InstructionSetFlags(); checkForExplicitUnsupport.AddInstructionSet(instructionSetConversion[unsupported]); checkForExplicitUnsupport.ExpandInstructionSetByReverseImplication(_architecture); checkForExplicitUnsupport.Set64BitInstructionSetVariants(_architecture); InstructionSetFlags supportedTemp = supportedInstructionSets; supportedTemp.Remove(checkForExplicitUnsupport); // If removing the explicitly unsupported instruction sets, changes the set of // supported instruction sets, then the parameter is invalid if (!supportedTemp.Equals(supportedInstructionSets)) { invalidInstructionSetImplication(supported, unsupported); return(false); } } } return(true); }