aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Instruction/AInstEmitMemoryHelper.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-10-30 19:43:02 -0600
committergdkchan <gab.dark.100@gmail.com>2018-10-30 22:43:02 -0300
commit9cb57fb4bb3bbae0ae052a5af4a96a49fc5d864d (patch)
tree0c97425aeb311c142bc92a6fcc503cb2c07d4376 /ChocolArm64/Instruction/AInstEmitMemoryHelper.cs
parent5a87e58183578f5b84ca8d01cbb76aed11820f78 (diff)
Adjust naming conventions for Ryujinx and ChocolArm64 projects (#484)
* Change naming convention for Ryujinx project * Change naming convention for ChocolArm64 project * Fix NaN * Remove unneeded this. from Ryujinx project * Adjust naming from new PRs * Name changes based on feedback * How did this get removed? * Rebasing fix * Change FP enum case * Remove prefix from ChocolArm64 classes - Part 1 * Remove prefix from ChocolArm64 classes - Part 2 * Fix alignment from last commit's renaming * Rename namespaces * Rename stragglers * Fix alignment * Rename OpCode class * Missed a few * Adjust alignment
Diffstat (limited to 'ChocolArm64/Instruction/AInstEmitMemoryHelper.cs')
-rw-r--r--ChocolArm64/Instruction/AInstEmitMemoryHelper.cs138
1 files changed, 0 insertions, 138 deletions
diff --git a/ChocolArm64/Instruction/AInstEmitMemoryHelper.cs b/ChocolArm64/Instruction/AInstEmitMemoryHelper.cs
deleted file mode 100644
index b10551fe..00000000
--- a/ChocolArm64/Instruction/AInstEmitMemoryHelper.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using ChocolArm64.Decoder;
-using ChocolArm64.Memory;
-using ChocolArm64.Translation;
-using System;
-using System.Reflection.Emit;
-
-namespace ChocolArm64.Instruction
-{
- static class AInstEmitMemoryHelper
- {
- private enum Extension
- {
- Zx,
- Sx32,
- Sx64
- }
-
- public static void EmitReadZxCall(AILEmitterCtx Context, int Size)
- {
- EmitReadCall(Context, Extension.Zx, Size);
- }
-
- public static void EmitReadSx32Call(AILEmitterCtx Context, int Size)
- {
- EmitReadCall(Context, Extension.Sx32, Size);
- }
-
- public static void EmitReadSx64Call(AILEmitterCtx Context, int Size)
- {
- EmitReadCall(Context, Extension.Sx64, Size);
- }
-
- private static void EmitReadCall(AILEmitterCtx Context, Extension Ext, int Size)
- {
- bool IsSimd = GetIsSimd(Context);
-
- string Name = null;
-
- if (Size < 0 || Size > (IsSimd ? 4 : 3))
- {
- throw new ArgumentOutOfRangeException(nameof(Size));
- }
-
- if (IsSimd)
- {
- switch (Size)
- {
- case 0: Name = nameof(AMemory.ReadVector8); break;
- case 1: Name = nameof(AMemory.ReadVector16); break;
- case 2: Name = nameof(AMemory.ReadVector32); break;
- case 3: Name = nameof(AMemory.ReadVector64); break;
- case 4: Name = nameof(AMemory.ReadVector128); break;
- }
- }
- else
- {
- switch (Size)
- {
- case 0: Name = nameof(AMemory.ReadByte); break;
- case 1: Name = nameof(AMemory.ReadUInt16); break;
- case 2: Name = nameof(AMemory.ReadUInt32); break;
- case 3: Name = nameof(AMemory.ReadUInt64); break;
- }
- }
-
- Context.EmitCall(typeof(AMemory), Name);
-
- if (!IsSimd)
- {
- if (Ext == Extension.Sx32 ||
- Ext == Extension.Sx64)
- {
- switch (Size)
- {
- case 0: Context.Emit(OpCodes.Conv_I1); break;
- case 1: Context.Emit(OpCodes.Conv_I2); break;
- case 2: Context.Emit(OpCodes.Conv_I4); break;
- }
- }
-
- if (Size < 3)
- {
- Context.Emit(Ext == Extension.Sx64
- ? OpCodes.Conv_I8
- : OpCodes.Conv_U8);
- }
- }
- }
-
- public static void EmitWriteCall(AILEmitterCtx Context, int Size)
- {
- bool IsSimd = GetIsSimd(Context);
-
- string Name = null;
-
- if (Size < 0 || Size > (IsSimd ? 4 : 3))
- {
- throw new ArgumentOutOfRangeException(nameof(Size));
- }
-
- if (Size < 3 && !IsSimd)
- {
- Context.Emit(OpCodes.Conv_I4);
- }
-
- if (IsSimd)
- {
- switch (Size)
- {
- case 0: Name = nameof(AMemory.WriteVector8); break;
- case 1: Name = nameof(AMemory.WriteVector16); break;
- case 2: Name = nameof(AMemory.WriteVector32); break;
- case 3: Name = nameof(AMemory.WriteVector64); break;
- case 4: Name = nameof(AMemory.WriteVector128); break;
- }
- }
- else
- {
- switch (Size)
- {
- case 0: Name = nameof(AMemory.WriteByte); break;
- case 1: Name = nameof(AMemory.WriteUInt16); break;
- case 2: Name = nameof(AMemory.WriteUInt32); break;
- case 3: Name = nameof(AMemory.WriteUInt64); break;
- }
- }
-
- Context.EmitCall(typeof(AMemory), Name);
- }
-
- private static bool GetIsSimd(AILEmitterCtx Context)
- {
- return Context.CurrOp is IAOpCodeSimd &&
- !(Context.CurrOp is AOpCodeSimdMemMs ||
- Context.CurrOp is AOpCodeSimdMemSs);
- }
- }
-} \ No newline at end of file