matt-kempster / m2c

A MIPS and PowerPC decompiler.
GNU General Public License v3.0
396 stars 48 forks source link

Refactor `Instruction` to include arch information #208

Closed zbanks closed 2 years ago

zbanks commented 2 years ago

Add arch-specific information to each Instruction that describes how it should be interpreted.

This replaces the existing ArchAsm.is_*_instruction(...) functions by including this information directly inside the Instruction object. AsmInstruction is introduced to represent a "raw" instruction, with just a mnemonic + args.

This PR doesn't change any behavior (that I'm aware of); it's a refactor to help with more complex pattern matching that I'm working on. Project & end-to-end tests still pass: tested MIPS with MM, PM; tested PPC with Melee, SMS, and SMB1.

The first commit (036e579) is equivalent to the changes I posted in Discord, to help make re-reviewing a bit easier.