aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Instructions/InstEmitMemory.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-05-13 16:26:57 -0300
committerGitHub <noreply@github.com>2021-05-13 21:26:57 +0200
commite318022b89dfd2e7a5db6722eb7663fa9f9bca3c (patch)
treee69facae71bbeda44224a1b4e5c3662022bc4137 /ARMeilleure/Instructions/InstEmitMemory.cs
parent57ea3f93a31d67d9f72ef5066aa19fe18f8f9f76 (diff)
Fold constant offsets and group constant addresses (#2285)
* Fold constant offsets and group constant addresses * PPTC version bump
Diffstat (limited to 'ARMeilleure/Instructions/InstEmitMemory.cs')
-rw-r--r--ARMeilleure/Instructions/InstEmitMemory.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/ARMeilleure/Instructions/InstEmitMemory.cs b/ARMeilleure/Instructions/InstEmitMemory.cs
index 1d5953fb..87564fdc 100644
--- a/ARMeilleure/Instructions/InstEmitMemory.cs
+++ b/ARMeilleure/Instructions/InstEmitMemory.cs
@@ -87,8 +87,7 @@ namespace ARMeilleure.Instructions
}
Operand address = GetAddress(context);
-
- Operand address2 = context.Add(address, Const(1L << op.Size));
+ Operand address2 = GetAddress(context, 1L << op.Size);
EmitLoad(op.Rt, address);
EmitLoad(op.Rt2, address2);
@@ -112,8 +111,7 @@ namespace ARMeilleure.Instructions
OpCodeMemPair op = (OpCodeMemPair)context.CurrOp;
Operand address = GetAddress(context);
-
- Operand address2 = context.Add(address, Const(1L << op.Size));
+ Operand address2 = GetAddress(context, 1L << op.Size);
InstEmitMemoryHelper.EmitStore(context, address, op.Rt, op.Size);
InstEmitMemoryHelper.EmitStore(context, address2, op.Rt2, op.Size);
@@ -121,7 +119,7 @@ namespace ARMeilleure.Instructions
EmitWBackIfNeeded(context, address);
}
- private static Operand GetAddress(ArmEmitterContext context)
+ private static Operand GetAddress(ArmEmitterContext context, long addend = 0)
{
Operand address = null;
@@ -134,7 +132,11 @@ namespace ARMeilleure.Instructions
// Pre-indexing.
if (!op.PostIdx)
{
- address = context.Add(address, Const(op.Immediate));
+ address = context.Add(address, Const(op.Immediate + addend));
+ }
+ else if (addend != 0)
+ {
+ address = context.Add(address, Const(addend));
}
break;
@@ -153,6 +155,11 @@ namespace ARMeilleure.Instructions
address = context.Add(n, m);
+ if (addend != 0)
+ {
+ address = context.Add(address, Const(addend));
+ }
+
break;
}
}