Mosa.Runtime.CompilerFramework.Context context = new Mosa.Runtime.CompilerFramework.Context(); context.ReplaceInstructionOnly = true; string instruction = "mov eax, ebx"; // original instruction string replacement = "add eax, ecx"; // instruction to replace with string newInstruction = context.ReplaceInstruction(instruction, replacement); // newInstruction will be "add eax, ecx"
Mosa.Runtime.CompilerFramework.Context context = new Mosa.Runtime.CompilerFramework.Context(); context.ReplaceInstructionOnly = true; string sourceCode = @" mov eax, ebx mov ecx, edx mul esi"; string instructionToReplace = "mov ecx, edx"; // original instruction string replacementInstruction = "xor ecx, ecx"; // instruction to replace with string newSourceCode = context.ReplaceInstruction(sourceCode, instructionToReplace, replacementInstruction); // newSourceCode will be: /* mov eax, ebx xor ecx, ecx mul esi */These code examples are part of the Mosa.Compiler.Framework package library.