aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Translation/RegisterToLocal.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Translation/RegisterToLocal.cs')
-rw-r--r--ARMeilleure/Translation/RegisterToLocal.cs52
1 files changed, 0 insertions, 52 deletions
diff --git a/ARMeilleure/Translation/RegisterToLocal.cs b/ARMeilleure/Translation/RegisterToLocal.cs
deleted file mode 100644
index abb9b373..00000000
--- a/ARMeilleure/Translation/RegisterToLocal.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using ARMeilleure.IntermediateRepresentation;
-using System.Collections.Generic;
-
-using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
-
-namespace ARMeilleure.Translation
-{
- static class RegisterToLocal
- {
- public static void Rename(ControlFlowGraph cfg)
- {
- Dictionary<Register, Operand> registerToLocalMap = new Dictionary<Register, Operand>();
-
- Operand GetLocal(Operand op)
- {
- Register register = op.GetRegister();
-
- if (!registerToLocalMap.TryGetValue(register, out Operand local))
- {
- local = Local(op.Type);
-
- registerToLocalMap.Add(register, local);
- }
-
- return local;
- }
-
- for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
- {
- for (Operation node = block.Operations.First; node != default; node = node.ListNext)
- {
- Operand dest = node.Destination;
-
- if (dest != default && dest.Kind == OperandKind.Register)
- {
- node.Destination = GetLocal(dest);
- }
-
- for (int index = 0; index < node.SourcesCount; index++)
- {
- Operand source = node.GetSource(index);
-
- if (source.Kind == OperandKind.Register)
- {
- node.SetSource(index, GetLocal(source));
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file