diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-03-09 19:29:34 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 09:29:34 +1100 |
commit | 61d79facd1740264dadb6c62a0af21179bf6672b (patch) | |
tree | 4e5769fb13b3dea1be5b5977c7fdad3a9d8db01f /ARMeilleure/CodeGen/Optimizations/Optimizer.cs | |
parent | e2bb5e8091125ec626fca0f1f7213463b68b54e6 (diff) |
Optimize x64 loads and stores using complex addressing modes (#972)
* Optimize x64 loads and stores using complex addressing modes
* This was meant to be used for testing
Diffstat (limited to 'ARMeilleure/CodeGen/Optimizations/Optimizer.cs')
-rw-r--r-- | ARMeilleure/CodeGen/Optimizations/Optimizer.cs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/ARMeilleure/CodeGen/Optimizations/Optimizer.cs b/ARMeilleure/CodeGen/Optimizations/Optimizer.cs index e3117d1f..d3ffd185 100644 --- a/ARMeilleure/CodeGen/Optimizations/Optimizer.cs +++ b/ARMeilleure/CodeGen/Optimizations/Optimizer.cs @@ -1,8 +1,6 @@ using ARMeilleure.IntermediateRepresentation; using ARMeilleure.Translation; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; namespace ARMeilleure.CodeGen.Optimizations { @@ -60,6 +58,36 @@ namespace ARMeilleure.CodeGen.Optimizations while (modified); } + public static void RemoveUnusedNodes(ControlFlowGraph cfg) + { + bool modified; + + do + { + modified = false; + + for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext) + { + Node node = block.Operations.First; + + while (node != null) + { + Node nextNode = node.ListNext; + + if (IsUnused(node)) + { + RemoveNode(block, node); + + modified = true; + } + + node = nextNode; + } + } + } + while (modified); + } + private static void PropagateCopy(Operation copyOp) { // Propagate copy source operand to all uses of the destination operand. |