internal RyuJitCompilation( DependencyAnalyzerBase <NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable <ICompilationRootProvider> roots, ILProvider ilProvider, DebugInformationProvider debugInformationProvider, Logger logger, DevirtualizationManager devirtualizationManager, IInliningPolicy inliningPolicy, InstructionSetSupport instructionSetSupport, ProfileDataManager profileDataManager, MethodImportationErrorProvider errorProvider, RyuJitCompilationOptions options, int parallelism) : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, devirtualizationManager, inliningPolicy, logger) { _compilationOptions = options; _hardwareIntrinsicFlags = new ExternSymbolMappedField(nodeFactory.TypeSystemContext.GetWellKnownType(WellKnownType.Int32), "g_cpuFeatures"); InstructionSetSupport = instructionSetSupport; _instructionSetMap = new Dictionary <string, InstructionSet>(); foreach (var instructionSetInfo in InstructionSetFlags.ArchitectureToValidInstructionSets(TypeSystemContext.Target.Architecture)) { if (instructionSetInfo.ManagedName != "") { _instructionSetMap.Add(instructionSetInfo.ManagedName, instructionSetInfo.InstructionSet); } } _profileDataManager = profileDataManager; _methodImportationErrorProvider = errorProvider; _parallelism = parallelism; }
/// <summary> /// Add a supported instruction set to the specified list. /// </summary> /// <returns>returns "false" if instruction set isn't valid on this architecture</returns> public bool AddSupportedInstructionSet(string instructionSet) { // First, check if it's a "known cpu family" group of instruction sets e.g. "haswell" var sets = InstructionSetFlags.CpuNameToInstructionSets(instructionSet, _architecture); if (sets != null) { foreach (string set in sets) { if (!s_instructionSetSupport[_architecture].ContainsKey(set)) { // Groups can contain other groups if (AddSupportedInstructionSet(set)) { continue; } return(false); } _supportedInstructionSets.Add(set); _unsupportedInstructionSets.Remove(set); } return(true); } if (!s_instructionSetSupport[_architecture].ContainsKey(instructionSet)) { return(false); } _supportedInstructionSets.Add(instructionSet); _unsupportedInstructionSets.Remove(instructionSet); return(true); }
internal RyuJitCompilation( DependencyAnalyzerBase <NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable <ICompilationRootProvider> roots, ILProvider ilProvider, DebugInformationProvider debugInformationProvider, Logger logger, DevirtualizationManager devirtualizationManager, InstructionSetSupport instructionSetSupport, RyuJitCompilationOptions options) : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, devirtualizationManager, logger) { _compilationOptions = options; _hardwareIntrinsicFlags = new ExternSymbolMappedField(nodeFactory.TypeSystemContext.GetWellKnownType(WellKnownType.Int32), "g_cpuFeatures"); InstructionSetSupport = instructionSetSupport; _instructionSetMap = new Dictionary <string, InstructionSet>(); foreach (var instructionSetInfo in InstructionSetFlags.ArchitectureToValidInstructionSets(TypeSystemContext.Target.Architecture)) { if (!instructionSetInfo.Specifiable) { continue; } _instructionSetMap.Add(instructionSetInfo.ManagedName, instructionSetInfo.InstructionSet); } }
public InstructionSetSupport(InstructionSetFlags supportedInstructionSets, InstructionSetFlags unsupportedInstructionSets, InstructionSetFlags optimisticInstructionSets, InstructionSetFlags nonSpecifiableInstructionSets, TargetArchitecture architecture) { _supportedInstructionSets = supportedInstructionSets; _unsupportedInstructionSets = unsupportedInstructionSets; _optimisticInstructionSets = optimisticInstructionSets; _targetArchitecture = architecture; _nonSpecifiableInstructionSets = nonSpecifiableInstructionSets; }
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); }
private static Dictionary <string, InstructionSet> ComputeInstructSetSupportForArch(TargetArchitecture architecture) { var support = new Dictionary <string, InstructionSet>(); foreach (var instructionSet in InstructionSetFlags.ArchitectureToValidInstructionSets(architecture)) { // Only instruction sets with associated R2R enum values are are specifiable if (instructionSet.Specifiable) { support.Add(instructionSet.Name, 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); }
public InstructionSetSupport(InstructionSetFlags supportedInstructionSets, InstructionSetFlags unsupportedInstructionSets, TargetArchitecture architecture) : this(supportedInstructionSets, unsupportedInstructionSets, supportedInstructionSets, default(InstructionSetFlags), architecture) { }