/// <summary> /// The leaves start out with the maximum register budget /// They take what they want and hand the remainder to their parent /// This proceeds all the way to the root, which gets whatever is left over /// </summary> public static VariableAllocatorResult Run(IEnumerable liveLocalNonParameterVariableNames, int freeRegisterMask, ReadOnlyDictionary priorRepresentations) { var nsToLiveVars=CreateNamespaceToVariablesAllocatedTherein(liveLocalNonParameterVariableNames); int maxDepth; var depthToNamespaces=MakeDepthToNamespaces(liveLocalNonParameterVariableNames, out maxDepth); var leaves=FindLeaves(liveLocalNonParameterVariableNames); var nsToNumRegisters=EstablishRegisterAllocationCounts(depthToNamespaces, freeRegisterMask, leaves.Keys, maxDepth, nsToLiveVars); var va=new VariableAllocatorHelper(freeRegisterMask, nsToLiveVars, nsToNumRegisters); return va.Doit(liveLocalNonParameterVariableNames, priorRepresentations); }
/// <summary> /// The leaves start out with the maximum register budget /// They take what they want and hand the remainder to their parent /// This proceeds all the way to the root, which gets whatever is left over /// </summary> public static VariableAllocatorResult Run(IEnumerable liveLocalNonParameterVariableNames, int freeRegisterMask, ReadOnlyDictionary priorRepresentations) { var nsToLiveVars = CreateNamespaceToVariablesAllocatedTherein(liveLocalNonParameterVariableNames); int maxDepth; var depthToNamespaces = MakeDepthToNamespaces(liveLocalNonParameterVariableNames, out maxDepth); var leaves = FindLeaves(liveLocalNonParameterVariableNames); var nsToNumRegisters = EstablishRegisterAllocationCounts(depthToNamespaces, freeRegisterMask, leaves.Keys, maxDepth, nsToLiveVars); var va = new VariableAllocatorHelper(freeRegisterMask, nsToLiveVars, nsToNumRegisters); return(va.Doit(liveLocalNonParameterVariableNames, priorRepresentations)); }