From f2b12c974928560fb321667842c4aa060d92efb3 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 30 Sep 2020 16:16:34 -0300 Subject: [PATCH] Remove old, unused CPU optimization (#1586) --- ARMeilleure/Optimizations.cs | 2 -- ARMeilleure/Translation/RegisterUsage.cs | 42 +++--------------------- ARMeilleure/Translation/Translator.cs | 2 +- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/ARMeilleure/Optimizations.cs b/ARMeilleure/Optimizations.cs index fa06a410..fbbbfdb2 100644 --- a/ARMeilleure/Optimizations.cs +++ b/ARMeilleure/Optimizations.cs @@ -4,8 +4,6 @@ namespace ARMeilleure { public static class Optimizations { - public static bool AssumeStrictAbiCompliance { get; set; } = true; - public static bool FastFP { get; set; } = true; public static bool UseSseIfAvailable { get; set; } = true; diff --git a/ARMeilleure/Translation/RegisterUsage.cs b/ARMeilleure/Translation/RegisterUsage.cs index 6a21ae2a..1a97515f 100644 --- a/ARMeilleure/Translation/RegisterUsage.cs +++ b/ARMeilleure/Translation/RegisterUsage.cs @@ -9,12 +9,6 @@ namespace ARMeilleure.Translation { static class RegisterUsage { - private const long CallerSavedIntRegistersMask = 0x7fL << 9; - private const long PStateNzcvFlagsMask = 0xfL << 60; - private const long FpStateNzcvFlagsMask = 0xfL << 60; - - private const long CallerSavedVecRegistersMask = 0xffffL << 16; - private const int RegsCount = 32; private const int RegsMask = RegsCount - 1; @@ -70,7 +64,7 @@ namespace ARMeilleure.Translation } } - public static void RunPass(ControlFlowGraph cfg, ExecutionMode mode, bool isCompleteFunction) + public static void RunPass(ControlFlowGraph cfg, ExecutionMode mode) { // Compute local register inputs and outputs used inside blocks. RegisterMask[] localInputs = new RegisterMask[cfg.Blocks.Count]; @@ -215,8 +209,8 @@ namespace ARMeilleure.Translation if (EndsWithReturn(block) || hasContextStore) { - StoreLocals(block, globalOutputs[block.Index].IntMask, RegisterType.Integer, mode, isCompleteFunction); - StoreLocals(block, globalOutputs[block.Index].VecMask, RegisterType.Vector, mode, isCompleteFunction); + StoreLocals(block, globalOutputs[block.Index].IntMask, RegisterType.Integer, mode); + StoreLocals(block, globalOutputs[block.Index].VecMask, RegisterType.Vector, mode); } } } @@ -309,20 +303,8 @@ namespace ARMeilleure.Translation block.Operations.AddFirst(loadArg0); } - private static void StoreLocals(BasicBlock block, long outputs, RegisterType baseType, ExecutionMode mode, bool isCompleteFunction) + private static void StoreLocals(BasicBlock block, long outputs, RegisterType baseType, ExecutionMode mode) { - if (Optimizations.AssumeStrictAbiCompliance && isCompleteFunction) - { - if (baseType == RegisterType.Integer || baseType == RegisterType.Flag) - { - outputs = ClearCallerSavedIntRegs(outputs); - } - else /* if (baseType == RegisterType.Vector || baseType == RegisterType.FpFlag) */ - { - outputs = ClearCallerSavedVecRegs(outputs); - } - } - Operand arg0 = Local(OperandType.I64); Operation loadArg0 = Operation(Instruction.LoadArgument, arg0, Const(0)); @@ -396,21 +378,5 @@ namespace ARMeilleure.Translation return operation.Instruction == Instruction.Return; } - - private static long ClearCallerSavedIntRegs(long mask) - { - // TODO: ARM32 support. - mask &= ~(CallerSavedIntRegistersMask | PStateNzcvFlagsMask); - - return mask; - } - - private static long ClearCallerSavedVecRegs(long mask) - { - // TODO: ARM32 support. - mask &= ~(CallerSavedVecRegistersMask | FpStateNzcvFlagsMask); - - return mask; - } } } \ No newline at end of file diff --git a/ARMeilleure/Translation/Translator.cs b/ARMeilleure/Translation/Translator.cs index 2bd00569..0c9d6842 100644 --- a/ARMeilleure/Translation/Translator.cs +++ b/ARMeilleure/Translation/Translator.cs @@ -202,7 +202,7 @@ namespace ARMeilleure.Translation Logger.StartPass(PassName.RegisterUsage); - RegisterUsage.RunPass(cfg, mode, isCompleteFunction: false); + RegisterUsage.RunPass(cfg, mode); Logger.EndPass(PassName.RegisterUsage);