diff --git a/DMCompiler/Optimizer/PeepholeOptimizer.cs b/DMCompiler/Optimizer/PeepholeOptimizer.cs index c0239e565e..aad7cd7287 100644 --- a/DMCompiler/Optimizer/PeepholeOptimizer.cs +++ b/DMCompiler/Optimizer/PeepholeOptimizer.cs @@ -48,22 +48,22 @@ private class OptimizationTreeEntry { /// /// The optimization passes in the order that they run /// - private static readonly OptPass[] _passes; + private static readonly OptPass[] Passes; /// /// Trees matching chains of opcodes to peephole optimizations /// - private static readonly Dictionary[] _optimizationTrees; + private static readonly Dictionary[] OptimizationTrees; static PeepholeOptimizer() { - _passes = (OptPass[])Enum.GetValues(typeof(OptPass)); - _optimizationTrees = new Dictionary[_passes.Length]; - for (int i = 0; i < _optimizationTrees.Length; i++) { - _optimizationTrees[i] = new Dictionary(); + Passes = (OptPass[])Enum.GetValues(typeof(OptPass)); + OptimizationTrees = new Dictionary[Passes.Length]; + for (int i = 0; i < OptimizationTrees.Length; i++) { + OptimizationTrees[i] = new Dictionary(); } } - /// Setup for each + /// Setup for each private static void GetOptimizations(DMCompiler compiler) { var possibleTypes = typeof(IOptimization).Assembly.GetTypes(); var optimizationTypes = new List(possibleTypes.Length); @@ -83,12 +83,12 @@ private static void GetOptimizations(DMCompiler compiler) { continue; } - if (!_optimizationTrees[(byte)opt.OptimizationPass].TryGetValue(opcodes[0], out var treeEntry)) { + if (!OptimizationTrees[(byte)opt.OptimizationPass].TryGetValue(opcodes[0], out var treeEntry)) { treeEntry = new() { Children = new() }; - _optimizationTrees[(byte)opt.OptimizationPass].Add(opcodes[0], treeEntry); + OptimizationTrees[(byte)opt.OptimizationPass].Add(opcodes[0], treeEntry); } for (int i = 1; i < opcodes.Length; i++) { @@ -109,7 +109,7 @@ private static void GetOptimizations(DMCompiler compiler) { public static void RunPeephole(DMCompiler compiler, List input) { GetOptimizations(compiler); - foreach (var optPass in _passes) { + foreach (var optPass in Passes) { RunPass(compiler, (byte)optPass, input); } } @@ -149,7 +149,7 @@ int AttemptCurrentOpt(int i) { if (currentOpt == null) { optSize = 1; - _optimizationTrees[pass].TryGetValue(opcode, out currentOpt); + OptimizationTrees[pass].TryGetValue(opcode, out currentOpt); continue; }