diff --git a/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs b/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs index 6429d9892f..64e834b70e 100644 --- a/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs +++ b/Source/Mosa.Compiler.Framework/BaseCodeEmitter.cs @@ -181,12 +181,12 @@ public void Write(byte[] buffer, int offset, int count) /// Emits the specified opcode. /// /// The opcode. - public void Emit(OpcodeEncoder opcode) + public void Emit(BaseOpcodeEncoder opcode) { opcode.WriteTo(codeStream); } - public void Emit(OpcodeEncoder opcode, Operand symbolOperand, int patchOffset, int referenceOffset = 0) + public void Emit(BaseOpcodeEncoder opcode, Operand symbolOperand, int patchOffset, int referenceOffset = 0) { int pos = (int)codeStream.Position + patchOffset; diff --git a/Source/Mosa.Compiler.Framework/BaseCompiler.cs b/Source/Mosa.Compiler.Framework/BaseCompiler.cs index 8a99ff19fa..83c36881d2 100644 --- a/Source/Mosa.Compiler.Framework/BaseCompiler.cs +++ b/Source/Mosa.Compiler.Framework/BaseCompiler.cs @@ -108,6 +108,7 @@ public void Initialize(MosaCompiler compiler) Compiler = compiler; Architecture = Compiler.CompilerOptions.Architecture; + TypeSystem = Compiler.TypeSystem; TypeLayout = Compiler.TypeLayout; CompilerTrace = Compiler.CompilerTrace; diff --git a/Source/Mosa.Compiler.Framework/DelegatePatcher.cs b/Source/Mosa.Compiler.Framework/DelegatePatcher.cs index 610daef205..9252bb3f29 100644 --- a/Source/Mosa.Compiler.Framework/DelegatePatcher.cs +++ b/Source/Mosa.Compiler.Framework/DelegatePatcher.cs @@ -53,9 +53,9 @@ private static void PatchConstructor(BaseMethodCompiler methodCompiler) Operand v2 = methodCompiler.CreateVirtualRegister(methodPointerOperand.Type); Operand v3 = methodCompiler.CreateVirtualRegister(instanceOperand.Type); - context.AppendInstruction(IRInstruction.LoadInteger, v1, methodCompiler.StackFrame, thisOperand); - context.AppendInstruction(IRInstruction.LoadInteger, v2, methodCompiler.StackFrame, methodPointerOperand); - context.AppendInstruction(IRInstruction.LoadInteger, v3, methodCompiler.StackFrame, instanceOperand); + context.AppendInstruction(IRInstruction.LoadParameterInteger, v1, thisOperand); + context.AppendInstruction(IRInstruction.LoadParameterInteger, v2, methodPointerOperand); + context.AppendInstruction(IRInstruction.LoadParameterInteger, v3, instanceOperand); context.AppendInstruction(IRInstruction.StoreInteger, size, null, v1, methodPointerOffsetOperand, v2); context.MosaType = methodPointerOperand.Type; @@ -88,13 +88,23 @@ private static void PatchInvoke(BaseMethodCompiler methodCompiler) for (int i = 0; i < methodCompiler.Parameters.Length; i++) { - vrs[i] = methodCompiler.VirtualRegisters.Allocate(methodCompiler.Parameters[i].Type); - - //fixme: handle structs - var loadInstruction = BaseMethodCompilerStage.GetLoadInstruction(vrs[i].Type); - var moveSize = BaseMethodCompilerStage.GetInstructionSize(vrs[i].Type); - - b0.AppendInstruction(loadInstruction, moveSize, vrs[i], methodCompiler.StackFrame, methodCompiler.Parameters[i]); + var type = methodCompiler.Parameters[i].Type; + + if (methodCompiler.StoreOnStack(type)) + { + b0.AppendInstruction(IRInstruction.LoadParameterCompound, vrs[i], methodCompiler.Parameters[i]); + b0.MosaType = type; + } + else + { + vrs[i] = methodCompiler.VirtualRegisters.Allocate(methodCompiler.Parameters[i].Type); + + var loadInstruction = BaseMethodCompilerStage.GetLoadParameterInstruction(vrs[i].Type); + var loadsize = BaseMethodCompilerStage.GetInstructionSize(vrs[i].Type); + + b0.AppendInstruction(loadInstruction, loadsize, vrs[i], methodCompiler.Parameters[i]); + b0.MosaType = type; + } } Operand thisOperand = vrs[0]; diff --git a/Source/Mosa.Compiler.Framework/Mosa.Compiler.Framework.csproj b/Source/Mosa.Compiler.Framework/Mosa.Compiler.Framework.csproj index 8a0d7b4d7c..5c5bd4f70f 100644 --- a/Source/Mosa.Compiler.Framework/Mosa.Compiler.Framework.csproj +++ b/Source/Mosa.Compiler.Framework/Mosa.Compiler.Framework.csproj @@ -164,7 +164,8 @@ - + + diff --git a/Source/Mosa.Compiler.Framework/Platform/BaseOpcodeEncoder.cs b/Source/Mosa.Compiler.Framework/Platform/BaseOpcodeEncoder.cs new file mode 100644 index 0000000000..5624bdb4b2 --- /dev/null +++ b/Source/Mosa.Compiler.Framework/Platform/BaseOpcodeEncoder.cs @@ -0,0 +1,11 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using System.IO; + +namespace Mosa.Compiler.Framework.Platform +{ + public abstract class BaseOpcodeEncoder + { + public abstract void WriteTo(Stream writer); + } +} diff --git a/Source/Mosa.Compiler.Framework/Platform/OpcodeEncoder.cs b/Source/Mosa.Compiler.Framework/Platform/XOpcodeEncoder.cs similarity index 97% rename from Source/Mosa.Compiler.Framework/Platform/OpcodeEncoder.cs rename to Source/Mosa.Compiler.Framework/Platform/XOpcodeEncoder.cs index b005fbf7d5..dbb7d5af29 100644 --- a/Source/Mosa.Compiler.Framework/Platform/OpcodeEncoder.cs +++ b/Source/Mosa.Compiler.Framework/Platform/XOpcodeEncoder.cs @@ -5,7 +5,7 @@ namespace Mosa.Compiler.Framework.Platform { - public sealed class OpcodeEncoder + public sealed class OpcodeEncoder : BaseOpcodeEncoder { private ulong data1 = 0; private ulong data2 = 0; @@ -27,7 +27,7 @@ public byte GetByte(int index) } } - public void WriteTo(Stream writer) + public override void WriteTo(Stream writer) { Debug.Assert(Size % 8 == 0); diff --git a/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs b/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs index 87a76f9a03..7f65756bde 100644 --- a/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/CILTransformationStage.cs @@ -1796,8 +1796,6 @@ private void Unbox(Context context) context.Result = tmp; context.ResultCount = 1; - var size = GetInstructionSize(type); - if (StoreOnStack(type)) { context.AppendInstruction(IRInstruction.LoadCompound, result, tmp, ConstantZero); @@ -1806,6 +1804,8 @@ private void Unbox(Context context) else { var loadInstruction = GetLoadInstruction(type); + var size = GetInstructionSize(type); + context.AppendInstruction(loadInstruction, size, result, tmp, ConstantZero); context.MosaType = type; } diff --git a/Source/Mosa.Platform.ARMv6/ARMv6.cs b/Source/Mosa.Platform.ARMv6/ARMv6.cs index 365dc60ea5..0e8658be49 100644 --- a/Source/Mosa.Platform.ARMv6/ARMv6.cs +++ b/Source/Mosa.Platform.ARMv6/ARMv6.cs @@ -4,319 +4,69 @@ namespace Mosa.Platform.ARMv6 { - /// - /// - /// public static class ARMv6 { - /// - /// B instruction - /// - public static readonly B B = new B(); - - /// - /// Bl instruction - /// - public static readonly Bl Bl = new Bl(); - - /// - /// Blx instruction - /// - public static readonly Blx Blx = new Blx(); - - /// - /// Bx instruction - /// - public static readonly Bx Bx = new Bx(); - - /// - /// Adc instruction - /// public static readonly Adc Adc = new Adc(); - - /// - /// Add instruction - /// public static readonly Add Add = new Add(); - - /// - /// Adr instruction - /// public static readonly Adr Adr = new Adr(); - - /// - /// And instruction - /// public static readonly And And = new And(); - - /// - /// Bic instruction - /// + public static readonly Asr Asr = new Asr(); + public static readonly B B = new B(); public static readonly Bic Bic = new Bic(); - - /// - /// Cmn instruction - /// + public static readonly Bkpt Bkpt = new Bkpt(); + public static readonly Bl Bl = new Bl(); + public static readonly Blx Blx = new Blx(); + public static readonly Bx Bx = new Bx(); public static readonly Cmn Cmn = new Cmn(); - - /// - /// Cmp instruction - /// public static readonly Cmp Cmp = new Cmp(); - - /// - /// Eor instruction - /// + public static readonly Dmb Dmb = new Dmb(); + public static readonly Dsb Dsb = new Dsb(); public static readonly Eor Eor = new Eor(); - - /// - /// Mov instruction - /// + public static readonly Isb Isb = new Isb(); + public static readonly Ldm Ldm = new Ldm(); + public static readonly Ldmfd Ldmfd = new Ldmfd(); + public static readonly Ldmia Ldmia = new Ldmia(); + public static readonly Ldr Ldr = new Ldr(); + public static readonly Ldrb Ldrb = new Ldrb(); + public static readonly Ldrh Ldrh = new Ldrh(); + public static readonly Ldrsb Ldrsb = new Ldrsb(); + public static readonly Ldrsh Ldrsh = new Ldrsh(); + public static readonly Lsl Lsl = new Lsl(); + public static readonly Lsr Lsr = new Lsr(); public static readonly Mov Mov = new Mov(); - - /// - /// Mvn instruction - /// + public static readonly Mrs Mrs = new Mrs(); + public static readonly Msr Msr = new Msr(); + public static readonly Mul Mul = new Mul(); public static readonly Mvn Mvn = new Mvn(); - - /// - /// Orr instruction - /// + public static readonly Nop Nop = new Nop(); public static readonly Orr Orr = new Orr(); - - /// - /// Rsb instruction - /// + public static readonly Pop Pop = new Pop(); + public static readonly Push Push = new Push(); + public static readonly Rev Rev = new Rev(); + public static readonly Rev16 Rev16 = new Rev16(); + public static readonly Revsh Revsh = new Revsh(); + public static readonly Ror Ror = new Ror(); public static readonly Rsb Rsb = new Rsb(); - - /// - /// Rsc instruction - /// public static readonly Rsc Rsc = new Rsc(); - - /// - /// Sbc instruction - /// public static readonly Sbc Sbc = new Sbc(); - - /// - /// Sub instruction - /// + public static readonly Sev Sev = new Sev(); + public static readonly Stm Stm = new Stm(); + public static readonly Stmea Stmea = new Stmea(); + public static readonly Stmia Stmia = new Stmia(); + public static readonly Str Str = new Str(); + public static readonly Strb Strb = new Strb(); + public static readonly Strh Strh = new Strh(); public static readonly Sub Sub = new Sub(); - - /// - /// Tst instruction - /// - public static readonly Tst Tst = new Tst(); - - /// - /// Teq instruction - /// - public static readonly Teq Teq = new Teq(); - - /// - /// Asr instruction - /// - public static readonly Asr Asr = new Asr(); - - /// - /// Lsl instruction - /// - public static readonly Lsl Lsl = new Lsl(); - - /// - /// Lsr instruction - /// - public static readonly Lsr Lsr = new Lsr(); - - /// - /// Ror instruction - /// - public static readonly Ror Ror = new Ror(); - - /// - /// Mul instruction - /// - public static readonly Mul Mul = new Mul(); - - /// - /// Sxtb instruction - /// + public static readonly Svc Svc = new Svc(); + public static readonly Swi Swi = new Swi(); public static readonly Sxtb Sxtb = new Sxtb(); - - /// - /// Sxth instruction - /// public static readonly Sxth Sxth = new Sxth(); - - /// - /// Uxtb instruction - /// + public static readonly Teq Teq = new Teq(); + public static readonly Tst Tst = new Tst(); public static readonly Uxtb Uxtb = new Uxtb(); - - /// - /// Uxth instruction - /// public static readonly Uxth Uxth = new Uxth(); - - /// - /// Rev instruction - /// - public static readonly Rev Rev = new Rev(); - - /// - /// Rev16 instruction - /// - public static readonly Rev16 Rev16 = new Rev16(); - - /// - /// Revsh instruction - /// - public static readonly Revsh Revsh = new Revsh(); - - /// - /// Mrs instruction - /// - public static readonly Mrs Mrs = new Mrs(); - - /// - /// Msr instruction - /// - public static readonly Msr Msr = new Msr(); - - /// - /// Ldr instruction - /// - public static readonly Ldr Ldr = new Ldr(); - - /// - /// Str instruction - /// - public static readonly Str Str = new Str(); - - /// - /// Strh instruction - /// - public static readonly Strh Strh = new Strh(); - - /// - /// Ldrh instruction - /// - public static readonly Ldrh Ldrh = new Ldrh(); - - /// - /// Ldrsh instruction - /// - public static readonly Ldrsh Ldrsh = new Ldrsh(); - - /// - /// Strb instruction - /// - public static readonly Strb Strb = new Strb(); - - /// - /// Ldrb instruction - /// - public static readonly Ldrb Ldrb = new Ldrb(); - - /// - /// Ldrsb instruction - /// - public static readonly Ldrsb Ldrsb = new Ldrsb(); - - /// - /// Ldm instruction - /// - public static readonly Ldm Ldm = new Ldm(); - - /// - /// Ldmia instruction - /// - public static readonly Ldmia Ldmia = new Ldmia(); - - /// - /// Ldmfd instruction - /// - public static readonly Ldmfd Ldmfd = new Ldmfd(); - - /// - /// Pop instruction - /// - public static readonly Pop Pop = new Pop(); - - /// - /// Push instruction - /// - public static readonly Push Push = new Push(); - - /// - /// Stm instruction - /// - public static readonly Stm Stm = new Stm(); - - /// - /// Stmia instruction - /// - public static readonly Stmia Stmia = new Stmia(); - - /// - /// Stmea instruction - /// - public static readonly Stmea Stmea = new Stmea(); - - /// - /// Dmb instruction - /// - public static readonly Dmb Dmb = new Dmb(); - - /// - /// Dsb instruction - /// - public static readonly Dsb Dsb = new Dsb(); - - /// - /// Isb instruction - /// - public static readonly Isb Isb = new Isb(); - - /// - /// Nop instruction - /// - public static readonly Nop Nop = new Nop(); - - /// - /// Sev instruction - /// - public static readonly Sev Sev = new Sev(); - - /// - /// Svc instruction - /// - public static readonly Svc Svc = new Svc(); - - /// - /// Wfe instruction - /// public static readonly Wfe Wfe = new Wfe(); - - /// - /// Wfi instruction - /// public static readonly Wfi Wfi = new Wfi(); - - /// - /// Yield instruction - /// public static readonly Yield Yield = new Yield(); - - /// - /// Swi instruction - /// - public static readonly Swi Swi = new Swi(); - - /// - /// Bkpt instruction - /// - public static readonly Bkpt Bkpt = new Bkpt(); } } diff --git a/Source/Mosa.Platform.ARMv6/MachineCodeEmitter.cs b/Source/Mosa.Platform.ARMv6/ARMv6CodeEmitter.cs similarity index 99% rename from Source/Mosa.Platform.ARMv6/MachineCodeEmitter.cs rename to Source/Mosa.Platform.ARMv6/ARMv6CodeEmitter.cs index 3dc8ba5d74..c0dd296cd0 100644 --- a/Source/Mosa.Platform.ARMv6/MachineCodeEmitter.cs +++ b/Source/Mosa.Platform.ARMv6/ARMv6CodeEmitter.cs @@ -20,7 +20,7 @@ public enum OffsetDirection { Up, Down }; /// /// An ARMv6 machine code emitter. /// - public sealed class MachineCodeEmitter : BaseCodeEmitter + public sealed class ARMv6CodeEmitter : BaseCodeEmitter { #region Code Generation Members diff --git a/Source/Mosa.Platform.ARMv6/ARMv6Instruction.cs b/Source/Mosa.Platform.ARMv6/ARMv6Instruction.cs index 6523511501..ed7cf74781 100644 --- a/Source/Mosa.Platform.ARMv6/ARMv6Instruction.cs +++ b/Source/Mosa.Platform.ARMv6/ARMv6Instruction.cs @@ -2,6 +2,7 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; +using System; namespace Mosa.Platform.ARMv6 { @@ -35,7 +36,7 @@ protected ARMv6Instruction(byte resultCount, byte operandCount) /// protected virtual uint ComputeOpCode(Operand destination, Operand source, Operand third) { - throw new System.Exception("opcode not implemented for this instruction"); + throw new Exception("opcode not implemented for this instruction"); } /// @@ -43,7 +44,7 @@ protected virtual uint ComputeOpCode(Operand destination, Operand source, Operan /// /// The node. /// The emitter. - protected virtual void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected virtual void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO: Check x86 Implementation } @@ -55,7 +56,7 @@ protected virtual void Emit(InstructionNode node, MachineCodeEmitter emitter) /// The emitter. public void Emit(InstructionNode node, BaseCodeEmitter emitter) { - Emit(node, emitter as MachineCodeEmitter); + Emit(node, emitter as ARMv6CodeEmitter); } /// @@ -65,7 +66,7 @@ public void Emit(InstructionNode node, BaseCodeEmitter emitter) /// The emitter. /// The opcode. /// - protected void EmitDataProcessingInstruction(InstructionNode node, MachineCodeEmitter emitter, byte opcode) + protected void EmitDataProcessingInstruction(InstructionNode node, ARMv6CodeEmitter emitter, byte opcode) { if (node.Operand2.IsCPURegister && node.Operand3.IsShift) { @@ -86,7 +87,7 @@ protected void EmitDataProcessingInstruction(InstructionNode node, MachineCodeEm /// /// The node. /// The emitter. - protected void EmitMultiplyInstruction(InstructionNode node, MachineCodeEmitter emitter) + protected void EmitMultiplyInstruction(InstructionNode node, ARMv6CodeEmitter emitter) { if (!node.Operand3.IsCPURegister) { @@ -98,7 +99,7 @@ protected void EmitMultiplyInstruction(InstructionNode node, MachineCodeEmitter } } - protected void EmitMemoryLoadStore(InstructionNode node, MachineCodeEmitter emitter, TransferType transferType) + protected void EmitMemoryLoadStore(InstructionNode node, ARMv6CodeEmitter emitter, TransferType transferType) { if (node.Operand2.IsConstant) { diff --git a/Source/Mosa.Platform.ARMv6/ARMv6OpcodeEncoder.cs b/Source/Mosa.Platform.ARMv6/ARMv6OpcodeEncoder.cs new file mode 100644 index 0000000000..e2061932dd --- /dev/null +++ b/Source/Mosa.Platform.ARMv6/ARMv6OpcodeEncoder.cs @@ -0,0 +1,8 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +namespace Mosa.Platform.x86 +{ + public static class ARMv6OpcodeEncoderExtensions + { + } +} diff --git a/Source/Mosa.Platform.ARMv6/Architecture.cs b/Source/Mosa.Platform.ARMv6/Architecture.cs index 0b4c8067c2..4bcf9339d5 100644 --- a/Source/Mosa.Platform.ARMv6/Architecture.cs +++ b/Source/Mosa.Platform.ARMv6/Architecture.cs @@ -225,7 +225,7 @@ public override void GetTypeRequirements(MosaTypeLayout typeLayout, MosaType typ /// public override BaseCodeEmitter GetCodeEmitter() { - return new MachineCodeEmitter(); + return new ARMv6CodeEmitter(); } /// diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Adc.cs b/Source/Mosa.Platform.ARMv6/Instructions/Adc.cs index 519444b7ae..436b081738 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Adc.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Adc.cs @@ -29,7 +29,7 @@ public Adc() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0101); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Add.cs b/Source/Mosa.Platform.ARMv6/Instructions/Add.cs index 5dfd2cd625..167b45a057 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Add.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Add.cs @@ -30,7 +30,7 @@ public Add() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0100); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Adr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Adr.cs index 949db9e251..78ec56c995 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Adr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Adr.cs @@ -29,7 +29,7 @@ public Adr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/And.cs b/Source/Mosa.Platform.ARMv6/Instructions/And.cs index acae8bd900..8f1052bee4 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/And.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/And.cs @@ -29,7 +29,7 @@ public And() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0000); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Asr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Asr.cs index ba5d697244..1a765040b7 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Asr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Asr.cs @@ -28,7 +28,7 @@ public Asr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/B.cs b/Source/Mosa.Platform.ARMv6/Instructions/B.cs index 92a5021b1d..f12b591f87 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/B.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/B.cs @@ -28,7 +28,7 @@ public B() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Bic.cs b/Source/Mosa.Platform.ARMv6/Instructions/Bic.cs index 085e694ebd..e3c11e33d6 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Bic.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Bic.cs @@ -29,7 +29,7 @@ public Bic() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1110); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Bkpt.cs b/Source/Mosa.Platform.ARMv6/Instructions/Bkpt.cs index 8169bc2f88..1b1038a687 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Bkpt.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Bkpt.cs @@ -29,7 +29,7 @@ public Bkpt() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Bl.cs b/Source/Mosa.Platform.ARMv6/Instructions/Bl.cs index d3743e7f11..277e6c359f 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Bl.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Bl.cs @@ -28,7 +28,7 @@ public Bl() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Blx.cs b/Source/Mosa.Platform.ARMv6/Instructions/Blx.cs index 4820a1578f..d1d8aad33e 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Blx.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Blx.cs @@ -28,7 +28,7 @@ public Blx() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Bx.cs b/Source/Mosa.Platform.ARMv6/Instructions/Bx.cs index 25988cd04f..f962d02106 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Bx.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Bx.cs @@ -28,7 +28,7 @@ public Bx() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Cmn.cs b/Source/Mosa.Platform.ARMv6/Instructions/Cmn.cs index efb637d496..d0fa6aa0c1 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Cmn.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Cmn.cs @@ -30,7 +30,7 @@ public Cmn() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1011); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Cmp.cs b/Source/Mosa.Platform.ARMv6/Instructions/Cmp.cs index db5ca71a1d..92e3a22a50 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Cmp.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Cmp.cs @@ -30,7 +30,7 @@ public Cmp() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1010); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Dmb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Dmb.cs index 73da6fb48c..de1031d9e9 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Dmb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Dmb.cs @@ -28,7 +28,7 @@ public Dmb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Dsb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Dsb.cs index a74d81f192..65465097cd 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Dsb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Dsb.cs @@ -28,7 +28,7 @@ public Dsb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Eor.cs b/Source/Mosa.Platform.ARMv6/Instructions/Eor.cs index ec55246b8e..f9ecb278ad 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Eor.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Eor.cs @@ -29,7 +29,7 @@ public Eor() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0001); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Isb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Isb.cs index 63bc60c749..1919b139f3 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Isb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Isb.cs @@ -28,7 +28,7 @@ public Isb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldm.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldm.cs index b814ea2523..16c61e90c0 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldm.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldm.cs @@ -28,7 +28,7 @@ public Ldm() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldmfd.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldmfd.cs index 6b26886a3f..da4044ffe6 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldmfd.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldmfd.cs @@ -28,7 +28,7 @@ public Ldmfd() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldmia.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldmia.cs index 1f3df4c4d3..28fcdba5a7 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldmia.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldmia.cs @@ -28,7 +28,7 @@ public Ldmia() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldr.cs index ffd4d3cd57..565904adc5 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldr.cs @@ -29,7 +29,7 @@ public Ldr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitMemoryLoadStore(node, emitter, TransferType.Load); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldrb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldrb.cs index 124fbcf09e..0fa3007fec 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldrb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldrb.cs @@ -29,7 +29,7 @@ public Ldrb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldrh.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldrh.cs index 132870a223..78a926e175 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldrh.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldrh.cs @@ -29,7 +29,7 @@ public Ldrh() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldrsb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldrsb.cs index 9aa8c17e44..1aa5269df6 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldrsb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldrsb.cs @@ -29,7 +29,7 @@ public Ldrsb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ldrsh.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ldrsh.cs index a43ac27e05..bbd14036c6 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ldrsh.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ldrsh.cs @@ -29,7 +29,7 @@ public Ldrsh() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Lsl.cs b/Source/Mosa.Platform.ARMv6/Instructions/Lsl.cs index 00e3de463e..fbc6df93e1 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Lsl.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Lsl.cs @@ -28,7 +28,7 @@ public Lsl() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Lsr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Lsr.cs index 4b28027a53..3044828d60 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Lsr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Lsr.cs @@ -28,7 +28,7 @@ public Lsr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Mov.cs b/Source/Mosa.Platform.ARMv6/Instructions/Mov.cs index 17d2854cf4..f799184fe5 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Mov.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Mov.cs @@ -30,7 +30,7 @@ public Mov() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1101); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Mrs.cs b/Source/Mosa.Platform.ARMv6/Instructions/Mrs.cs index a4e1afcc0a..21f3a29d39 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Mrs.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Mrs.cs @@ -29,7 +29,7 @@ public Mrs() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Msr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Msr.cs index c06973d127..13a6f4df8f 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Msr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Msr.cs @@ -29,7 +29,7 @@ public Msr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Mul.cs b/Source/Mosa.Platform.ARMv6/Instructions/Mul.cs index 1e9fb33fd9..445e74541d 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Mul.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Mul.cs @@ -29,7 +29,7 @@ public Mul() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitMultiplyInstruction(node, emitter); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Mvn.cs b/Source/Mosa.Platform.ARMv6/Instructions/Mvn.cs index 566c66c871..c480d31398 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Mvn.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Mvn.cs @@ -30,7 +30,7 @@ public Mvn() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1111); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Nop.cs b/Source/Mosa.Platform.ARMv6/Instructions/Nop.cs index d024cfe2b6..e5eb5312f7 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Nop.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Nop.cs @@ -28,7 +28,7 @@ public Nop() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Orr.cs b/Source/Mosa.Platform.ARMv6/Instructions/Orr.cs index aec3c40446..91aeb0161e 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Orr.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Orr.cs @@ -29,7 +29,7 @@ public Orr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1100); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Pop.cs b/Source/Mosa.Platform.ARMv6/Instructions/Pop.cs index 5eded24e60..50f0c418c5 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Pop.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Pop.cs @@ -28,7 +28,7 @@ public Pop() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Push.cs b/Source/Mosa.Platform.ARMv6/Instructions/Push.cs index 59c8afdeab..fccc04f4bc 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Push.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Push.cs @@ -29,7 +29,7 @@ public Push() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Rev.cs b/Source/Mosa.Platform.ARMv6/Instructions/Rev.cs index c7ce55a7af..c7b42eb96f 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Rev.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Rev.cs @@ -28,7 +28,7 @@ public Rev() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Rev16.cs b/Source/Mosa.Platform.ARMv6/Instructions/Rev16.cs index 3cbfba198d..40b3e2f618 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Rev16.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Rev16.cs @@ -28,7 +28,7 @@ public Rev16() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Revsh.cs b/Source/Mosa.Platform.ARMv6/Instructions/Revsh.cs index efcac8f3e6..9d86af3b71 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Revsh.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Revsh.cs @@ -28,7 +28,7 @@ public Revsh() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Ror.cs b/Source/Mosa.Platform.ARMv6/Instructions/Ror.cs index 9793e90363..e5427685bb 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Ror.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Ror.cs @@ -28,7 +28,7 @@ public Ror() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Rsb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Rsb.cs index 726d427937..9863a91896 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Rsb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Rsb.cs @@ -30,7 +30,7 @@ public Rsb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0011); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Rsc.cs b/Source/Mosa.Platform.ARMv6/Instructions/Rsc.cs index d4a1ddeabe..c0bbfb5906 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Rsc.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Rsc.cs @@ -30,7 +30,7 @@ public Rsc() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0111); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Sbc.cs b/Source/Mosa.Platform.ARMv6/Instructions/Sbc.cs index af0e439cd8..02be72f98b 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Sbc.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Sbc.cs @@ -29,7 +29,7 @@ public Sbc() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0110); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Sev.cs b/Source/Mosa.Platform.ARMv6/Instructions/Sev.cs index 94a1471656..aaedb279a9 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Sev.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Sev.cs @@ -28,7 +28,7 @@ public Sev() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Stm.cs b/Source/Mosa.Platform.ARMv6/Instructions/Stm.cs index f7eea26488..72b4abc2d5 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Stm.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Stm.cs @@ -28,7 +28,7 @@ public Stm() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Stmea.cs b/Source/Mosa.Platform.ARMv6/Instructions/Stmea.cs index 69ad9c87c1..bc6a9531cf 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Stmea.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Stmea.cs @@ -28,7 +28,7 @@ public Stmea() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Stmia.cs b/Source/Mosa.Platform.ARMv6/Instructions/Stmia.cs index f7c3a71b81..011bf15059 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Stmia.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Stmia.cs @@ -28,7 +28,7 @@ public Stmia() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Str.cs b/Source/Mosa.Platform.ARMv6/Instructions/Str.cs index e64f28d298..92f299804f 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Str.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Str.cs @@ -29,7 +29,7 @@ public Str() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitMemoryLoadStore(node, emitter, TransferType.Store); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Strb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Strb.cs index 7df51c6bce..9f403a486c 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Strb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Strb.cs @@ -29,7 +29,7 @@ public Strb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Strh.cs b/Source/Mosa.Platform.ARMv6/Instructions/Strh.cs index 08820b6e16..7729f7f479 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Strh.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Strh.cs @@ -29,7 +29,7 @@ public Strh() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Sub.cs b/Source/Mosa.Platform.ARMv6/Instructions/Sub.cs index 2275338a38..1913239ebb 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Sub.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Sub.cs @@ -29,7 +29,7 @@ public Sub() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b0010); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Svc.cs b/Source/Mosa.Platform.ARMv6/Instructions/Svc.cs index ca0762bdc5..f16e1e9c6a 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Svc.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Svc.cs @@ -28,7 +28,7 @@ public Svc() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Swi.cs b/Source/Mosa.Platform.ARMv6/Instructions/Swi.cs index 6eba20e2c9..66c422f990 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Swi.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Swi.cs @@ -29,7 +29,7 @@ public Swi() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Sxtb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Sxtb.cs index 0fe448dd81..c719215094 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Sxtb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Sxtb.cs @@ -29,7 +29,7 @@ public Sxtb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Sxth.cs b/Source/Mosa.Platform.ARMv6/Instructions/Sxth.cs index 3689283a5c..faeab8f405 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Sxth.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Sxth.cs @@ -29,7 +29,7 @@ public Sxth() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Teq.cs b/Source/Mosa.Platform.ARMv6/Instructions/Teq.cs index c288a77792..1888852e54 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Teq.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Teq.cs @@ -30,7 +30,7 @@ public Teq() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1001); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Tst.cs b/Source/Mosa.Platform.ARMv6/Instructions/Tst.cs index bc2ada9cde..fdfaec8e2b 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Tst.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Tst.cs @@ -30,7 +30,7 @@ public Tst() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { EmitDataProcessingInstruction(node, emitter, Bits.b1000); } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Uxtb.cs b/Source/Mosa.Platform.ARMv6/Instructions/Uxtb.cs index caa0437713..df4fd3b1e7 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Uxtb.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Uxtb.cs @@ -29,7 +29,7 @@ public Uxtb() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Uxth.cs b/Source/Mosa.Platform.ARMv6/Instructions/Uxth.cs index bb1b467092..11c832a641 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Uxth.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Uxth.cs @@ -29,7 +29,7 @@ public Uxth() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Wfe.cs b/Source/Mosa.Platform.ARMv6/Instructions/Wfe.cs index fdab23209a..0f6dcbd51b 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Wfe.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Wfe.cs @@ -28,7 +28,7 @@ public Wfe() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Wfi.cs b/Source/Mosa.Platform.ARMv6/Instructions/Wfi.cs index f54e5c7045..715097e96c 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Wfi.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Wfi.cs @@ -28,7 +28,7 @@ public Wfi() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Instructions/Yield.cs b/Source/Mosa.Platform.ARMv6/Instructions/Yield.cs index 654f749575..73fa307301 100644 --- a/Source/Mosa.Platform.ARMv6/Instructions/Yield.cs +++ b/Source/Mosa.Platform.ARMv6/Instructions/Yield.cs @@ -28,7 +28,7 @@ public Yield() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + protected override void Emit(InstructionNode node, ARMv6CodeEmitter emitter) { // TODO } diff --git a/Source/Mosa.Platform.ARMv6/Mosa.Platform.ARMv6.csproj b/Source/Mosa.Platform.ARMv6/Mosa.Platform.ARMv6.csproj index 50cbc255bc..b6ae59e052 100644 --- a/Source/Mosa.Platform.ARMv6/Mosa.Platform.ARMv6.csproj +++ b/Source/Mosa.Platform.ARMv6/Mosa.Platform.ARMv6.csproj @@ -157,8 +157,9 @@ - + + diff --git a/Source/Mosa.Platform.x86/Architecture.cs b/Source/Mosa.Platform.x86/Architecture.cs index 36747e0aa4..f36469fd82 100644 --- a/Source/Mosa.Platform.x86/Architecture.cs +++ b/Source/Mosa.Platform.x86/Architecture.cs @@ -259,7 +259,7 @@ public override void GetTypeRequirements(MosaTypeLayout typeLayout, MosaType typ /// public override BaseCodeEmitter GetCodeEmitter() { - return new MachineCodeEmitter(); + return new X86CodeEmitter(); } /// diff --git a/Source/Mosa.Platform.x86/Instructions/Adc.cs b/Source/Mosa.Platform.x86/Instructions/Adc.cs index cb6f9d3fa2..308e608d0e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Adc.cs +++ b/Source/Mosa.Platform.x86/Instructions/Adc.cs @@ -12,9 +12,9 @@ public sealed class Adc : TwoOperandInstruction { #region Data members - private static readonly OpCode RM_C = new OpCode(new byte[] { 0x81 }, 2); - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x13 }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x11 }); + private static readonly LegacyOpCode RM_C = new LegacyOpCode(new byte[] { 0x81 }, 2); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x13 }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x11 }); #endregion Data members @@ -27,7 +27,7 @@ public sealed class Adc : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && third.IsConstant) return RM_C; if (destination.IsCPURegister && third.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/Add.cs b/Source/Mosa.Platform.x86/Instructions/Add.cs index 3d05a09045..5096557b79 100644 --- a/Source/Mosa.Platform.x86/Instructions/Add.cs +++ b/Source/Mosa.Platform.x86/Instructions/Add.cs @@ -12,11 +12,11 @@ public sealed class Add : TwoOperandInstruction { #region Data Members - private static readonly OpCode R_C = new OpCode(new byte[] { 0x81 }, 0); - private static readonly OpCode M_C = R_C; - private static readonly OpCode R_M = new OpCode(new byte[] { 0x03 }); - private static readonly OpCode R_R = R_M; - private static readonly OpCode M_R = new OpCode(new byte[] { 0x01 }); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0x81 }, 0); + private static readonly LegacyOpCode M_C = R_C; + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x03 }); + private static readonly LegacyOpCode R_R = R_M; + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x01 }); #endregion Data Members @@ -29,7 +29,7 @@ public sealed class Add : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && third.IsConstant) return R_C; if (destination.IsCPURegister && third.IsCPURegister) return R_R; diff --git a/Source/Mosa.Platform.x86/Instructions/AddSD.cs b/Source/Mosa.Platform.x86/Instructions/AddSD.cs index 53b27a3941..428fc0f3d1 100644 --- a/Source/Mosa.Platform.x86/Instructions/AddSD.cs +++ b/Source/Mosa.Platform.x86/Instructions/AddSD.cs @@ -11,7 +11,7 @@ public sealed class Addsd : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x58 }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x58 }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Addsd : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/AddSS.cs b/Source/Mosa.Platform.x86/Instructions/AddSS.cs index 3a112d307f..e8c429c710 100644 --- a/Source/Mosa.Platform.x86/Instructions/AddSS.cs +++ b/Source/Mosa.Platform.x86/Instructions/AddSS.cs @@ -11,7 +11,7 @@ public sealed class Addss : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x58 }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x58 }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Addss : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/And.cs b/Source/Mosa.Platform.x86/Instructions/And.cs index 092c7102c1..5b34fdfa57 100644 --- a/Source/Mosa.Platform.x86/Instructions/And.cs +++ b/Source/Mosa.Platform.x86/Instructions/And.cs @@ -12,11 +12,11 @@ public sealed class And : TwoOperandInstruction { #region Data Members - private static readonly OpCode R_C = new OpCode(new byte[] { 0x81 }, 4); - private static readonly OpCode M_C = R_C; - private static readonly OpCode R_M = new OpCode(new byte[] { 0x23 }); - private static readonly OpCode R_R = R_M; - private static readonly OpCode M_R = new OpCode(new byte[] { 0x21 }); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0x81 }, 4); + private static readonly LegacyOpCode M_C = R_C; + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x23 }); + private static readonly LegacyOpCode R_R = R_M; + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x21 }); #endregion Data Members @@ -29,7 +29,7 @@ public sealed class And : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) { diff --git a/Source/Mosa.Platform.x86/Instructions/Branch.cs b/Source/Mosa.Platform.x86/Instructions/Branch.cs index 135b1f10ce..b10d05ae21 100644 --- a/Source/Mosa.Platform.x86/Instructions/Branch.cs +++ b/Source/Mosa.Platform.x86/Instructions/Branch.cs @@ -61,7 +61,7 @@ public Branch() : /// The node. /// The emitter. /// - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { byte[] opcode = null; diff --git a/Source/Mosa.Platform.x86/Instructions/Break.cs b/Source/Mosa.Platform.x86/Instructions/Break.cs index 44a10968a5..376f2a6528 100644 --- a/Source/Mosa.Platform.x86/Instructions/Break.cs +++ b/Source/Mosa.Platform.x86/Instructions/Break.cs @@ -28,7 +28,7 @@ public Break() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xCC); } diff --git a/Source/Mosa.Platform.x86/Instructions/Btr.cs b/Source/Mosa.Platform.x86/Instructions/Btr.cs index 1c696f546f..f4ddd98f5f 100644 --- a/Source/Mosa.Platform.x86/Instructions/Btr.cs +++ b/Source/Mosa.Platform.x86/Instructions/Btr.cs @@ -11,8 +11,8 @@ public sealed class Btr : TwoOperandInstruction { #region Data Members - private static readonly OpCode RM_C = new OpCode(new byte[] { 0x0F, 0xB3 }, 6); - private static readonly OpCode RM_R = new OpCode(new byte[] { 0x0F, 0xBA }); + private static readonly LegacyOpCode RM_C = new LegacyOpCode(new byte[] { 0x0F, 0xB3 }, 6); + private static readonly LegacyOpCode RM_R = new LegacyOpCode(new byte[] { 0x0F, 0xBA }); #endregion Data Members @@ -25,7 +25,7 @@ public sealed class Btr : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (third.IsConstant) return RM_C; diff --git a/Source/Mosa.Platform.x86/Instructions/Bts.cs b/Source/Mosa.Platform.x86/Instructions/Bts.cs index 1a38dd206a..ec06455a7d 100644 --- a/Source/Mosa.Platform.x86/Instructions/Bts.cs +++ b/Source/Mosa.Platform.x86/Instructions/Bts.cs @@ -11,8 +11,8 @@ public sealed class Bts : TwoOperandInstruction { #region Data Members - private static readonly OpCode RM_C = new OpCode(new byte[] { 0x0F, 0xAB }, 5); - private static readonly OpCode RM_R = new OpCode(new byte[] { 0x0F, 0xBA }); + private static readonly LegacyOpCode RM_C = new LegacyOpCode(new byte[] { 0x0F, 0xAB }, 5); + private static readonly LegacyOpCode RM_R = new LegacyOpCode(new byte[] { 0x0F, 0xBA }); #endregion Data Members @@ -25,7 +25,7 @@ public sealed class Bts : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (third.IsConstant) return RM_C; diff --git a/Source/Mosa.Platform.x86/Instructions/Call.cs b/Source/Mosa.Platform.x86/Instructions/Call.cs index b803f34341..2625b11da9 100644 --- a/Source/Mosa.Platform.x86/Instructions/Call.cs +++ b/Source/Mosa.Platform.x86/Instructions/Call.cs @@ -11,7 +11,7 @@ public sealed class Call : X86Instruction { #region Data Member - private static readonly OpCode RegCall = new OpCode(new byte[] { 0xFF }, 2); + private static readonly LegacyOpCode RegCall = new LegacyOpCode(new byte[] { 0xFF }, 2); private static readonly byte[] CALL = new byte[] { 0xE8 }; #endregion Data Member @@ -41,7 +41,7 @@ public Call() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.OperandCount == 0) { diff --git a/Source/Mosa.Platform.x86/Instructions/Cdq.cs b/Source/Mosa.Platform.x86/Instructions/Cdq.cs index 08266cd5be..5518773432 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cdq.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cdq.cs @@ -28,7 +28,7 @@ public Cdq() /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0x99); } diff --git a/Source/Mosa.Platform.x86/Instructions/Cli.cs b/Source/Mosa.Platform.x86/Instructions/Cli.cs index 860c17fe2f..ee9c4d506b 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cli.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cli.cs @@ -28,7 +28,7 @@ public Cli() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xFA); } diff --git a/Source/Mosa.Platform.x86/Instructions/Cmovcc.cs b/Source/Mosa.Platform.x86/Instructions/Cmovcc.cs index 379a07c669..ebdeac794e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cmovcc.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cmovcc.cs @@ -24,26 +24,26 @@ public Cmovcc() : #region Data Members - private static readonly OpCode CMOVO = new OpCode(new byte[] { 0x0F, 0x40 }); // Overflow (OF = 1) - private static readonly OpCode CMOVNO = new OpCode(new byte[] { 0x0F, 0x41 }); // NoOverflow (OF = 0) - private static readonly OpCode CMOVB = new OpCode(new byte[] { 0x0F, 0x42 }); // UnsignedLessThan (CF = 1). - private static readonly OpCode CMOVC = new OpCode(new byte[] { 0x0F, 0x42 }); // Carry (CF = 1) - private static readonly OpCode CMOVNB = new OpCode(new byte[] { 0x0F, 0x43 }); // UnsignedGreaterOrEqual (greater or equal) (CF = 0) - private static readonly OpCode CMOVNC = new OpCode(new byte[] { 0x0F, 0x43 }); // NoCarry (CF = 0) - private static readonly OpCode CMOVE = new OpCode(new byte[] { 0x0F, 0x44 }); // Equal (ZF = 1) - private static readonly OpCode CMOVZ = new OpCode(new byte[] { 0x0F, 0x44 }); // Zero (ZF = 1) - private static readonly OpCode CMOVNE = new OpCode(new byte[] { 0x0F, 0x45 }); // NotEqual (ZF = 0) - private static readonly OpCode CMOVNZ = new OpCode(new byte[] { 0x0F, 0x45 }); // NotZero (ZF = 1) - private static readonly OpCode CMOVBE = new OpCode(new byte[] { 0x0F, 0x46 }); // UnsignedLessOrEqual (CF = 1 or ZF = 1). - private static readonly OpCode CMOVA = new OpCode(new byte[] { 0x0F, 0x47 }); // UnsignedGreaterThan (CF = 0 and ZF = 0). - private static readonly OpCode CMOVS = new OpCode(new byte[] { 0x0F, 0x48 }); // Signed (CF = 0 and ZF = 0) - private static readonly OpCode CMOVNS = new OpCode(new byte[] { 0x0F, 0x49 }); // NotSigned (SF = 0) - private static readonly OpCode CMOVP = new OpCode(new byte[] { 0x0F, 0x4A }); // Parity (PF = 1) - private static readonly OpCode CMOVNP = new OpCode(new byte[] { 0x0F, 0x4B }); // NoParity (PF = 0) - private static readonly OpCode CMOVL = new OpCode(new byte[] { 0x0F, 0x4C }); // LessThan (SF <> OF) - private static readonly OpCode CMOVGE = new OpCode(new byte[] { 0x0F, 0x4D }); // GreaterOrEqual (greater or equal) (SF = OF) - private static readonly OpCode CMOVLE = new OpCode(new byte[] { 0x0F, 0x4E }); // LessOrEqual (ZF = 1 or SF <> OF) - private static readonly OpCode CMOVG = new OpCode(new byte[] { 0x0F, 0x4F }); // GreaterThan (ZF = 0 and SF = OF) + private static readonly LegacyOpCode CMOVO = new LegacyOpCode(new byte[] { 0x0F, 0x40 }); // Overflow (OF = 1) + private static readonly LegacyOpCode CMOVNO = new LegacyOpCode(new byte[] { 0x0F, 0x41 }); // NoOverflow (OF = 0) + private static readonly LegacyOpCode CMOVB = new LegacyOpCode(new byte[] { 0x0F, 0x42 }); // UnsignedLessThan (CF = 1). + private static readonly LegacyOpCode CMOVC = new LegacyOpCode(new byte[] { 0x0F, 0x42 }); // Carry (CF = 1) + private static readonly LegacyOpCode CMOVNB = new LegacyOpCode(new byte[] { 0x0F, 0x43 }); // UnsignedGreaterOrEqual (greater or equal) (CF = 0) + private static readonly LegacyOpCode CMOVNC = new LegacyOpCode(new byte[] { 0x0F, 0x43 }); // NoCarry (CF = 0) + private static readonly LegacyOpCode CMOVE = new LegacyOpCode(new byte[] { 0x0F, 0x44 }); // Equal (ZF = 1) + private static readonly LegacyOpCode CMOVZ = new LegacyOpCode(new byte[] { 0x0F, 0x44 }); // Zero (ZF = 1) + private static readonly LegacyOpCode CMOVNE = new LegacyOpCode(new byte[] { 0x0F, 0x45 }); // NotEqual (ZF = 0) + private static readonly LegacyOpCode CMOVNZ = new LegacyOpCode(new byte[] { 0x0F, 0x45 }); // NotZero (ZF = 1) + private static readonly LegacyOpCode CMOVBE = new LegacyOpCode(new byte[] { 0x0F, 0x46 }); // UnsignedLessOrEqual (CF = 1 or ZF = 1). + private static readonly LegacyOpCode CMOVA = new LegacyOpCode(new byte[] { 0x0F, 0x47 }); // UnsignedGreaterThan (CF = 0 and ZF = 0). + private static readonly LegacyOpCode CMOVS = new LegacyOpCode(new byte[] { 0x0F, 0x48 }); // Signed (CF = 0 and ZF = 0) + private static readonly LegacyOpCode CMOVNS = new LegacyOpCode(new byte[] { 0x0F, 0x49 }); // NotSigned (SF = 0) + private static readonly LegacyOpCode CMOVP = new LegacyOpCode(new byte[] { 0x0F, 0x4A }); // Parity (PF = 1) + private static readonly LegacyOpCode CMOVNP = new LegacyOpCode(new byte[] { 0x0F, 0x4B }); // NoParity (PF = 0) + private static readonly LegacyOpCode CMOVL = new LegacyOpCode(new byte[] { 0x0F, 0x4C }); // LessThan (SF <> OF) + private static readonly LegacyOpCode CMOVGE = new LegacyOpCode(new byte[] { 0x0F, 0x4D }); // GreaterOrEqual (greater or equal) (SF = OF) + private static readonly LegacyOpCode CMOVLE = new LegacyOpCode(new byte[] { 0x0F, 0x4E }); // LessOrEqual (ZF = 1 or SF <> OF) + private static readonly LegacyOpCode CMOVG = new LegacyOpCode(new byte[] { 0x0F, 0x4F }); // GreaterThan (ZF = 0 and SF = OF) #endregion Data Members @@ -55,9 +55,9 @@ public Cmovcc() : /// The node. /// The emitter. /// - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opcode = null; + LegacyOpCode opcode = null; switch (node.ConditionCode) { diff --git a/Source/Mosa.Platform.x86/Instructions/Cmp.cs b/Source/Mosa.Platform.x86/Instructions/Cmp.cs index e4ffbfbb31..24d5340a29 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cmp.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cmp.cs @@ -13,17 +13,17 @@ public sealed class Cmp : X86Instruction { #region Data Member - private static readonly OpCode M_R = new OpCode(new byte[] { 0x39 }); - private static readonly OpCode R_M = new OpCode(new byte[] { 0x3B }); - private static readonly OpCode R_R = new OpCode(new byte[] { 0x3B }); - private static readonly OpCode M_C = new OpCode(new byte[] { 0x81 }, 7); - private static readonly OpCode R_C = new OpCode(new byte[] { 0x81 }, 7); - private static readonly OpCode R_C_8 = new OpCode(new byte[] { 0x80 }, 7); - private static readonly OpCode R_C_16 = new OpCode(new byte[] { 0x66, 0x81 }, 7); - private static readonly OpCode M_R_8 = new OpCode(new byte[] { 0x38 }); - private static readonly OpCode R_M_8 = new OpCode(new byte[] { 0x3A }); - private static readonly OpCode M_R_16 = new OpCode(new byte[] { 0x66, 0x39 }); - private static readonly OpCode R_M_16 = new OpCode(new byte[] { 0x66, 0x3B }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x39 }); + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x3B }); + private static readonly LegacyOpCode R_R = new LegacyOpCode(new byte[] { 0x3B }); + private static readonly LegacyOpCode M_C = new LegacyOpCode(new byte[] { 0x81 }, 7); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0x81 }, 7); + private static readonly LegacyOpCode R_C_8 = new LegacyOpCode(new byte[] { 0x80 }, 7); + private static readonly LegacyOpCode R_C_16 = new LegacyOpCode(new byte[] { 0x66, 0x81 }, 7); + private static readonly LegacyOpCode M_R_8 = new LegacyOpCode(new byte[] { 0x38 }); + private static readonly LegacyOpCode R_M_8 = new LegacyOpCode(new byte[] { 0x3A }); + private static readonly LegacyOpCode M_R_16 = new LegacyOpCode(new byte[] { 0x66, 0x39 }); + private static readonly LegacyOpCode R_M_16 = new LegacyOpCode(new byte[] { 0x66, 0x3B }); #endregion Data Member @@ -48,7 +48,7 @@ public Cmp() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (source.IsCPURegister && third.IsCPURegister) return R_R; @@ -71,11 +71,11 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { Debug.Assert(node.Result == null); - OpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); + LegacyOpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Operand1, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/CmpXchgLoad.cs b/Source/Mosa.Platform.x86/Instructions/CmpXchgLoad.cs index 8b1132a949..4ecda884e0 100644 --- a/Source/Mosa.Platform.x86/Instructions/CmpXchgLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/CmpXchgLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public CmpXchgLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { CmpXchg(node, emitter); } - private static void CmpXchg(InstructionNode node, MachineCodeEmitter emitter) + private static void CmpXchg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Comisd.cs b/Source/Mosa.Platform.x86/Instructions/Comisd.cs index d125bf2873..654a6ae5cc 100644 --- a/Source/Mosa.Platform.x86/Instructions/Comisd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Comisd.cs @@ -12,7 +12,7 @@ public class Comisd : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x66, 0x0F, 0x2F }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x66, 0x0F, 0x2F }); #endregion Data Members @@ -37,7 +37,7 @@ public Comisd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { Debug.Assert(source.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Comiss.cs b/Source/Mosa.Platform.x86/Instructions/Comiss.cs index a8b56df2d6..81e7cdf9a5 100644 --- a/Source/Mosa.Platform.x86/Instructions/Comiss.cs +++ b/Source/Mosa.Platform.x86/Instructions/Comiss.cs @@ -12,7 +12,7 @@ public class Comiss : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x0F, 0x2F }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x0F, 0x2F }); #endregion Data Members @@ -37,7 +37,7 @@ public Comiss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { Debug.Assert(source.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/CpuId.cs b/Source/Mosa.Platform.x86/Instructions/CpuId.cs index 6f6b3ccfa4..2b140e9e21 100644 --- a/Source/Mosa.Platform.x86/Instructions/CpuId.cs +++ b/Source/Mosa.Platform.x86/Instructions/CpuId.cs @@ -11,7 +11,7 @@ public sealed class CpuId : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x0F, 0xA2 }); // Move imm32 to r/m32 + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x0F, 0xA2 }); // Move imm32 to r/m32 #endregion Data Members @@ -34,7 +34,7 @@ public CpuId() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.Emit(opcode); } diff --git a/Source/Mosa.Platform.x86/Instructions/Cvtsd2ss.cs b/Source/Mosa.Platform.x86/Instructions/Cvtsd2ss.cs index f0fb268686..6209ccf8cb 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvtsd2ss.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvtsd2ss.cs @@ -12,7 +12,7 @@ public class Cvtsd2ss : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x5A }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x5A }); #endregion Data Members @@ -37,7 +37,7 @@ public Cvtsd2ss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && source.IsCPURegister) return opcode; diff --git a/Source/Mosa.Platform.x86/Instructions/Cvtsi2sd.cs b/Source/Mosa.Platform.x86/Instructions/Cvtsi2sd.cs index 1579aafeb5..1ea72c5ca1 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvtsi2sd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvtsi2sd.cs @@ -11,7 +11,7 @@ public sealed class Cvtsi2sd : X86Instruction { #region Data members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x2A }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x2A }); #endregion Data members @@ -36,7 +36,7 @@ public Cvtsi2sd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Cvtsi2ss.cs b/Source/Mosa.Platform.x86/Instructions/Cvtsi2ss.cs index 26f9ccb434..d4d32c68a6 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvtsi2ss.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvtsi2ss.cs @@ -11,7 +11,7 @@ public sealed class Cvtsi2ss : X86Instruction { #region Data members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x2A }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x2A }); #endregion Data members @@ -36,7 +36,7 @@ public Cvtsi2ss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Cvtss2sd.cs b/Source/Mosa.Platform.x86/Instructions/Cvtss2sd.cs index d3cf41a082..5adfd3ddf5 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvtss2sd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvtss2sd.cs @@ -12,7 +12,7 @@ public class Cvtss2sd : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x5A }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x5A }); #endregion Data Members @@ -37,7 +37,7 @@ public Cvtss2sd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && source.IsCPURegister) return opcode; diff --git a/Source/Mosa.Platform.x86/Instructions/Cvttsd2si.cs b/Source/Mosa.Platform.x86/Instructions/Cvttsd2si.cs index 39757e30cf..599a630904 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvttsd2si.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvttsd2si.cs @@ -11,7 +11,7 @@ public class Cvttsd2si : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x2C }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x2C }); #endregion Data Members @@ -36,7 +36,7 @@ public Cvttsd2si() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Cvttss2si.cs b/Source/Mosa.Platform.x86/Instructions/Cvttss2si.cs index b69d060630..4ea70e8bf2 100644 --- a/Source/Mosa.Platform.x86/Instructions/Cvttss2si.cs +++ b/Source/Mosa.Platform.x86/Instructions/Cvttss2si.cs @@ -11,7 +11,7 @@ public class Cvttss2si : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x2C }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x2C }); #endregion Data Members @@ -36,7 +36,7 @@ public Cvttss2si() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Dec.cs b/Source/Mosa.Platform.x86/Instructions/Dec.cs index ecbee643de..056a0cb9ad 100644 --- a/Source/Mosa.Platform.x86/Instructions/Dec.cs +++ b/Source/Mosa.Platform.x86/Instructions/Dec.cs @@ -12,9 +12,9 @@ public sealed class Dec : X86Instruction { #region Data Members - private static readonly OpCode DEC8 = new OpCode(new byte[] { 0xFE }, 1); - private static readonly OpCode DEC16 = new OpCode(new byte[] { 0x66, 0xFF }, 1); - private static readonly OpCode DEC32 = new OpCode(new byte[] { 0xFF }, 1); + private static readonly LegacyOpCode DEC8 = new LegacyOpCode(new byte[] { 0xFE }, 1); + private static readonly LegacyOpCode DEC16 = new LegacyOpCode(new byte[] { 0x66, 0xFF }, 1); + private static readonly LegacyOpCode DEC32 = new LegacyOpCode(new byte[] { 0xFF }, 1); #endregion Data Members @@ -39,7 +39,7 @@ public Dec() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsByte) return DEC8; if (destination.IsShort || destination.IsChar) return DEC16; @@ -53,9 +53,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, null, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, null, null); emitter.Emit(opCode, node.Result); } diff --git a/Source/Mosa.Platform.x86/Instructions/Div.cs b/Source/Mosa.Platform.x86/Instructions/Div.cs index a6ada5ed7c..2f06cdff12 100644 --- a/Source/Mosa.Platform.x86/Instructions/Div.cs +++ b/Source/Mosa.Platform.x86/Instructions/Div.cs @@ -11,7 +11,7 @@ public sealed class Div : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF7 }, 6); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF7 }, 6); #endregion Data Members @@ -34,7 +34,7 @@ public Div() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.Emit(opcode, node.Operand3); } diff --git a/Source/Mosa.Platform.x86/Instructions/DivSD.cs b/Source/Mosa.Platform.x86/Instructions/DivSD.cs index 280bf1f1ff..22de597b7c 100644 --- a/Source/Mosa.Platform.x86/Instructions/DivSD.cs +++ b/Source/Mosa.Platform.x86/Instructions/DivSD.cs @@ -11,7 +11,7 @@ public sealed class Divsd : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x5E }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x5E }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Divsd : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/DivSS.cs b/Source/Mosa.Platform.x86/Instructions/DivSS.cs index 1d6fcb1882..c660095e36 100644 --- a/Source/Mosa.Platform.x86/Instructions/DivSS.cs +++ b/Source/Mosa.Platform.x86/Instructions/DivSS.cs @@ -11,7 +11,7 @@ public sealed class Divss : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x5E }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x5E }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Divss : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/FarJmp.cs b/Source/Mosa.Platform.x86/Instructions/FarJmp.cs index db75ba148d..8c0da3a60a 100644 --- a/Source/Mosa.Platform.x86/Instructions/FarJmp.cs +++ b/Source/Mosa.Platform.x86/Instructions/FarJmp.cs @@ -28,7 +28,7 @@ public FarJmp() /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.EmitFarJumpToNextInstruction(); } diff --git a/Source/Mosa.Platform.x86/Instructions/Hlt.cs b/Source/Mosa.Platform.x86/Instructions/Hlt.cs index 372f07d4bf..de88c34332 100644 --- a/Source/Mosa.Platform.x86/Instructions/Hlt.cs +++ b/Source/Mosa.Platform.x86/Instructions/Hlt.cs @@ -28,7 +28,7 @@ public Hlt() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xF4); } diff --git a/Source/Mosa.Platform.x86/Instructions/IDiv.cs b/Source/Mosa.Platform.x86/Instructions/IDiv.cs index 9440bb5160..b8b3374ded 100644 --- a/Source/Mosa.Platform.x86/Instructions/IDiv.cs +++ b/Source/Mosa.Platform.x86/Instructions/IDiv.cs @@ -11,7 +11,7 @@ public sealed class IDiv : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF7 }, 7); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF7 }, 7); #endregion Data Members @@ -34,7 +34,7 @@ public IDiv() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.Emit(opcode, node.Operand3); } diff --git a/Source/Mosa.Platform.x86/Instructions/IMul.cs b/Source/Mosa.Platform.x86/Instructions/IMul.cs index e13fc89f91..19e3348f64 100644 --- a/Source/Mosa.Platform.x86/Instructions/IMul.cs +++ b/Source/Mosa.Platform.x86/Instructions/IMul.cs @@ -11,7 +11,7 @@ public sealed class IMul : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x0F, 0xAF }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x0F, 0xAF }); #endregion Data Members @@ -34,7 +34,7 @@ public IMul() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.Emit(opcode, node.Result, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/IRetd.cs b/Source/Mosa.Platform.x86/Instructions/IRetd.cs index ccbd9ed602..de12995f3f 100644 --- a/Source/Mosa.Platform.x86/Instructions/IRetd.cs +++ b/Source/Mosa.Platform.x86/Instructions/IRetd.cs @@ -38,7 +38,7 @@ public IRetd() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xCF); } diff --git a/Source/Mosa.Platform.x86/Instructions/In.cs b/Source/Mosa.Platform.x86/Instructions/In.cs index 6d11be4bce..2bf8d1f25e 100644 --- a/Source/Mosa.Platform.x86/Instructions/In.cs +++ b/Source/Mosa.Platform.x86/Instructions/In.cs @@ -13,12 +13,12 @@ public sealed class In : TwoOperandInstruction { #region Data Members - private static readonly OpCode C_8 = new OpCode(new byte[] { 0xE4 }); - private static readonly OpCode R_8 = new OpCode(new byte[] { 0xEC }); - private static readonly OpCode C_16 = new OpCode(new byte[] { 0x66, 0xE5 }); - private static readonly OpCode R_16 = new OpCode(new byte[] { 0x66, 0xED }); - private static readonly OpCode C_32 = new OpCode(new byte[] { 0xE5 }); - private static readonly OpCode R_32 = new OpCode(new byte[] { 0xED }); + private static readonly LegacyOpCode C_8 = new LegacyOpCode(new byte[] { 0xE4 }); + private static readonly LegacyOpCode R_8 = new LegacyOpCode(new byte[] { 0xEC }); + private static readonly LegacyOpCode C_16 = new LegacyOpCode(new byte[] { 0x66, 0xE5 }); + private static readonly LegacyOpCode R_16 = new LegacyOpCode(new byte[] { 0x66, 0xED }); + private static readonly LegacyOpCode C_32 = new LegacyOpCode(new byte[] { 0xE5 }); + private static readonly LegacyOpCode R_32 = new LegacyOpCode(new byte[] { 0xED }); #endregion Data Members @@ -32,7 +32,7 @@ public sealed class In : TwoOperandInstruction /// The source operand. /// /// - private OpCode ComputeOpCode(InstructionSize size, Operand destination, Operand source) + private LegacyOpCode ComputeOpCode(InstructionSize size, Operand destination, Operand source) { Debug.Assert(destination.IsConstant || destination.IsCPURegister); Debug.Assert(size != InstructionSize.None); @@ -70,7 +70,7 @@ private OpCode ComputeOpCode(InstructionSize size, Operand destination, Operand /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { var opCode = ComputeOpCode(node.Size, node.Operand1, node.Operand2); diff --git a/Source/Mosa.Platform.x86/Instructions/Inc.cs b/Source/Mosa.Platform.x86/Instructions/Inc.cs index 2a3835a3a1..f3f0d85a13 100644 --- a/Source/Mosa.Platform.x86/Instructions/Inc.cs +++ b/Source/Mosa.Platform.x86/Instructions/Inc.cs @@ -12,9 +12,9 @@ public sealed class Inc : X86Instruction { #region Data Members - private static readonly OpCode INC8 = new OpCode(new byte[] { 0xFE }, 0); - private static readonly OpCode INC16 = new OpCode(new byte[] { 0x66, 0xFF }, 0); - private static readonly OpCode INC32 = new OpCode(new byte[] { 0xFF }, 0); + private static readonly LegacyOpCode INC8 = new LegacyOpCode(new byte[] { 0xFE }, 0); + private static readonly LegacyOpCode INC16 = new LegacyOpCode(new byte[] { 0x66, 0xFF }, 0); + private static readonly LegacyOpCode INC32 = new LegacyOpCode(new byte[] { 0xFF }, 0); #endregion Data Members @@ -39,7 +39,7 @@ public Inc() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsByte) return INC8; if (destination.IsShort || destination.IsChar) return INC16; @@ -53,9 +53,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, null, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, null, null); emitter.Emit(opCode, node.Result); } diff --git a/Source/Mosa.Platform.x86/Instructions/Int.cs b/Source/Mosa.Platform.x86/Instructions/Int.cs index 871c892545..c97da760b5 100644 --- a/Source/Mosa.Platform.x86/Instructions/Int.cs +++ b/Source/Mosa.Platform.x86/Instructions/Int.cs @@ -11,7 +11,7 @@ public sealed class Int : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xCD }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xCD }); #endregion Data Members @@ -34,7 +34,7 @@ public Int() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xCD); emitter.WriteByte((byte)node.Operand1.ConstantUnsignedInteger); diff --git a/Source/Mosa.Platform.x86/Instructions/Invlpg.cs b/Source/Mosa.Platform.x86/Instructions/Invlpg.cs index 12f7eae2ee..de31a88272 100644 --- a/Source/Mosa.Platform.x86/Instructions/Invlpg.cs +++ b/Source/Mosa.Platform.x86/Instructions/Invlpg.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public Invlpg() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { InvlpgMemory(node, emitter); } - private static void InvlpgMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void InvlpgMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand1.IsConstant); diff --git a/Source/Mosa.Platform.x86/Instructions/Jmp.cs b/Source/Mosa.Platform.x86/Instructions/Jmp.cs index fe8e652353..77aa00f9bd 100644 --- a/Source/Mosa.Platform.x86/Instructions/Jmp.cs +++ b/Source/Mosa.Platform.x86/Instructions/Jmp.cs @@ -12,7 +12,7 @@ public sealed class Jmp : X86Instruction #region Data Members private static readonly byte[] JMP = new byte[] { 0xE9 }; - private static readonly OpCode JMP_R = new OpCode(new byte[] { 0xFF }, 4); + private static readonly LegacyOpCode JMP_R = new LegacyOpCode(new byte[] { 0xFF }, 4); #endregion Data Members @@ -41,7 +41,7 @@ public Jmp() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand1 == null) { diff --git a/Source/Mosa.Platform.x86/Instructions/Lea.cs b/Source/Mosa.Platform.x86/Instructions/Lea.cs index 816efd45d5..2a78efdd0e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Lea.cs +++ b/Source/Mosa.Platform.x86/Instructions/Lea.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public sealed class Lea : TwoOperandInstruction /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { LeaAddress(node, emitter); } - private static void LeaAddress(InstructionNode node, MachineCodeEmitter emitter) + private static void LeaAddress(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Leave.cs b/Source/Mosa.Platform.x86/Instructions/Leave.cs index 6ec2af3372..37d5fa2df3 100644 --- a/Source/Mosa.Platform.x86/Instructions/Leave.cs +++ b/Source/Mosa.Platform.x86/Instructions/Leave.cs @@ -28,7 +28,7 @@ public Leave() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xC9); } diff --git a/Source/Mosa.Platform.x86/Instructions/Lgdt.cs b/Source/Mosa.Platform.x86/Instructions/Lgdt.cs index f9d1ffb15a..a4a274d426 100644 --- a/Source/Mosa.Platform.x86/Instructions/Lgdt.cs +++ b/Source/Mosa.Platform.x86/Instructions/Lgdt.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public Lgdt() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { LgdtMemoryConstant(node, emitter); } - private static void LgdtMemoryConstant(InstructionNode node, MachineCodeEmitter emitter) + private static void LgdtMemoryConstant(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand1.IsConstant); diff --git a/Source/Mosa.Platform.x86/Instructions/Lidt.cs b/Source/Mosa.Platform.x86/Instructions/Lidt.cs index 4ca3b5989e..c2a07040b4 100644 --- a/Source/Mosa.Platform.x86/Instructions/Lidt.cs +++ b/Source/Mosa.Platform.x86/Instructions/Lidt.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -14,7 +13,7 @@ public sealed class Lidt : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x0F, 0x01 }, 3); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x0F, 0x01 }, 3); #endregion Data Members @@ -37,12 +36,12 @@ public Lidt() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { LidtMemoryConstant(node, emitter); } - private static void LidtMemoryConstant(InstructionNode node, MachineCodeEmitter emitter) + private static void LidtMemoryConstant(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand1.IsConstant); diff --git a/Source/Mosa.Platform.x86/Instructions/Lock.cs b/Source/Mosa.Platform.x86/Instructions/Lock.cs index 644a3454f2..d42cdadd2e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Lock.cs +++ b/Source/Mosa.Platform.x86/Instructions/Lock.cs @@ -28,7 +28,7 @@ public Lock() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xF0); } diff --git a/Source/Mosa.Platform.x86/Instructions/Mov.cs b/Source/Mosa.Platform.x86/Instructions/Mov.cs index d8988d4547..5ba9cb1fb4 100644 --- a/Source/Mosa.Platform.x86/Instructions/Mov.cs +++ b/Source/Mosa.Platform.x86/Instructions/Mov.cs @@ -13,17 +13,17 @@ public sealed class Mov : X86Instruction { #region Data Members - private static readonly OpCode RM_C = new OpCode(new byte[] { 0xC7 }, 0); // Move imm32 to r/m32 - private static readonly OpCode RM_C_U8 = new OpCode(new byte[] { 0xC6 }, 0); // Move imm8 to r/m8 - private static readonly OpCode R_RM_16 = new OpCode(new byte[] { 0x66, 0x8B }); - private static readonly OpCode RM_R_U8 = new OpCode(new byte[] { 0x88 }); - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x8B }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x89 }); - private static readonly OpCode M_R_16 = new OpCode(new byte[] { 0x66, 0x89 }); - private static readonly OpCode RM_U8 = new OpCode(new byte[] { 0x8A }); // Move r/m8 to R8 - private static readonly OpCode M_C_16 = new OpCode(new byte[] { 0x66, 0xC7 }); - private static readonly OpCode SEG_RM = new OpCode(new byte[] { 0x8E }); // Move r/m to seg - private static readonly OpCode RM_SEG = new OpCode(new byte[] { 0x8C }); // Move seg to r/m + private static readonly LegacyOpCode RM_C = new LegacyOpCode(new byte[] { 0xC7 }, 0); // Move imm32 to r/m32 + private static readonly LegacyOpCode RM_C_U8 = new LegacyOpCode(new byte[] { 0xC6 }, 0); // Move imm8 to r/m8 + private static readonly LegacyOpCode R_RM_16 = new LegacyOpCode(new byte[] { 0x66, 0x8B }); + private static readonly LegacyOpCode RM_R_U8 = new LegacyOpCode(new byte[] { 0x88 }); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x8B }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x89 }); + private static readonly LegacyOpCode M_R_16 = new LegacyOpCode(new byte[] { 0x66, 0x89 }); + private static readonly LegacyOpCode RM_U8 = new LegacyOpCode(new byte[] { 0x8A }); // Move r/m8 to R8 + private static readonly LegacyOpCode M_C_16 = new LegacyOpCode(new byte[] { 0x66, 0xC7 }); + private static readonly LegacyOpCode SEG_RM = new LegacyOpCode(new byte[] { 0x8E }); // Move r/m to seg + private static readonly LegacyOpCode RM_SEG = new LegacyOpCode(new byte[] { 0x8C }); // Move seg to r/m #endregion Data Members @@ -48,7 +48,7 @@ public Mov() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.Register is SegmentRegister) { @@ -93,9 +93,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, node.Operand1, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, node.Operand1, null); emitter.Emit(opCode, node.Result, node.Operand1); } diff --git a/Source/Mosa.Platform.x86/Instructions/MovAPS.cs b/Source/Mosa.Platform.x86/Instructions/MovAPS.cs index 652ebf3ddf..defe109d22 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovAPS.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovAPS.cs @@ -12,8 +12,8 @@ public sealed class Movaps : X86Instruction { #region Data Members - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x0F, 0x28 }); - private static readonly OpCode RM_R = new OpCode(new byte[] { 0x0F, 0x29 }); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x0F, 0x28 }); + private static readonly LegacyOpCode RM_R = new LegacyOpCode(new byte[] { 0x0F, 0x29 }); #endregion Data Members @@ -38,7 +38,7 @@ public Movaps() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/MovCR.cs b/Source/Mosa.Platform.x86/Instructions/MovCR.cs index 72bfc30932..885e27c557 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovCR.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovCR.cs @@ -12,15 +12,15 @@ public sealed class MovCR : X86Instruction { #region Data Members - private static readonly OpCode R_CR = new OpCode(new byte[] { 0x0F, 0x20 }); - private static readonly OpCode CR_R = new OpCode(new byte[] { 0x0F, 0x22 }); + private static readonly LegacyOpCode R_CR = new LegacyOpCode(new byte[] { 0x0F, 0x20 }); + private static readonly LegacyOpCode CR_R = new LegacyOpCode(new byte[] { 0x0F, 0x22 }); #endregion Data Members #region Construction /// - /// Initializes a new instance of . + /// Initializes a new instance of . /// public MovCR() : base(1, 1) @@ -38,7 +38,7 @@ public MovCR() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.Register is ControlRegister) return CR_R; if (source.Register is ControlRegister) return R_CR; @@ -51,9 +51,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, node.Operand1, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, node.Operand1, null); if (node.Result.Register is ControlRegister) { diff --git a/Source/Mosa.Platform.x86/Instructions/MovLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovLoad.cs index b5a1a8e1ea..6aaaa5c1de 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,7 +36,7 @@ public MovLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { if (node.Operand1.IsConstant && node.Result.IsCPURegister) { @@ -49,7 +48,7 @@ protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) } } - private static void MovMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); @@ -70,7 +69,7 @@ private static void MovMemoryToReg(InstructionNode node, MachineCodeEmitter emit emitter.Emit(opcode); } - private static void MovFixedMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovFixedMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsLinkerResolved); diff --git a/Source/Mosa.Platform.x86/Instructions/MovStore.cs b/Source/Mosa.Platform.x86/Instructions/MovStore.cs index a57cd43431..f007c6f3c6 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovStore.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovStore.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,7 +36,7 @@ public MovStore() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.ResultCount == 0); @@ -59,7 +58,7 @@ protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) } } - private static void MovImmediateToMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovImmediateToMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsConstant); @@ -81,7 +80,7 @@ private static void MovImmediateToMemory(InstructionNode node, MachineCodeEmitte emitter.Emit(opcode); } - private static void MovImmediateToFixedMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovImmediateToFixedMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand1.IsConstant); Debug.Assert(node.Operand2.IsResolvedConstant); @@ -116,7 +115,7 @@ private static void MovImmediateToFixedMemory(InstructionNode node, MachineCodeE emitter.Emit(opcode); } - private static void MovRegToFixedMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovRegToFixedMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsCPURegister); Debug.Assert(!node.Operand3.IsConstant); @@ -144,7 +143,7 @@ private static void MovRegToFixedMemory(InstructionNode node, MachineCodeEmitter emitter.Emit(opcode); } - private static void MovRegToMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovRegToMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsCPURegister); Debug.Assert(!node.Operand3.IsConstant); diff --git a/Source/Mosa.Platform.x86/Instructions/MovUPS.cs b/Source/Mosa.Platform.x86/Instructions/MovUPS.cs index 6d46ca5d8b..131882e8f9 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovUPS.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovUPS.cs @@ -12,8 +12,8 @@ public sealed class Movups : X86Instruction { #region Data Members - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x0F, 0x10 }); - private static readonly OpCode RM_R = new OpCode(new byte[] { 0x0F, 0x11 }); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x0F, 0x10 }); + private static readonly LegacyOpCode RM_R = new LegacyOpCode(new byte[] { 0x0F, 0x11 }); #endregion Data Members @@ -38,7 +38,7 @@ public Movups() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/MovapsLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovapsLoad.cs index 660b1289d6..3d4d437b41 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovapsLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovapsLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovapsLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovapsMemoryToReg(node, emitter); } - private static void MovapsMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovapsMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Movd.cs b/Source/Mosa.Platform.x86/Instructions/Movd.cs index c447a4bf50..46a67efdb2 100644 --- a/Source/Mosa.Platform.x86/Instructions/Movd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Movd.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -26,7 +25,7 @@ public Movd() : #region Methods - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Movsd.cs b/Source/Mosa.Platform.x86/Instructions/Movsd.cs index 25c7a1e817..69c8f77ddf 100644 --- a/Source/Mosa.Platform.x86/Instructions/Movsd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Movsd.cs @@ -12,8 +12,8 @@ public sealed class Movsd : X86Instruction { #region Data Members - private static readonly OpCode R_RM = new OpCode(new byte[] { 0xF2, 0x0F, 0x10 }); - private static readonly OpCode RM_R = new OpCode(new byte[] { 0xF2, 0x0F, 0x11 }); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x10 }); + private static readonly LegacyOpCode RM_R = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x11 }); #endregion Data Members @@ -38,7 +38,7 @@ public Movsd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/MovsdLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovsdLoad.cs index 534dfb86a0..e8672d2cae 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovsdLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovsdLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovsdLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovsdMemoryToReg(node, emitter); } - private static void MovsdMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovsdMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovsdStore.cs b/Source/Mosa.Platform.x86/Instructions/MovsdStore.cs index 767c94ded4..3a51bc6f62 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovsdStore.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovsdStore.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovsdStore() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovsdRegToMemory(node, emitter); } - private static void MovsdRegToMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovsdRegToMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsCPURegister); Debug.Assert(node.ResultCount == 0); diff --git a/Source/Mosa.Platform.x86/Instructions/Movss.cs b/Source/Mosa.Platform.x86/Instructions/Movss.cs index ef4252432c..9bb70d167a 100644 --- a/Source/Mosa.Platform.x86/Instructions/Movss.cs +++ b/Source/Mosa.Platform.x86/Instructions/Movss.cs @@ -12,8 +12,8 @@ public sealed class Movss : X86Instruction { #region Data Members - private static readonly OpCode R = new OpCode(new byte[] { 0xF3, 0x0F, 0x10 }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0xF3, 0x0F, 0x11 }); + private static readonly LegacyOpCode R = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x10 }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x11 }); #endregion Data Members @@ -38,7 +38,7 @@ public Movss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if ((destination.IsCPURegister) && (source.IsCPURegister)) return R; diff --git a/Source/Mosa.Platform.x86/Instructions/MovssLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovssLoad.cs index ee42160a59..8f5a29a181 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovssLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovssLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovssLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovssMemoryToReg(node, emitter); } - private static void MovssMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovssMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovssStore.cs b/Source/Mosa.Platform.x86/Instructions/MovssStore.cs index 5ace14ce30..8f46146006 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovssStore.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovssStore.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovssStore() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovssRegToMemory(node, emitter); } - private static void MovssRegToMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovssRegToMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsCPURegister); Debug.Assert(node.ResultCount == 0); diff --git a/Source/Mosa.Platform.x86/Instructions/Movsx.cs b/Source/Mosa.Platform.x86/Instructions/Movsx.cs index c002a0c84f..7cc9732c78 100644 --- a/Source/Mosa.Platform.x86/Instructions/Movsx.cs +++ b/Source/Mosa.Platform.x86/Instructions/Movsx.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public Movsx() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovsxRegToReg(node, emitter); } - private static void MovsxRegToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovsxRegToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovsxLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovsxLoad.cs index 5f93110673..27d63c9c30 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovsxLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovsxLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovsxLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovsxMemoryToReg(node, emitter); } - private static void MovsxMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovsxMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovupsLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovupsLoad.cs index 60f23a55f6..3cdd725681 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovupsLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovupsLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovupsLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovupsMemoryToReg(node, emitter); } - private static void MovupsMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovupsMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovupsStore.cs b/Source/Mosa.Platform.x86/Instructions/MovupsStore.cs index de1998ffd1..effffb30a5 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovupsStore.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovupsStore.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovupsStore() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovupsRegToMemory(node, emitter); } - private static void MovupsRegToMemory(InstructionNode node, MachineCodeEmitter emitter) + private static void MovupsRegToMemory(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Operand3.IsCPURegister); Debug.Assert(node.ResultCount == 0); diff --git a/Source/Mosa.Platform.x86/Instructions/Movzx.cs b/Source/Mosa.Platform.x86/Instructions/Movzx.cs index 71e76be35b..84793a0f0b 100644 --- a/Source/Mosa.Platform.x86/Instructions/Movzx.cs +++ b/Source/Mosa.Platform.x86/Instructions/Movzx.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -31,12 +30,12 @@ public Movzx() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovzxRegToReg(node, emitter); } - private static void MovzxRegToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovzxRegToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/MovzxLoad.cs b/Source/Mosa.Platform.x86/Instructions/MovzxLoad.cs index 071a4dd9a2..0ed356a252 100644 --- a/Source/Mosa.Platform.x86/Instructions/MovzxLoad.cs +++ b/Source/Mosa.Platform.x86/Instructions/MovzxLoad.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -37,12 +36,12 @@ public MovzxLoad() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { MovzxMemoryToReg(node, emitter); } - private static void MovzxMemoryToReg(InstructionNode node, MachineCodeEmitter emitter) + private static void MovzxMemoryToReg(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Mul.cs b/Source/Mosa.Platform.x86/Instructions/Mul.cs index 4040219090..7b753769cf 100644 --- a/Source/Mosa.Platform.x86/Instructions/Mul.cs +++ b/Source/Mosa.Platform.x86/Instructions/Mul.cs @@ -11,7 +11,7 @@ public sealed class Mul : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF7 }, 4); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF7 }, 4); #endregion Data Members @@ -34,7 +34,7 @@ public Mul() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.Emit(opcode, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/MulSD.cs b/Source/Mosa.Platform.x86/Instructions/MulSD.cs index 789a162abf..23b8a5ee69 100644 --- a/Source/Mosa.Platform.x86/Instructions/MulSD.cs +++ b/Source/Mosa.Platform.x86/Instructions/MulSD.cs @@ -11,7 +11,7 @@ public sealed class Mulsd : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x59 }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x59 }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Mulsd : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/MulSS.cs b/Source/Mosa.Platform.x86/Instructions/MulSS.cs index c3e4eef5b0..78cc70c3f6 100644 --- a/Source/Mosa.Platform.x86/Instructions/MulSS.cs +++ b/Source/Mosa.Platform.x86/Instructions/MulSS.cs @@ -11,7 +11,7 @@ public sealed class Mulss : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x59 }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x59 }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Mulss : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Neg.cs b/Source/Mosa.Platform.x86/Instructions/Neg.cs index 5407cb3d0f..78e228db49 100644 --- a/Source/Mosa.Platform.x86/Instructions/Neg.cs +++ b/Source/Mosa.Platform.x86/Instructions/Neg.cs @@ -12,7 +12,7 @@ public sealed class Neg : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF7 }, 3); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF7 }, 3); #endregion Data Members @@ -37,7 +37,7 @@ public Neg() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) return opcode; @@ -49,9 +49,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, null, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, null, null); emitter.Emit(opCode, node.Result); } diff --git a/Source/Mosa.Platform.x86/Instructions/Nop.cs b/Source/Mosa.Platform.x86/Instructions/Nop.cs index 0b15c72b02..3a2948f3a0 100644 --- a/Source/Mosa.Platform.x86/Instructions/Nop.cs +++ b/Source/Mosa.Platform.x86/Instructions/Nop.cs @@ -28,7 +28,7 @@ public Nop() /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0x90); } diff --git a/Source/Mosa.Platform.x86/Instructions/Not.cs b/Source/Mosa.Platform.x86/Instructions/Not.cs index 9ec44a9562..2f27f13cb5 100644 --- a/Source/Mosa.Platform.x86/Instructions/Not.cs +++ b/Source/Mosa.Platform.x86/Instructions/Not.cs @@ -12,9 +12,9 @@ public sealed class Not : X86Instruction { #region Data Members - private static readonly OpCode MR_8 = new OpCode(new byte[] { 0xF6 }, 2); - private static readonly OpCode MR_16 = new OpCode(new byte[] { 0x66, 0xF7 }, 2); - private static readonly OpCode MR = new OpCode(new byte[] { 0xF7 }, 2); + private static readonly LegacyOpCode MR_8 = new LegacyOpCode(new byte[] { 0xF6 }, 2); + private static readonly LegacyOpCode MR_16 = new LegacyOpCode(new byte[] { 0x66, 0xF7 }, 2); + private static readonly LegacyOpCode MR = new LegacyOpCode(new byte[] { 0xF7 }, 2); #endregion Data Members @@ -39,7 +39,7 @@ public Not() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) { @@ -56,9 +56,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, null, null); + LegacyOpCode opCode = ComputeOpCode(node.Result, null, null); emitter.Emit(opCode, node.Result); } diff --git a/Source/Mosa.Platform.x86/Instructions/Or.cs b/Source/Mosa.Platform.x86/Instructions/Or.cs index 60c9c28995..3a9c16a5fb 100644 --- a/Source/Mosa.Platform.x86/Instructions/Or.cs +++ b/Source/Mosa.Platform.x86/Instructions/Or.cs @@ -12,11 +12,11 @@ public sealed class Or : TwoOperandInstruction { #region Data Members - private static readonly OpCode R_C = new OpCode(new byte[] { 0x81 }, 1); - private static readonly OpCode M_C = new OpCode(new byte[] { 0x81 }, 1); - private static readonly OpCode R_M = new OpCode(new byte[] { 0x0B }); - private static readonly OpCode R_R = new OpCode(new byte[] { 0x0B }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x09 }); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0x81 }, 1); + private static readonly LegacyOpCode M_C = new LegacyOpCode(new byte[] { 0x81 }, 1); + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x0B }); + private static readonly LegacyOpCode R_R = new LegacyOpCode(new byte[] { 0x0B }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x09 }); #endregion Data Members @@ -29,7 +29,7 @@ public sealed class Or : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && third.IsConstant) return R_C; if (destination.IsCPURegister && third.IsCPURegister) return R_R; diff --git a/Source/Mosa.Platform.x86/Instructions/Out.cs b/Source/Mosa.Platform.x86/Instructions/Out.cs index cdf03f6694..e12416b2b3 100644 --- a/Source/Mosa.Platform.x86/Instructions/Out.cs +++ b/Source/Mosa.Platform.x86/Instructions/Out.cs @@ -13,11 +13,11 @@ public sealed class Out : X86Instruction { #region Data Members - private static readonly OpCode R_8 = new OpCode(new byte[] { 0xEE }); - private static readonly OpCode R_32 = new OpCode(new byte[] { 0xEF }); + private static readonly LegacyOpCode R_8 = new LegacyOpCode(new byte[] { 0xEE }); + private static readonly LegacyOpCode R_32 = new LegacyOpCode(new byte[] { 0xEF }); - private static readonly OpCode C_8 = new OpCode(new byte[] { 0xE6 }); - private static readonly OpCode C_32 = new OpCode(new byte[] { 0xE7 }); + private static readonly LegacyOpCode C_8 = new LegacyOpCode(new byte[] { 0xE6 }); + private static readonly LegacyOpCode C_32 = new LegacyOpCode(new byte[] { 0xE7 }); #endregion Data Members @@ -39,7 +39,7 @@ public Out() : /// The source operand. /// /// - private OpCode ComputeOpCode(InstructionSize size, Operand destination, Operand source) + private LegacyOpCode ComputeOpCode(InstructionSize size, Operand destination, Operand source) { Debug.Assert(destination.IsConstant || destination.IsCPURegister); Debug.Assert(size != InstructionSize.None); @@ -71,7 +71,7 @@ private OpCode ComputeOpCode(InstructionSize size, Operand destination, Operand /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { var opCode = ComputeOpCode(node.Size, node.Operand1, node.Operand2); diff --git a/Source/Mosa.Platform.x86/Instructions/PXor.cs b/Source/Mosa.Platform.x86/Instructions/PXor.cs index 7df48cda04..219ced13c2 100644 --- a/Source/Mosa.Platform.x86/Instructions/PXor.cs +++ b/Source/Mosa.Platform.x86/Instructions/PXor.cs @@ -12,7 +12,7 @@ public sealed class PXor : TwoOperandInstruction { #region Data Members - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x66, 0x0F, 0xEF }); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x66, 0x0F, 0xEF }); #endregion Data Members @@ -25,7 +25,7 @@ public sealed class PXor : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/Pause.cs b/Source/Mosa.Platform.x86/Instructions/Pause.cs index 5fa8851eaf..be84a8aa88 100644 --- a/Source/Mosa.Platform.x86/Instructions/Pause.cs +++ b/Source/Mosa.Platform.x86/Instructions/Pause.cs @@ -28,7 +28,7 @@ public Pause() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xF3); emitter.WriteByte(0x90); diff --git a/Source/Mosa.Platform.x86/Instructions/Pextrd.cs b/Source/Mosa.Platform.x86/Instructions/Pextrd.cs index 9c6690ddf9..dc906e4a37 100644 --- a/Source/Mosa.Platform.x86/Instructions/Pextrd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Pextrd.cs @@ -2,7 +2,6 @@ using Mosa.Compiler.Common; using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; using System.Diagnostics; namespace Mosa.Platform.x86.Instructions @@ -32,7 +31,7 @@ public Pextrd() : #region Methods - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { Debug.Assert(node.Result.IsCPURegister); Debug.Assert(node.Operand1.IsCPURegister); diff --git a/Source/Mosa.Platform.x86/Instructions/Pop.cs b/Source/Mosa.Platform.x86/Instructions/Pop.cs index 582e58b8bd..2ab1750a5d 100644 --- a/Source/Mosa.Platform.x86/Instructions/Pop.cs +++ b/Source/Mosa.Platform.x86/Instructions/Pop.cs @@ -12,12 +12,12 @@ public sealed class Pop : X86Instruction { #region Data Members - private static readonly OpCode POP = new OpCode(new byte[] { 0x8F }, 0); - private static readonly OpCode POP_DS = new OpCode(new byte[] { 0x1F }); - private static readonly OpCode POP_ES = new OpCode(new byte[] { 0x07 }); - private static readonly OpCode POP_FS = new OpCode(new byte[] { 0x17 }); - private static readonly OpCode POP_GS = new OpCode(new byte[] { 0x0F, 0xA1 }); - private static readonly OpCode POP_SS = new OpCode(new byte[] { 0x0F, 0xA9 }); + private static readonly LegacyOpCode POP = new LegacyOpCode(new byte[] { 0x8F }, 0); + private static readonly LegacyOpCode POP_DS = new LegacyOpCode(new byte[] { 0x1F }); + private static readonly LegacyOpCode POP_ES = new LegacyOpCode(new byte[] { 0x07 }); + private static readonly LegacyOpCode POP_FS = new LegacyOpCode(new byte[] { 0x17 }); + private static readonly LegacyOpCode POP_GS = new LegacyOpCode(new byte[] { 0x0F, 0xA1 }); + private static readonly LegacyOpCode POP_SS = new LegacyOpCode(new byte[] { 0x0F, 0xA9 }); #endregion Data Members @@ -41,7 +41,7 @@ public Pop() /// The node. /// The emitter. /// @unable to emit opcode for segment register - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Result.IsCPURegister) { diff --git a/Source/Mosa.Platform.x86/Instructions/Popad.cs b/Source/Mosa.Platform.x86/Instructions/Popad.cs index faf7b91f25..bf1ae42235 100644 --- a/Source/Mosa.Platform.x86/Instructions/Popad.cs +++ b/Source/Mosa.Platform.x86/Instructions/Popad.cs @@ -28,7 +28,7 @@ public Popad() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0x61); } diff --git a/Source/Mosa.Platform.x86/Instructions/Popfd.cs b/Source/Mosa.Platform.x86/Instructions/Popfd.cs index 6ebc5ae9b9..aaf4267abb 100644 --- a/Source/Mosa.Platform.x86/Instructions/Popfd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Popfd.cs @@ -11,7 +11,7 @@ public sealed class Popfd : X86Instruction { #region Data members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x9D }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x9D }); #endregion Data members @@ -36,7 +36,7 @@ public Popfd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Push.cs b/Source/Mosa.Platform.x86/Instructions/Push.cs index 1aaf1b6518..5884842f54 100644 --- a/Source/Mosa.Platform.x86/Instructions/Push.cs +++ b/Source/Mosa.Platform.x86/Instructions/Push.cs @@ -12,16 +12,16 @@ public sealed class Push : X86Instruction { #region Data Members - private static readonly OpCode PUSH = new OpCode(new byte[] { 0xFF }, 6); - private static readonly OpCode CONST8 = new OpCode(new byte[] { 0x6A }); - private static readonly OpCode CONST16 = new OpCode(new byte[] { 0x66, 0x68 }); - private static readonly OpCode CONST32 = new OpCode(new byte[] { 0x68 }); - private static readonly OpCode PUSH_CS = new OpCode(new byte[] { 0x0E }); - private static readonly OpCode PUSH_SS = new OpCode(new byte[] { 0x16 }); - private static readonly OpCode PUSH_DS = new OpCode(new byte[] { 0x1E }); - private static readonly OpCode PUSH_ES = new OpCode(new byte[] { 0x06 }); - private static readonly OpCode PUSH_FS = new OpCode(new byte[] { 0x0F, 0xA0 }); - private static readonly OpCode PUSH_GS = new OpCode(new byte[] { 0x0F, 0xA8 }); + private static readonly LegacyOpCode PUSH = new LegacyOpCode(new byte[] { 0xFF }, 6); + private static readonly LegacyOpCode CONST8 = new LegacyOpCode(new byte[] { 0x6A }); + private static readonly LegacyOpCode CONST16 = new LegacyOpCode(new byte[] { 0x66, 0x68 }); + private static readonly LegacyOpCode CONST32 = new LegacyOpCode(new byte[] { 0x68 }); + private static readonly LegacyOpCode PUSH_CS = new LegacyOpCode(new byte[] { 0x0E }); + private static readonly LegacyOpCode PUSH_SS = new LegacyOpCode(new byte[] { 0x16 }); + private static readonly LegacyOpCode PUSH_DS = new LegacyOpCode(new byte[] { 0x1E }); + private static readonly LegacyOpCode PUSH_ES = new LegacyOpCode(new byte[] { 0x06 }); + private static readonly LegacyOpCode PUSH_FS = new LegacyOpCode(new byte[] { 0x0F, 0xA0 }); + private static readonly LegacyOpCode PUSH_GS = new LegacyOpCode(new byte[] { 0x0F, 0xA8 }); #endregion Data Members @@ -45,7 +45,7 @@ public Push() : /// The node. /// The emitter. /// @unable to emit opcode for segment register - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand1.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Pushad.cs b/Source/Mosa.Platform.x86/Instructions/Pushad.cs index 3cc5a434ef..415099fd2c 100644 --- a/Source/Mosa.Platform.x86/Instructions/Pushad.cs +++ b/Source/Mosa.Platform.x86/Instructions/Pushad.cs @@ -28,7 +28,7 @@ public Pushad() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0x60); } diff --git a/Source/Mosa.Platform.x86/Instructions/Pushfd.cs b/Source/Mosa.Platform.x86/Instructions/Pushfd.cs index 1211db87bd..098efe59ac 100644 --- a/Source/Mosa.Platform.x86/Instructions/Pushfd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Pushfd.cs @@ -11,7 +11,7 @@ public sealed class Pushfd : X86Instruction { #region Data members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x9C }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x9C }); #endregion Data members @@ -36,7 +36,7 @@ public Pushfd() : /// /// /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Rcr.cs b/Source/Mosa.Platform.x86/Instructions/Rcr.cs index 2540067fe7..cd2d1dbe6f 100644 --- a/Source/Mosa.Platform.x86/Instructions/Rcr.cs +++ b/Source/Mosa.Platform.x86/Instructions/Rcr.cs @@ -11,9 +11,9 @@ public sealed class Rcr : X86Instruction { #region Data Members - private static readonly OpCode C = new OpCode(new byte[] { 0xC1 }, 3); - private static readonly OpCode C1 = new OpCode(new byte[] { 0xD1 }, 3); - private static readonly OpCode RM = new OpCode(new byte[] { 0xD3 }, 3); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0xC1 }, 3); + private static readonly LegacyOpCode C1 = new LegacyOpCode(new byte[] { 0xD1 }, 3); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0xD3 }, 3); #endregion Data Members @@ -36,7 +36,7 @@ public Rcr() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand2.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Rep.cs b/Source/Mosa.Platform.x86/Instructions/Rep.cs index 0d2228a7f5..78ac32410f 100644 --- a/Source/Mosa.Platform.x86/Instructions/Rep.cs +++ b/Source/Mosa.Platform.x86/Instructions/Rep.cs @@ -28,7 +28,7 @@ public Rep() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xF3); } diff --git a/Source/Mosa.Platform.x86/Instructions/Ret.cs b/Source/Mosa.Platform.x86/Instructions/Ret.cs index b4458d11c6..35617da16e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Ret.cs +++ b/Source/Mosa.Platform.x86/Instructions/Ret.cs @@ -38,7 +38,7 @@ public Ret() /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xC3); } diff --git a/Source/Mosa.Platform.x86/Instructions/RoundSD.cs b/Source/Mosa.Platform.x86/Instructions/RoundSD.cs index 2a6df46a24..e276b99cd2 100644 --- a/Source/Mosa.Platform.x86/Instructions/RoundSD.cs +++ b/Source/Mosa.Platform.x86/Instructions/RoundSD.cs @@ -9,7 +9,7 @@ namespace Mosa.Platform.x86.Instructions /// public class Roundsd : X86Instruction { - private static readonly OpCode opcode = new OpCode(new byte[] { 0x66, 0x0F, 0x3A, 0x0B }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x66, 0x0F, 0x3A, 0x0B }); #region Construction @@ -30,7 +30,7 @@ public Roundsd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/RoundSS.cs b/Source/Mosa.Platform.x86/Instructions/RoundSS.cs index 00991504ab..78ccb3dbf3 100644 --- a/Source/Mosa.Platform.x86/Instructions/RoundSS.cs +++ b/Source/Mosa.Platform.x86/Instructions/RoundSS.cs @@ -21,7 +21,7 @@ public Roundss() : #endregion Construction - private static readonly OpCode opcode = new OpCode(new byte[] { 0x66, 0x0F, 0x3A, 0x0A }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x66, 0x0F, 0x3A, 0x0A }); /// /// Computes the opcode. @@ -30,7 +30,7 @@ public Roundss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Sar.cs b/Source/Mosa.Platform.x86/Instructions/Sar.cs index 43e3194f05..705334a34b 100644 --- a/Source/Mosa.Platform.x86/Instructions/Sar.cs +++ b/Source/Mosa.Platform.x86/Instructions/Sar.cs @@ -11,9 +11,9 @@ public sealed class Sar : X86Instruction { #region Data Members - private static readonly OpCode C = new OpCode(new byte[] { 0xC1 }, 7); - private static readonly OpCode C1 = new OpCode(new byte[] { 0xD1 }, 7); - private static readonly OpCode RM = new OpCode(new byte[] { 0xD3 }, 7); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0xC1 }, 7); + private static readonly LegacyOpCode C1 = new LegacyOpCode(new byte[] { 0xD1 }, 7); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0xD3 }, 7); #endregion Data Members @@ -36,7 +36,7 @@ public Sar() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand2.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Sbb.cs b/Source/Mosa.Platform.x86/Instructions/Sbb.cs index 74cf977540..230aa55556 100644 --- a/Source/Mosa.Platform.x86/Instructions/Sbb.cs +++ b/Source/Mosa.Platform.x86/Instructions/Sbb.cs @@ -12,9 +12,9 @@ public sealed class Sbb : TwoOperandInstruction { #region Data Members - private static readonly OpCode RM_C = new OpCode(new byte[] { 0x81 }, 3); - private static readonly OpCode R_RM = new OpCode(new byte[] { 0x1B }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x19 }); + private static readonly LegacyOpCode RM_C = new LegacyOpCode(new byte[] { 0x81 }, 3); + private static readonly LegacyOpCode R_RM = new LegacyOpCode(new byte[] { 0x1B }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x19 }); #endregion Data Members @@ -28,7 +28,7 @@ public sealed class Sbb : TwoOperandInstruction /// The third operand. /// /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && third.IsConstant) return RM_C; if (destination.IsCPURegister && third.IsCPURegister) return R_RM; diff --git a/Source/Mosa.Platform.x86/Instructions/Setcc.cs b/Source/Mosa.Platform.x86/Instructions/Setcc.cs index c5c2094a37..427b39c31f 100644 --- a/Source/Mosa.Platform.x86/Instructions/Setcc.cs +++ b/Source/Mosa.Platform.x86/Instructions/Setcc.cs @@ -12,22 +12,22 @@ public sealed class Setcc : X86Instruction { #region Data Members - private static readonly OpCode E = new OpCode(new byte[] { 0x0F, 0x94 }); - private static readonly OpCode LT = new OpCode(new byte[] { 0x0F, 0x9C }); - private static readonly OpCode LE = new OpCode(new byte[] { 0x0F, 0x9E }); - private static readonly OpCode GE = new OpCode(new byte[] { 0x0F, 0x9D }); - private static readonly OpCode GT = new OpCode(new byte[] { 0x0F, 0x9F }); - private static readonly OpCode NE = new OpCode(new byte[] { 0x0F, 0x95 }); - private static readonly OpCode UGE = new OpCode(new byte[] { 0x0F, 0x93 }); // SETAE, SETNB, SETNC - private static readonly OpCode UGT = new OpCode(new byte[] { 0x0F, 0x97 }); // SETNBE, SETA - private static readonly OpCode ULE = new OpCode(new byte[] { 0x0F, 0x96 }); // SETBE, SETNA - private static readonly OpCode ULT = new OpCode(new byte[] { 0x0F, 0x92 }); // SETNAE, SETB, SETC - private static readonly OpCode P = new OpCode(new byte[] { 0x0F, 0x9A }); - private static readonly OpCode NP = new OpCode(new byte[] { 0x0F, 0x9B }); - private static readonly OpCode NC = new OpCode(new byte[] { 0x0F, 0x93 }); - private static readonly OpCode C = new OpCode(new byte[] { 0x0F, 0x92 }); - private static readonly OpCode Z = new OpCode(new byte[] { 0x0F, 0x94 }); - private static readonly OpCode NZ = new OpCode(new byte[] { 0x0F, 0x95 }); + private static readonly LegacyOpCode E = new LegacyOpCode(new byte[] { 0x0F, 0x94 }); + private static readonly LegacyOpCode LT = new LegacyOpCode(new byte[] { 0x0F, 0x9C }); + private static readonly LegacyOpCode LE = new LegacyOpCode(new byte[] { 0x0F, 0x9E }); + private static readonly LegacyOpCode GE = new LegacyOpCode(new byte[] { 0x0F, 0x9D }); + private static readonly LegacyOpCode GT = new LegacyOpCode(new byte[] { 0x0F, 0x9F }); + private static readonly LegacyOpCode NE = new LegacyOpCode(new byte[] { 0x0F, 0x95 }); + private static readonly LegacyOpCode UGE = new LegacyOpCode(new byte[] { 0x0F, 0x93 }); // SETAE, SETNB, SETNC + private static readonly LegacyOpCode UGT = new LegacyOpCode(new byte[] { 0x0F, 0x97 }); // SETNBE, SETA + private static readonly LegacyOpCode ULE = new LegacyOpCode(new byte[] { 0x0F, 0x96 }); // SETBE, SETNA + private static readonly LegacyOpCode ULT = new LegacyOpCode(new byte[] { 0x0F, 0x92 }); // SETNAE, SETB, SETC + private static readonly LegacyOpCode P = new LegacyOpCode(new byte[] { 0x0F, 0x9A }); + private static readonly LegacyOpCode NP = new LegacyOpCode(new byte[] { 0x0F, 0x9B }); + private static readonly LegacyOpCode NC = new LegacyOpCode(new byte[] { 0x0F, 0x93 }); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0x0F, 0x92 }); + private static readonly LegacyOpCode Z = new LegacyOpCode(new byte[] { 0x0F, 0x94 }); + private static readonly LegacyOpCode NZ = new LegacyOpCode(new byte[] { 0x0F, 0x95 }); #endregion Data Members @@ -51,9 +51,9 @@ public Setcc() /// The node. /// The emitter. /// - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opcode; + LegacyOpCode opcode; switch (node.ConditionCode) { diff --git a/Source/Mosa.Platform.x86/Instructions/Shl.cs b/Source/Mosa.Platform.x86/Instructions/Shl.cs index 8193cbea43..8d0e6a73f9 100644 --- a/Source/Mosa.Platform.x86/Instructions/Shl.cs +++ b/Source/Mosa.Platform.x86/Instructions/Shl.cs @@ -12,9 +12,9 @@ public sealed class Shl : X86Instruction { #region Data Members - private static readonly OpCode C = new OpCode(new byte[] { 0xC1 }, 4); - private static readonly OpCode C1 = new OpCode(new byte[] { 0xD1 }, 4); - private static readonly OpCode RM = new OpCode(new byte[] { 0xD3 }, 4); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0xC1 }, 4); + private static readonly LegacyOpCode C1 = new LegacyOpCode(new byte[] { 0xD1 }, 4); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0xD3 }, 4); #endregion Data Members @@ -40,7 +40,7 @@ public Shl() : /// The third operand. /// /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { throw new NotSupportedException(); } @@ -50,7 +50,7 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand2.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Shld.cs b/Source/Mosa.Platform.x86/Instructions/Shld.cs index 551366e954..65cd9c77a0 100644 --- a/Source/Mosa.Platform.x86/Instructions/Shld.cs +++ b/Source/Mosa.Platform.x86/Instructions/Shld.cs @@ -12,8 +12,8 @@ public class Shld : X86Instruction { #region Data Members - private static readonly OpCode RM = new OpCode(new byte[] { 0x0F, 0xA5 }); - private static readonly OpCode C = new OpCode(new byte[] { 0x0F, 0xA4 }); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0x0F, 0xA5 }); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0x0F, 0xA4 }); #endregion Data Members @@ -38,7 +38,7 @@ public Shld() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { throw new NotSupportedException(); } @@ -48,7 +48,7 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand3.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Shr.cs b/Source/Mosa.Platform.x86/Instructions/Shr.cs index 59d09710f5..fecca8377b 100644 --- a/Source/Mosa.Platform.x86/Instructions/Shr.cs +++ b/Source/Mosa.Platform.x86/Instructions/Shr.cs @@ -12,9 +12,9 @@ public sealed class Shr : X86Instruction { #region Data Members - private static readonly OpCode C = new OpCode(new byte[] { 0xC1 }, 5); - private static readonly OpCode C1 = new OpCode(new byte[] { 0xD1 }, 5); - private static readonly OpCode RM = new OpCode(new byte[] { 0xD3 }, 5); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0xC1 }, 5); + private static readonly LegacyOpCode C1 = new LegacyOpCode(new byte[] { 0xD1 }, 5); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0xD3 }, 5); #endregion Data Members @@ -40,7 +40,7 @@ public Shr() : /// The third operand. /// /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { throw new NotSupportedException(); } @@ -50,7 +50,7 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand2.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Shrd.cs b/Source/Mosa.Platform.x86/Instructions/Shrd.cs index e543392bbf..24a2abe373 100644 --- a/Source/Mosa.Platform.x86/Instructions/Shrd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Shrd.cs @@ -12,8 +12,8 @@ public class Shrd : X86Instruction { #region Data Members - private static readonly OpCode RM = new OpCode(new byte[] { 0x0F, 0xAD }, 4); - private static readonly OpCode C = new OpCode(new byte[] { 0x0F, 0xAC }, 4); + private static readonly LegacyOpCode RM = new LegacyOpCode(new byte[] { 0x0F, 0xAD }, 4); + private static readonly LegacyOpCode C = new LegacyOpCode(new byte[] { 0x0F, 0xAC }, 4); #endregion Data Members @@ -38,7 +38,7 @@ public Shrd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { throw new NotSupportedException(); } @@ -48,7 +48,7 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { if (node.Operand3.IsConstant) { diff --git a/Source/Mosa.Platform.x86/Instructions/Sti.cs b/Source/Mosa.Platform.x86/Instructions/Sti.cs index 5e5f15cd3f..2a90d8107e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Sti.cs +++ b/Source/Mosa.Platform.x86/Instructions/Sti.cs @@ -28,7 +28,7 @@ public Sti() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xFB); } diff --git a/Source/Mosa.Platform.x86/Instructions/Stos.cs b/Source/Mosa.Platform.x86/Instructions/Stos.cs index 0bacf2a0b6..d6c3b222a0 100644 --- a/Source/Mosa.Platform.x86/Instructions/Stos.cs +++ b/Source/Mosa.Platform.x86/Instructions/Stos.cs @@ -28,7 +28,7 @@ public Stos() : /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { emitter.WriteByte(0xAB); } diff --git a/Source/Mosa.Platform.x86/Instructions/Sub.cs b/Source/Mosa.Platform.x86/Instructions/Sub.cs index a514e394da..f47adb60cc 100644 --- a/Source/Mosa.Platform.x86/Instructions/Sub.cs +++ b/Source/Mosa.Platform.x86/Instructions/Sub.cs @@ -12,10 +12,10 @@ public sealed class Sub : TwoOperandInstruction { #region Data Members - private static readonly OpCode O_C = new OpCode(new byte[] { 0x81 }, 5); - private static readonly OpCode R_O = new OpCode(new byte[] { 0x2B }); - private static readonly OpCode R_O_16 = new OpCode(new byte[] { 0x66, 0x2B }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x29 }); + private static readonly LegacyOpCode O_C = new LegacyOpCode(new byte[] { 0x81 }, 5); + private static readonly LegacyOpCode R_O = new LegacyOpCode(new byte[] { 0x2B }); + private static readonly LegacyOpCode R_O_16 = new LegacyOpCode(new byte[] { 0x66, 0x2B }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x29 }); #endregion Data Members @@ -28,7 +28,7 @@ public sealed class Sub : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (third.IsConstant) return O_C; diff --git a/Source/Mosa.Platform.x86/Instructions/SubSD.cs b/Source/Mosa.Platform.x86/Instructions/SubSD.cs index 4b6924eb8a..d72058dc5e 100644 --- a/Source/Mosa.Platform.x86/Instructions/SubSD.cs +++ b/Source/Mosa.Platform.x86/Instructions/SubSD.cs @@ -11,7 +11,7 @@ public sealed class Subsd : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF2, 0x0F, 0x5C }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF2, 0x0F, 0x5C }); #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Subsd : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/SubSS.cs b/Source/Mosa.Platform.x86/Instructions/SubSS.cs index 4d29827ecd..2f885900ec 100644 --- a/Source/Mosa.Platform.x86/Instructions/SubSS.cs +++ b/Source/Mosa.Platform.x86/Instructions/SubSS.cs @@ -11,7 +11,7 @@ public sealed class Subss : TwoOperandInstruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0xF3, 0x0F, 0x5C }); // SUBSS + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0xF3, 0x0F, 0x5C }); // SUBSS #endregion Data Members @@ -24,7 +24,7 @@ public sealed class Subss : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { return opcode; } diff --git a/Source/Mosa.Platform.x86/Instructions/Test.cs b/Source/Mosa.Platform.x86/Instructions/Test.cs index a749c4f01b..a6fd76297e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Test.cs +++ b/Source/Mosa.Platform.x86/Instructions/Test.cs @@ -12,19 +12,19 @@ public sealed class Test : X86Instruction { #region Data Member - private static readonly OpCode M_R = new OpCode(new byte[] { 0x85 }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x85 }); //private static readonly OpCode R_M = new OpCode(new byte[] { 0x3B }); - private static readonly OpCode R_R = new OpCode(new byte[] { 0x85 }); + private static readonly LegacyOpCode R_R = new LegacyOpCode(new byte[] { 0x85 }); - private static readonly OpCode M_C = new OpCode(new byte[] { 0xF7 }, 0); - private static readonly OpCode R_C = new OpCode(new byte[] { 0xF7 }, 0); - private static readonly OpCode R_C_8 = new OpCode(new byte[] { 0xF6 }, 0); - private static readonly OpCode R_C_16 = new OpCode(new byte[] { 0x66, 0xF7 }, 0); - private static readonly OpCode M_R_8 = new OpCode(new byte[] { 0x84 }); + private static readonly LegacyOpCode M_C = new LegacyOpCode(new byte[] { 0xF7 }, 0); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0xF7 }, 0); + private static readonly LegacyOpCode R_C_8 = new LegacyOpCode(new byte[] { 0xF6 }, 0); + private static readonly LegacyOpCode R_C_16 = new LegacyOpCode(new byte[] { 0x66, 0xF7 }, 0); + private static readonly LegacyOpCode M_R_8 = new LegacyOpCode(new byte[] { 0x84 }); //private static readonly OpCode R_M_8 = new OpCode(new byte[] { 0x3A }); - private static readonly OpCode M_R_16 = new OpCode(new byte[] { 0x66, 0x85 }); + private static readonly LegacyOpCode M_R_16 = new LegacyOpCode(new byte[] { 0x66, 0x85 }); //private static readonly OpCode R_M_16 = new OpCode(new byte[] { 0x66, 0x3B }); @@ -51,7 +51,7 @@ public Test() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (source.IsCPURegister && third.IsCPURegister) return R_R; @@ -74,9 +74,9 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); + LegacyOpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Operand1, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/TwoOperandInstruction.cs b/Source/Mosa.Platform.x86/Instructions/TwoOperandInstruction.cs index f13c9bd22e..ff619d0d82 100644 --- a/Source/Mosa.Platform.x86/Instructions/TwoOperandInstruction.cs +++ b/Source/Mosa.Platform.x86/Instructions/TwoOperandInstruction.cs @@ -27,10 +27,10 @@ protected TwoOperandInstruction() : /// /// The context. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { Debug.Assert(node.Result == node.Operand1); - OpCode opCode = ComputeOpCode(node.Result, node.Operand1, node.Operand2); + LegacyOpCode opCode = ComputeOpCode(node.Result, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Result, node.Operand2); } } diff --git a/Source/Mosa.Platform.x86/Instructions/Ucomisd.cs b/Source/Mosa.Platform.x86/Instructions/Ucomisd.cs index 9da6548d36..725ebc5ba7 100644 --- a/Source/Mosa.Platform.x86/Instructions/Ucomisd.cs +++ b/Source/Mosa.Platform.x86/Instructions/Ucomisd.cs @@ -12,7 +12,7 @@ public class Ucomisd : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x66, 0x0F, 0x2E }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x66, 0x0F, 0x2E }); #endregion Data Members @@ -37,7 +37,7 @@ public Ucomisd() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { Debug.Assert(source.IsCPURegister); @@ -49,11 +49,11 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { Debug.Assert(node.Result == null); - OpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); + LegacyOpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Operand1, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/Ucomiss.cs b/Source/Mosa.Platform.x86/Instructions/Ucomiss.cs index e17a5e7cf2..3fa57e230e 100644 --- a/Source/Mosa.Platform.x86/Instructions/Ucomiss.cs +++ b/Source/Mosa.Platform.x86/Instructions/Ucomiss.cs @@ -12,7 +12,7 @@ public class Ucomiss : X86Instruction { #region Data Members - private static readonly OpCode opcode = new OpCode(new byte[] { 0x0F, 0x2E }); + private static readonly LegacyOpCode opcode = new LegacyOpCode(new byte[] { 0x0F, 0x2E }); #endregion Data Members @@ -37,7 +37,7 @@ public Ucomiss() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { Debug.Assert(source.IsCPURegister); @@ -49,11 +49,11 @@ protected override OpCode ComputeOpCode(Operand destination, Operand source, Ope /// /// The node. /// The emitter. - protected override void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal override void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { Debug.Assert(node.Result == null); - OpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); + LegacyOpCode opCode = ComputeOpCode(null, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Operand1, node.Operand2); } diff --git a/Source/Mosa.Platform.x86/Instructions/Xchg.cs b/Source/Mosa.Platform.x86/Instructions/Xchg.cs index 6ab0811701..b61a81bbcd 100644 --- a/Source/Mosa.Platform.x86/Instructions/Xchg.cs +++ b/Source/Mosa.Platform.x86/Instructions/Xchg.cs @@ -12,10 +12,10 @@ public sealed class Xchg : X86Instruction { #region Data Members - private static readonly OpCode R_M = new OpCode(new byte[] { 0x87 }); - private static readonly OpCode R_R = new OpCode(new byte[] { 0x87 }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x87 }); - private static readonly OpCode R_R_16 = new OpCode(new byte[] { 0x66, 0x87 }); + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x87 }); + private static readonly LegacyOpCode R_R = new LegacyOpCode(new byte[] { 0x87 }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x87 }); + private static readonly LegacyOpCode R_R_16 = new LegacyOpCode(new byte[] { 0x66, 0x87 }); #endregion Data Members @@ -40,7 +40,7 @@ public Xchg() : /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsShort && source.IsShort && destination.IsCPURegister && source.IsCPURegister) return R_R_16; if (destination.IsCPURegister && source.IsCPURegister) return R_R; diff --git a/Source/Mosa.Platform.x86/Instructions/Xor.cs b/Source/Mosa.Platform.x86/Instructions/Xor.cs index 73caa83b91..84f9cafbfd 100644 --- a/Source/Mosa.Platform.x86/Instructions/Xor.cs +++ b/Source/Mosa.Platform.x86/Instructions/Xor.cs @@ -12,11 +12,11 @@ public sealed class Xor : TwoOperandInstruction { #region Data Members - private static readonly OpCode R_C = new OpCode(new byte[] { 0x81 }, 6); - private static readonly OpCode R_M = new OpCode(new byte[] { 0x33 }); - private static readonly OpCode R_R = new OpCode(new byte[] { 0x33 }); - private static readonly OpCode M_R = new OpCode(new byte[] { 0x31 }); - private static readonly OpCode M_C = new OpCode(new byte[] { 0x81 }, 6); + private static readonly LegacyOpCode R_C = new LegacyOpCode(new byte[] { 0x81 }, 6); + private static readonly LegacyOpCode R_M = new LegacyOpCode(new byte[] { 0x33 }); + private static readonly LegacyOpCode R_R = new LegacyOpCode(new byte[] { 0x33 }); + private static readonly LegacyOpCode M_R = new LegacyOpCode(new byte[] { 0x31 }); + private static readonly LegacyOpCode M_C = new LegacyOpCode(new byte[] { 0x81 }, 6); #endregion Data Members @@ -29,7 +29,7 @@ public sealed class Xor : TwoOperandInstruction /// The source operand. /// The third operand. /// - protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third) + internal override LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) { if (destination.IsCPURegister && third.IsConstant) return R_C; if (destination.IsCPURegister && third.IsCPURegister) return R_R; diff --git a/Source/Mosa.Platform.x86/OpCode.cs b/Source/Mosa.Platform.x86/LegacyOpCode.cs similarity index 71% rename from Source/Mosa.Platform.x86/OpCode.cs rename to Source/Mosa.Platform.x86/LegacyOpCode.cs index 2a41642893..45116fe8cb 100644 --- a/Source/Mosa.Platform.x86/OpCode.cs +++ b/Source/Mosa.Platform.x86/LegacyOpCode.cs @@ -5,7 +5,7 @@ namespace Mosa.Platform.x86 /// /// x86 OpCode /// - public class OpCode + internal sealed class LegacyOpCode { /// /// Byte code @@ -18,21 +18,21 @@ public class OpCode internal byte? RegField; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The corresponding opcodes /// Additional parameter field - internal OpCode(byte[] code, byte? regField) + internal LegacyOpCode(byte[] code, byte? regField) { Code = code; RegField = regField; } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The corresponding opcodes - internal OpCode(byte[] code) + internal LegacyOpCode(byte[] code) { Code = code; RegField = null; diff --git a/Source/Mosa.Platform.x86/Mosa.Platform.x86.csproj b/Source/Mosa.Platform.x86/Mosa.Platform.x86.csproj index a92c386642..7810462bfc 100644 --- a/Source/Mosa.Platform.x86/Mosa.Platform.x86.csproj +++ b/Source/Mosa.Platform.x86/Mosa.Platform.x86.csproj @@ -211,7 +211,7 @@ - + @@ -277,7 +277,7 @@ - + @@ -295,7 +295,7 @@ Code - + diff --git a/Source/Mosa.Platform.x86/OpcodeEncoder.cs b/Source/Mosa.Platform.x86/OpcodeEncoder.cs new file mode 100644 index 0000000000..1874eca83e --- /dev/null +++ b/Source/Mosa.Platform.x86/OpcodeEncoder.cs @@ -0,0 +1,459 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using System.Diagnostics; +using System.IO; +using Mosa.Compiler.Common; +using Mosa.Compiler.Framework; +using Mosa.Compiler.Framework.Platform; + +namespace Mosa.Platform.x86 +{ + public sealed class OpcodeEncoder : BaseOpcodeEncoder + { + private ulong data1 = 0; + private ulong data2 = 0; + + public int Size { get; set; } + + public byte GetByte(int index) + { + if (index < 8) + { + int shift = 56 - (8 * index); + return (byte)((data1 >> shift) & 0xFF); + } + else + { + index = index - 8; + int shift = 56 - (8 * index); + return (byte)((data2 >> shift) & 0xFF); + } + } + + public override void WriteTo(Stream writer) + { + Debug.Assert(Size % 8 == 0); + + for (int i = 0; i < Size / 8; i++) + { + writer.WriteByte(GetByte(i)); + } + } + + public OpcodeEncoder SetLength(int bits) + { + Size = (byte)bits; + return this; + } + + public OpcodeEncoder SetBit(int offset, bool value) + { + if (offset < 64) + { + offset = 63 - offset; + if (value) + data1 = (data1 | (1ul << offset)); + else + data1 = (data1 & ~(1ul << offset)); + } + else + { + offset = 63 - (offset - 64); + if (value) + data2 = (data2 | (1ul << offset)); + else + data2 = (data2 & ~(1ul << offset)); + } + return this; + } + + public OpcodeEncoder AppendBit(bool set) + { + SetBit(Size, set); + Size++; + return this; + } + + public OpcodeEncoder AppendBit(int value) + { + SetBit(Size, value != 0); + Size++; + return this; + } + + public OpcodeEncoder AppendBit(uint value) + { + SetBit(Size, value != 0); + Size++; + return this; + } + + public OpcodeEncoder AppendNibble(int value) + { + AppendBit((value >> 3) & 0x1); + AppendBit((value >> 2) & 0x1); + AppendBit((value >> 1) & 0x1); + AppendBit(value & 0x1); + return this; + } + + public OpcodeEncoder Append2Bits(int value) + { + AppendBit((value >> 1) & 0x1); + AppendBit(value & 0x1); + return this; + } + + public OpcodeEncoder Append3Bits(int value) + { + AppendBit((value >> 2) & 0x1); + AppendBit((value >> 1) & 0x1); + AppendBit(value & 0x1); + return this; + } + + public OpcodeEncoder AppendBits(uint value, int size) + { + for (int i = size - 1; i >= 0; i--) + { + AppendBit((value >> i) & 1); + } + + return this; + } + + public OpcodeEncoder AppendBits(int value, int size) + { + return AppendBits((uint)value, size); + } + + public OpcodeEncoder AppendByte(byte value) + { + return AppendBits(value, 8); + } + + public OpcodeEncoder Append8Bits(byte value) + { + return AppendBits(value, 8); + } + + public OpcodeEncoder Append16Bits(ushort value) + { + return AppendBits(value, 16); + } + + public OpcodeEncoder Append32Bits(uint value) + { + return AppendBits(value, 32); + } + + public OpcodeEncoder AppendByteValue(byte value) + { + for (int i = 7; i >= 0; i--) + { + AppendBit((value >> i) & 1); + } + + return this; + } + + public OpcodeEncoder AppendIntegerValue(uint value) + { + AppendByteValue((byte)(value & 0xFF)); + AppendByteValue((byte)((value >> 8) & 0xFF)); + AppendByteValue((byte)((value >> 16) & 0xFF)); + AppendByteValue((byte)((value >> 24) & 0xFF)); + return this; + } + + public OpcodeEncoder AppendShortValue(ushort value) + { + AppendByteValue((byte)(value & 0xFF)); + AppendByteValue((byte)((value >> 8) & 0xFF)); + return this; + } + + public OpcodeEncoder AppendConditionalIntegerValue(bool include, uint value) + { + if (include) + return AppendIntegerValue(value); + else + return this; + } + + public OpcodeEncoder AppendConditionalPatchPlaceholder(bool include, out int position) + { + if (include) + { + position = (Size / 8); + return AppendIntegerValue(0x0); + } + else + { + position = -1; + return this; + } + } + + public OpcodeEncoder AppendRegister(int value) + { + return Append3Bits(value); + } + + public OpcodeEncoder AppendRegister(Register register) + { + return Append3Bits(register.RegisterCode); + } + + public OpcodeEncoder AppendRegister(Operand operand) + { + return Append3Bits(operand.Register.RegisterCode); + } + + public OpcodeEncoder AppendMod(byte value) + { + return Append2Bits(value); + } + + public OpcodeEncoder AppendRM(byte value) + { + return Append3Bits(value); + } + + public OpcodeEncoder AppendRM(Register register) + { + return Append3Bits(register.RegisterCode); + } + + public OpcodeEncoder AppendRM(Operand operand) + { + if (operand.IsCPURegister) + return AppendRM(operand.Register); + else + return AppendRM(Bits.b101); + } + + public OpcodeEncoder AppendImmediate(uint value) + { + return AppendIntegerValue(value); + } + + public OpcodeEncoder AppendImmediate(byte value) + { + return AppendByte(value); + } + + public OpcodeEncoder AppendConditionalPrefix(bool include, byte value) + { + if (include) + AppendByte(value); + + return this; + } + + public OpcodeEncoder AppendWidthBit(bool width) + { + return AppendBit(width ? 1 : 0); + } + + public OpcodeEncoder AppendSIB(int scale, Register index, Register @base) + { + Debug.Assert(scale == 1 || scale == 2 || scale == 4 || scale == 8); + + int svalue = 0; + + if (scale == 1) + svalue = 0; + else if (scale == 2) + svalue = 1; + else if (scale == 4) + svalue = 2; + else if (scale == 8) + svalue = 3; + + // scale + AppendBits(svalue, 2); + + // index + if (index == null) + Append3Bits(Bits.b100); + else + AppendRegister(index); + + // base + if (@base == null) + Append3Bits(Bits.b101); + else + AppendRegister(@base); + + return this; + } + + public bool Is8BitDisplacement(Operand displacement) + { + return (displacement.ConstantSignedInteger >= sbyte.MinValue && displacement.ConstantSignedInteger <= sbyte.MaxValue); + } + + public OpcodeEncoder AppendMod(bool memory, Operand displacement) + { + if (memory) + { + if (!displacement.IsConstant) + return Append2Bits(Bits.b00); + + if (displacement.IsConstantZero) + return Append2Bits(Bits.b00); + + if (Is8BitDisplacement(displacement)) + return Append2Bits(Bits.b01); + + return Append2Bits(Bits.b10); + } + + return Append2Bits(Bits.b11); + } + + public OpcodeEncoder AppendConditionalDisplacement(bool include, Operand displacement) + { + Debug.Assert(displacement.IsConstant); + + if (!include) + return this; + + if (Is8BitDisplacement(displacement)) + return AppendByteValue((byte)displacement.ConstantUnsignedInteger); + + return AppendIntegerValue(displacement.ConstantUnsignedInteger); + } + + public OpcodeEncoder AppendConditionalDisplacement(Operand displacement) + { + if (!displacement.IsConstant) + return this; + + if (displacement.IsConstantZero) + return this; + + if (Is8BitDisplacement(displacement)) + return AppendByteValue((byte)displacement.ConstantUnsignedInteger); + + return AppendIntegerValue(displacement.ConstantUnsignedInteger); + } + + public OpcodeEncoder AppendConditionalREXPrefix(bool include, bool w, bool r, bool x, bool b) + { + if (!include) + return this; + + // REX Prefix Fields [BITS: 0100WRXB] + AppendNibble(Bits.b0100); + AppendBit(w); + AppendBit(r); + AppendBit(x); + AppendBit(b); + + return this; + } + + public OpcodeEncoder AppendInteger(Operand operand, InstructionSize size) + { + if (size == InstructionSize.Size32) + return AppendIntegerValue(operand.ConstantUnsignedInteger); + if (size == InstructionSize.Size8) + return AppendByteValue((byte)operand.ConstantUnsignedInteger); + if (size == InstructionSize.Size16) + return AppendShortValue((ushort)operand.ConstantUnsignedInteger); + + throw new InvalidCompilerException("Instruction size invalid"); + } + + public OpcodeEncoder ModRegRMSIBDisplacement(bool offsetDestination, Operand destination, Operand source, Operand offset) + { + if (offsetDestination && source.IsConstant) + { + var baseEBP = destination.Register == GeneralPurposeRegister.EBP; + if (baseEBP) + { + if (offset.IsCPURegister || Is8BitDisplacement(offset)) + { + AppendMod(Bits.b01); // 2:mod + } + else + { + AppendMod(Bits.b10); // 2:mod + } + } + else + { + AppendMod(true, offset); // 2:mod + } + + AppendRegister(Bits.b000); // 3:register (destination) + + if (offset.IsCPURegister) + { + AppendRM(Bits.b100); // 3:r/m (source) + AppendSIB(1, offset.Register, destination.Register); // 8:sib (scale, index, base) + if (baseEBP) + { + AppendByteValue(0x0); // 8:displacement value + } + } + else if (destination.Register == GeneralPurposeRegister.ESP) + { + // When destination is ESP we must use SIB + AppendRM(Bits.b100); // 3:r/m (source) + AppendSIB(1, destination.Register, destination.Register); // 8:sib (scale, index, base) + AppendConditionalDisplacement(offset); // 8/32:displacement value + } + else + { + AppendRM(destination); // 3:r/m (source) + if (baseEBP) + { + AppendConditionalDisplacement(true, offset); // 8/32:displacement value + } + else + { + AppendConditionalDisplacement(offset); // 8/32:displacement value + } + } + } + else if (offset.IsConstant) + { + // When source is ESP we must use SIB + AppendMod(true, offset); // 2:mod + AppendRegister(destination.Register); // 3:register (destination) + if (source.Register == GeneralPurposeRegister.ESP) + { + AppendRM(Bits.b100); // 3:r/m (source) + AppendSIB(1, source.Register, source.Register); // 8:sib (scale, index, base) + } + else + { + AppendRM(source); // 3:r/m (source) + } + AppendConditionalDisplacement(offset); // 8/32:displacement value + } + else + { + // When EBP is the base we must set the mod to either: + // b01 with a 1 byte displacement + // b10 with a 4 byte displacement + var @base = offsetDestination ? destination : source; + var baseEBP = @base.Register == GeneralPurposeRegister.EBP; + + AppendMod(baseEBP ? Bits.b01 : Bits.b00); // 2:mod + AppendRegister(destination.Register); // 3:register (destination) + AppendRM(Bits.b100); // 3:r/m (source) + AppendSIB(1, offset.Register, @base.Register); // 8:sib (scale, index, base) + if (baseEBP) + { + AppendByteValue(0x0); // 8:displacement value + } + } + + return this; + } + } +} diff --git a/Source/Mosa.Platform.x86/MachineCodeEmitter.cs b/Source/Mosa.Platform.x86/X86CodeEmitter.cs similarity index 96% rename from Source/Mosa.Platform.x86/MachineCodeEmitter.cs rename to Source/Mosa.Platform.x86/X86CodeEmitter.cs index b1a6039cbc..868720c1c2 100644 --- a/Source/Mosa.Platform.x86/MachineCodeEmitter.cs +++ b/Source/Mosa.Platform.x86/X86CodeEmitter.cs @@ -11,10 +11,8 @@ namespace Mosa.Platform.x86 /// /// An x86 machine code emitter. /// - public sealed class MachineCodeEmitter : BaseCodeEmitter + public sealed class X86CodeEmitter : BaseCodeEmitter { - #region Code Generation - /// /// Calls the specified target. /// @@ -46,11 +44,82 @@ public void EmitRelativeBranch(byte[] code, int dest) EmitRelativeBranchTarget(dest); } + /// + /// Emits the relative branch target. + /// + /// The label. + private void EmitRelativeBranchTarget(int label) + { + // The relative offset of the label + int relOffset = 0; + + // The position in the code stream of the label + int position; + + // Did we see the label? + if (TryGetLabel(label, out position)) + { + // Yes, calculate the relative offset + relOffset = position - ((int)codeStream.Position + 4); + } + else + { + // Forward jump, we can't resolve yet - store a patch + AddPatch(label, (int)codeStream.Position); + } + + // Emit the relative jump offset (zero if we don't know it yet!) + codeStream.Write(relOffset, Endianness.Little); + } + + public override void ResolvePatches() + { + // Save the current position + long currentPosition = codeStream.Position; + + foreach (var p in patches) + { + int labelPosition; + if (!TryGetLabel(p.Label, out labelPosition)) + { + throw new ArgumentException("Missing label while resolving patches.", "label=" + labelPosition.ToString()); + } + + codeStream.Position = p.Position; + + // Compute relative branch offset + int relOffset = labelPosition - ((int)p.Position + 4); + + // Write relative offset to stream + var bytes = BitConverter.GetBytes(relOffset); + codeStream.Write(bytes, 0, bytes.Length); + } + + // Reset the position + codeStream.Position = currentPosition; + } + + /// + /// Emits a far jump to next instruction. + /// + public void EmitFarJumpToNextInstruction() + { + codeStream.WriteByte(0xEA); + + linker.Link(LinkType.AbsoluteAddress, PatchType.I4, SectionKind.Text, MethodName, (int)codeStream.Position, SectionKind.Text, MethodName, (int)codeStream.Position + 6); + + codeStream.WriteZeroBytes(4); + codeStream.WriteByte(0x08); + codeStream.WriteByte(0x00); + } + + #region Legacy Opcode Methods + /// /// Emits the specified op code. /// /// The op code. - public void Emit(OpCode opCode) + internal void Emit(LegacyOpCode opCode) { // Write the opcode codeStream.Write(opCode.Code, 0, opCode.Code.Length); @@ -61,7 +130,7 @@ public void Emit(OpCode opCode) /// /// The op code. /// The destination operand. - public void Emit(OpCode opCode, Operand dest) + internal void Emit(LegacyOpCode opCode, Operand dest) { // Write the opcode codeStream.Write(opCode.Code, 0, opCode.Code.Length); @@ -88,7 +157,7 @@ public void Emit(OpCode opCode, Operand dest) /// The op code. /// The destination operand. /// The source operand. - public void Emit(OpCode opCode, Operand dest, Operand src) + internal void Emit(LegacyOpCode opCode, Operand dest, Operand src) { // Write the opcode codeStream.Write(opCode.Code, 0, opCode.Code.Length); @@ -122,7 +191,7 @@ public void Emit(OpCode opCode, Operand dest, Operand src) /// The dest. /// The source. /// The third. - public void Emit(OpCode opCode, Operand dest, Operand src, Operand third) + internal void Emit(LegacyOpCode opCode, Operand dest, Operand src, Operand third) { // Write the opcode codeStream.Write(opCode.Code, 0, opCode.Code.Length); @@ -228,75 +297,6 @@ private void WriteImmediate(Operand op) throw new InvalidCompilerException(); } - /// - /// Emits the relative branch target. - /// - /// The label. - private void EmitRelativeBranchTarget(int label) - { - // The relative offset of the label - int relOffset = 0; - - // The position in the code stream of the label - int position; - - // Did we see the label? - if (TryGetLabel(label, out position)) - { - // Yes, calculate the relative offset - relOffset = position - ((int)codeStream.Position + 4); - } - else - { - // Forward jump, we can't resolve yet - store a patch - AddPatch(label, (int)codeStream.Position); - } - - // Emit the relative jump offset (zero if we don't know it yet!) - codeStream.Write(relOffset, Endianness.Little); - } - - public override void ResolvePatches() - { - // Save the current position - long currentPosition = codeStream.Position; - - foreach (var p in patches) - { - int labelPosition; - if (!TryGetLabel(p.Label, out labelPosition)) - { - throw new ArgumentException("Missing label while resolving patches.", "label=" + labelPosition.ToString()); - } - - codeStream.Position = p.Position; - - // Compute relative branch offset - int relOffset = labelPosition - ((int)p.Position + 4); - - // Write relative offset to stream - var bytes = BitConverter.GetBytes(relOffset); - codeStream.Write(bytes, 0, bytes.Length); - } - - // Reset the position - codeStream.Position = currentPosition; - } - - /// - /// Emits a far jump to next instruction. - /// - public void EmitFarJumpToNextInstruction() - { - codeStream.WriteByte(0xEA); - - linker.Link(LinkType.AbsoluteAddress, PatchType.I4, SectionKind.Text, MethodName, (int)codeStream.Position, SectionKind.Text, MethodName, (int)codeStream.Position + 6); - - codeStream.WriteZeroBytes(4); - codeStream.WriteByte(0x08); - codeStream.WriteByte(0x00); - } - /// /// Calculates the value of the modR/M byte and SIB bytes. /// @@ -329,6 +329,6 @@ public void EmitFarJumpToNextInstruction() return modRM; } - #endregion Code Generation + #endregion Legacy Opcode Methods } } diff --git a/Source/Mosa.Platform.x86/X86Instruction.cs b/Source/Mosa.Platform.x86/X86Instruction.cs index 7c07b05bb0..53fff70b96 100644 --- a/Source/Mosa.Platform.x86/X86Instruction.cs +++ b/Source/Mosa.Platform.x86/X86Instruction.cs @@ -2,6 +2,7 @@ using Mosa.Compiler.Framework; using Mosa.Compiler.Framework.Platform; +using System; namespace Mosa.Platform.x86 { @@ -53,32 +54,37 @@ protected X86Instruction(byte resultCount, byte operandCount) /// The emitter. public override void Emit(InstructionNode node, BaseCodeEmitter emitter) { - Emit(node, emitter as MachineCodeEmitter); + EmitLegacy(node, emitter as X86CodeEmitter); } - /// - /// Computes the opcode. - /// - /// The destination operand. - /// The source operand. - /// The third operand. - /// - protected virtual OpCode ComputeOpCode(Operand destination, Operand source, Operand third) - { - throw new System.Exception("opcode not implemented for this instruction"); - } + #endregion Methods + + #region Legacy Opcode Methods /// /// Emits the specified platform instruction. /// /// The node. /// The emitter. - protected virtual void Emit(InstructionNode node, MachineCodeEmitter emitter) + internal virtual void EmitLegacy(InstructionNode node, X86CodeEmitter emitter) { - OpCode opCode = ComputeOpCode(node.Result, node.Operand1, node.Operand2); + var opCode = ComputeOpCode(node.Result, node.Operand1, node.Operand2); emitter.Emit(opCode, node.Result, node.Operand1, node.Operand2); } - #endregion Methods + /// + /// Computes the opcode. + /// + /// The destination operand. + /// The source operand. + /// The third operand. + /// + /// opcode not implemented for this instruction + internal virtual LegacyOpCode ComputeOpCode(Operand destination, Operand source, Operand third) + { + throw new Exception("opcode not implemented for this instruction"); + } + + #endregion Legacy Opcode Methods } } diff --git a/Source/Mosa.Platform.x86/X86OpcodeEncoder.cs b/Source/Mosa.Platform.x86/X86OpcodeEncoder.cs deleted file mode 100644 index f9510085e4..0000000000 --- a/Source/Mosa.Platform.x86/X86OpcodeEncoder.cs +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) MOSA Project. Licensed under the New BSD License. - -using Mosa.Compiler.Common; -using Mosa.Compiler.Framework; -using Mosa.Compiler.Framework.Platform; -using System.Diagnostics; - -namespace Mosa.Platform.x86 -{ - public static class X86OpcodeEncoderExtensions - { - public static OpcodeEncoder AppendRegister(this OpcodeEncoder encoder, int value) - { - return encoder.Append3Bits(value); - } - - public static OpcodeEncoder AppendRegister(this OpcodeEncoder encoder, Register register) - { - return encoder.Append3Bits(register.RegisterCode); - } - - public static OpcodeEncoder AppendRegister(this OpcodeEncoder encoder, Operand operand) - { - return encoder.Append3Bits(operand.Register.RegisterCode); - } - - public static OpcodeEncoder AppendMod(this OpcodeEncoder encoder, byte value) - { - return encoder.Append2Bits(value); - } - - public static OpcodeEncoder AppendRM(this OpcodeEncoder encoder, byte value) - { - return encoder.Append3Bits(value); - } - - public static OpcodeEncoder AppendRM(this OpcodeEncoder encoder, Register register) - { - return encoder.Append3Bits(register.RegisterCode); - } - - public static OpcodeEncoder AppendRM(this OpcodeEncoder encoder, Operand operand) - { - if (operand.IsCPURegister) - return encoder.AppendRM(operand.Register); - else - return encoder.AppendRM(Bits.b101); - } - - public static OpcodeEncoder AppendImmediate(this OpcodeEncoder encoder, uint value) - { - return encoder.AppendIntegerValue(value); - } - - public static OpcodeEncoder AppendImmediate(this OpcodeEncoder encoder, byte value) - { - return encoder.AppendByte(value); - } - - public static OpcodeEncoder AppendConditionalPrefix(this OpcodeEncoder encoder, bool include, byte value) - { - if (include) - encoder.AppendByte(value); - - return encoder; - } - - public static OpcodeEncoder AppendWidthBit(this OpcodeEncoder encoder, bool width) - { - return encoder.AppendBit(width ? 1 : 0); - } - - public static OpcodeEncoder AppendSIB(this OpcodeEncoder encoder, int scale, Register index, Register @base) - { - Debug.Assert(scale == 1 || scale == 2 || scale == 4 || scale == 8); - - int svalue = 0; - - if (scale == 1) - svalue = 0; - else if (scale == 2) - svalue = 1; - else if (scale == 4) - svalue = 2; - else if (scale == 8) - svalue = 3; - - // scale - encoder.AppendBits(svalue, 2); - - // index - if (index == null) - encoder.Append3Bits(Bits.b100); - else - encoder.AppendRegister(index); - - // base - if (@base == null) - encoder.Append3Bits(Bits.b101); - else - encoder.AppendRegister(@base); - - return encoder; - } - - public static bool Is8BitDisplacement(Operand displacement) - { - return (displacement.ConstantSignedInteger >= sbyte.MinValue && displacement.ConstantSignedInteger <= sbyte.MaxValue); - } - - public static OpcodeEncoder AppendMod(this OpcodeEncoder encoder, bool memory, Operand displacement) - { - if (memory) - { - if (!displacement.IsConstant) - return encoder.Append2Bits(Bits.b00); - - if (displacement.IsConstantZero) - return encoder.Append2Bits(Bits.b00); - - if (Is8BitDisplacement(displacement)) - return encoder.Append2Bits(Bits.b01); - - return encoder.Append2Bits(Bits.b10); - } - - return encoder.Append2Bits(Bits.b11); - } - - public static OpcodeEncoder AppendConditionalDisplacement(this OpcodeEncoder encoder, bool include, Operand displacement) - { - Debug.Assert(displacement.IsConstant); - - if (!include) - return encoder; - - if (Is8BitDisplacement(displacement)) - return encoder.AppendByteValue((byte)displacement.ConstantUnsignedInteger); - - return encoder.AppendIntegerValue(displacement.ConstantUnsignedInteger); - } - - public static OpcodeEncoder AppendConditionalDisplacement(this OpcodeEncoder encoder, Operand displacement) - { - if (!displacement.IsConstant) - return encoder; - - if (displacement.IsConstantZero) - return encoder; - - if (Is8BitDisplacement(displacement)) - return encoder.AppendByteValue((byte)displacement.ConstantUnsignedInteger); - - return encoder.AppendIntegerValue(displacement.ConstantUnsignedInteger); - } - - public static OpcodeEncoder AppendConditionalREXPrefix(this OpcodeEncoder encoder, bool include, bool w, bool r, bool x, bool b) - { - if (!include) - return encoder; - - // REX Prefix Fields [BITS: 0100WRXB] - encoder.AppendNibble(Bits.b0100); - encoder.AppendBit(w); - encoder.AppendBit(r); - encoder.AppendBit(x); - encoder.AppendBit(b); - - return encoder; - } - - public static OpcodeEncoder AppendInteger(this OpcodeEncoder encoder, Operand operand, InstructionSize size) - { - if (size == InstructionSize.Size32) - return encoder.AppendIntegerValue(operand.ConstantUnsignedInteger); - if (size == InstructionSize.Size8) - return encoder.AppendByteValue((byte)operand.ConstantUnsignedInteger); - if (size == InstructionSize.Size16) - return encoder.AppendShortValue((ushort)operand.ConstantUnsignedInteger); - - throw new InvalidCompilerException("Instruction size invalid"); - } - - public static OpcodeEncoder ModRegRMSIBDisplacement(this OpcodeEncoder encoder, bool offsetDestination, Operand destination, Operand source, Operand offset) - { - if (offsetDestination && source.IsConstant) - { - var baseEBP = destination.Register == GeneralPurposeRegister.EBP; - if (baseEBP) - { - if (offset.IsCPURegister || Is8BitDisplacement(offset)) - { - encoder.AppendMod(Bits.b01); // 2:mod - } - else - { - encoder.AppendMod(Bits.b10); // 2:mod - } - } - else - { - encoder.AppendMod(true, offset); // 2:mod - } - - encoder.AppendRegister(Bits.b000); // 3:register (destination) - - if (offset.IsCPURegister) - { - encoder.AppendRM(Bits.b100); // 3:r/m (source) - encoder.AppendSIB(1, offset.Register, destination.Register); // 8:sib (scale, index, base) - if (baseEBP) - { - encoder.AppendByteValue(0x0); // 8:displacement value - } - } - else if (destination.Register == GeneralPurposeRegister.ESP) - { - // When destination is ESP we must use SIB - encoder.AppendRM(Bits.b100); // 3:r/m (source) - encoder.AppendSIB(1, destination.Register, destination.Register); // 8:sib (scale, index, base) - encoder.AppendConditionalDisplacement(offset); // 8/32:displacement value - } - else - { - encoder.AppendRM(destination); // 3:r/m (source) - if (baseEBP) - { - encoder.AppendConditionalDisplacement(true, offset); // 8/32:displacement value - } - else - { - encoder.AppendConditionalDisplacement(offset); // 8/32:displacement value - } - } - } - else if (offset.IsConstant) - { - // When source is ESP we must use SIB - encoder.AppendMod(true, offset); // 2:mod - encoder.AppendRegister(destination.Register); // 3:register (destination) - if (source.Register == GeneralPurposeRegister.ESP) - { - encoder.AppendRM(Bits.b100); // 3:r/m (source) - encoder.AppendSIB(1, source.Register, source.Register); // 8:sib (scale, index, base) - } - else - { - encoder.AppendRM(source); // 3:r/m (source) - } - encoder.AppendConditionalDisplacement(offset); // 8/32:displacement value - } - else - { - // When EBP is the base we must set the mod to either: - // b01 with a 1 byte displacement - // b10 with a 4 byte displacement - var @base = offsetDestination ? destination : source; - var baseEBP = @base.Register == GeneralPurposeRegister.EBP; - - encoder.AppendMod(baseEBP ? Bits.b01 : Bits.b00); // 2:mod - encoder.AppendRegister(destination.Register); // 3:register (destination) - encoder.AppendRM(Bits.b100); // 3:r/m (source) - encoder.AppendSIB(1, offset.Register, @base.Register); // 8:sib (scale, index, base) - if (baseEBP) - { - encoder.AppendByteValue(0x0); // 8:displacement value - } - } - - return encoder; - } - } -} diff --git a/Source/Mosa.Tool.Explorer/Main.Designer.cs b/Source/Mosa.Tool.Explorer/Main.Designer.cs index 226423ece2..8a785c4390 100644 --- a/Source/Mosa.Tool.Explorer/Main.Designer.cs +++ b/Source/Mosa.Tool.Explorer/Main.Designer.cs @@ -365,7 +365,7 @@ private void InitializeComponent() this.tabControl1.Name = "tabControl1"; this.tabControl1.Padding = new System.Drawing.Point(0, 0); this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(679, 425); + this.tabControl1.Size = new System.Drawing.Size(677, 425); this.tabControl1.TabIndex = 38; // // tbStages @@ -379,7 +379,7 @@ private void InitializeComponent() this.tbStages.Location = new System.Drawing.Point(4, 25); this.tbStages.Margin = new System.Windows.Forms.Padding(0); this.tbStages.Name = "tbStages"; - this.tbStages.Size = new System.Drawing.Size(671, 396); + this.tbStages.Size = new System.Drawing.Size(669, 396); this.tbStages.TabIndex = 0; this.tbStages.Text = "Instructions"; // @@ -432,7 +432,7 @@ private void InitializeComponent() this.tbDebug.Location = new System.Drawing.Point(4, 25); this.tbDebug.Margin = new System.Windows.Forms.Padding(0); this.tbDebug.Name = "tbDebug"; - this.tbDebug.Size = new System.Drawing.Size(671, 396); + this.tbDebug.Size = new System.Drawing.Size(669, 396); this.tbDebug.TabIndex = 1; this.tbDebug.Text = "Debug"; // @@ -449,14 +449,14 @@ private void InitializeComponent() this.cbDebugStages.TabIndex = 40; this.cbDebugStages.SelectedIndexChanged += new System.EventHandler(this.cbDebugStages_SelectedIndexChanged); // - // rbOtherResult + // rbDebugResult // this.rbDebugResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.rbDebugResult.Font = new System.Drawing.Font("Lucida Console", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rbDebugResult.Location = new System.Drawing.Point(0, 32); - this.rbDebugResult.Name = "rbOtherResult"; + this.rbDebugResult.Name = "rbDebugResult"; this.rbDebugResult.Size = new System.Drawing.Size(674, 365); this.rbDebugResult.TabIndex = 32; this.rbDebugResult.Text = ""; @@ -467,7 +467,7 @@ private void InitializeComponent() this.tbMethodCounters.Controls.Add(this.rbMethodCounters); this.tbMethodCounters.Location = new System.Drawing.Point(4, 25); this.tbMethodCounters.Name = "tbMethodCounters"; - this.tbMethodCounters.Size = new System.Drawing.Size(671, 396); + this.tbMethodCounters.Size = new System.Drawing.Size(669, 396); this.tbMethodCounters.TabIndex = 6; this.tbMethodCounters.Text = "Counters"; this.tbMethodCounters.UseVisualStyleBackColor = true; @@ -492,7 +492,7 @@ private void InitializeComponent() this.tbGlobalCounters.Location = new System.Drawing.Point(4, 25); this.tbGlobalCounters.Name = "tbGlobalCounters"; this.tbGlobalCounters.Padding = new System.Windows.Forms.Padding(3); - this.tbGlobalCounters.Size = new System.Drawing.Size(671, 396); + this.tbGlobalCounters.Size = new System.Drawing.Size(669, 396); this.tbGlobalCounters.TabIndex = 4; this.tbGlobalCounters.Text = "Global Counters"; // @@ -516,7 +516,7 @@ private void InitializeComponent() this.tbLogs.Location = new System.Drawing.Point(4, 25); this.tbLogs.Name = "tbLogs"; this.tbLogs.Padding = new System.Windows.Forms.Padding(3); - this.tbLogs.Size = new System.Drawing.Size(671, 396); + this.tbLogs.Size = new System.Drawing.Size(669, 396); this.tbLogs.TabIndex = 3; this.tbLogs.Text = "Log"; // @@ -540,7 +540,7 @@ private void InitializeComponent() this.tbErrors.Location = new System.Drawing.Point(4, 25); this.tbErrors.Name = "tbErrors"; this.tbErrors.Padding = new System.Windows.Forms.Padding(3); - this.tbErrors.Size = new System.Drawing.Size(671, 396); + this.tbErrors.Size = new System.Drawing.Size(669, 396); this.tbErrors.TabIndex = 2; this.tbErrors.Text = "Errors"; // @@ -563,7 +563,7 @@ private void InitializeComponent() this.tbExceptions.Location = new System.Drawing.Point(4, 25); this.tbExceptions.Name = "tbExceptions"; this.tbExceptions.Padding = new System.Windows.Forms.Padding(3); - this.tbExceptions.Size = new System.Drawing.Size(671, 396); + this.tbExceptions.Size = new System.Drawing.Size(669, 396); this.tbExceptions.TabIndex = 5; this.tbExceptions.Text = "Exceptions"; this.tbExceptions.UseVisualStyleBackColor = true; @@ -643,6 +643,7 @@ private void InitializeComponent() this.cbPlatform.Name = "cbPlatform"; this.cbPlatform.Size = new System.Drawing.Size(78, 21); this.cbPlatform.TabIndex = 28; + this.cbPlatform.SelectedIndexChanged += new System.EventHandler(this.cbPlatform_SelectedIndexChanged); // // folderBrowserDialog1 // @@ -661,7 +662,7 @@ private void InitializeComponent() this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; this.Name = "Main"; - this.Text = "MOSA Explorer v1.6.0"; + this.Text = "MOSA Explorer v1.6.1"; this.Load += new System.EventHandler(this.Main_Load); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); diff --git a/Source/Mosa.Tool.Explorer/Main.cs b/Source/Mosa.Tool.Explorer/Main.cs index 754432334e..17c90514ab 100644 --- a/Source/Mosa.Tool.Explorer/Main.cs +++ b/Source/Mosa.Tool.Explorer/Main.cs @@ -111,6 +111,10 @@ public void LoadAssembly(string filename) { LoadAssembly(filename, cbPlatform.Text); + UpdateTree(); + + Stage = CompileStage.Loaded; + methodStore.Clear(); SetStatus("Assemblies Loaded!"); @@ -179,6 +183,7 @@ private void SetCompilerOptions() Compiler.CompilerOptions.EnableSparseConditionalConstantPropagation = cbEnableSparseConditionalConstantPropagation.Checked; Compiler.CompilerOptions.EmitBinary = cbEnableBinaryCodeGeneration.Checked; Compiler.CompilerOptions.EnableInlinedMethods = cbEnableInlinedMethods.Checked; + Compiler.CompilerOptions.InlinedIRMaximum = 20; } private void CleanGUI() @@ -531,7 +536,7 @@ private void toolStripButton2_Click(object sender, EventArgs e) protected void LoadAssembly(string filename, string platform) { - Compiler.CompilerOptions.Architecture = GetArchitecture(cbPlatform.Text); + Compiler.CompilerOptions.Architecture = GetArchitecture(platform); var moduleLoader = new MosaModuleLoader(); @@ -540,11 +545,9 @@ protected void LoadAssembly(string filename, string platform) var metadata = moduleLoader.CreateMetadata(); - Compiler.Load(TypeSystem.Load(metadata)); - - UpdateTree(); + var typeSystem = TypeSystem.Load(metadata); - Stage = CompileStage.Loaded; + Compiler.Load(typeSystem); } private void ShowCodeForm() @@ -555,7 +558,7 @@ private void ShowCodeForm() { if (!string.IsNullOrEmpty(form.Assembly)) { - LoadAssembly(form.Assembly, cbPlatform.Text); + LoadAssembly(form.Assembly); } } } @@ -729,5 +732,10 @@ private void DumpAllMethodStagesToolStripMenuItem_Click(object sender, EventArgs } } } + + private void cbPlatform_SelectedIndexChanged(object sender, EventArgs e) + { + // + } } }