diff --git a/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs b/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs index 23a9d928..03b9b072 100644 --- a/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs +++ b/Cpp2IL.Core/InstructionSets/NewArmV8InstructionSet.cs @@ -68,6 +68,22 @@ private void ConvertInstructionStatement(Arm64Instruction instruction, IsilBuild case Arm64Mnemonic.LDR: case Arm64Mnemonic.LDRB: //Load and move are (dest, src) + if (instruction.MemIsPreIndexed) // such as X8, [X19,#0x30]! + { + var operate= ConvertOperand(instruction, 1); + if (operate.Data is IsilMemoryOperand operand) + { + var register= operand.Base!.Value; + // X19= X19, #0x30 + builder.Add(instruction.Address,register,register, InstructionSetIndependentOperand.MakeImmediate(operand.Addend)); + //X8 = [X19] + builder.Move(instruction.Address,ConvertOperand(instruction,0),InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand( + InstructionSetIndependentOperand.MakeRegister(register.ToString()!.ToUpperInvariant()), + 0))); + break; + } + + } builder.Move(instruction.Address, ConvertOperand(instruction, 0), ConvertOperand(instruction, 1)); break; case Arm64Mnemonic.MOVN: @@ -330,7 +346,7 @@ private InstructionSetIndependentOperand ConvertOperand(Arm64Instruction instruc if(reg == Arm64Register.INVALID) //Offset only return InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand(offset)); - + //TODO Handle more stuff here return InstructionSetIndependentOperand.MakeMemory(new IsilMemoryOperand( InstructionSetIndependentOperand.MakeRegister(reg.ToString().ToUpperInvariant()),