Instead of code patterns like:
if (MI.getOpcode() == TargetOpcode::G_LOAD) Ptr = MI.getOperand(1);
having some wrappers could make the opcode checking a bit shorter, and also allow us to define some abstractions over the raw MachineInstr specific to a particular generic operation. Here's an example of how that could work with G_LOAD, using automatic bool and MachineInstr* conversions.
clang-format: please reformat the code