We have an unfortunate situation in our back end where we have to keep pairs of functions synchronized. Needless to say that this is not an ideal situation as it is very difficult to enforce. Even without bugs, it's annoying to have to do the same thing in two places.
This patch just refactors the code so that the two pairs of those functions that pertain to printing register operands are unified:
- stripRegisterPrefix() - this just removes the letter prefixes from registers for the InstrPrinter and AsmPrinter. This patch provides this as a static member of PPCRegisterInfo
- Handling of PPCII::UseVSXReg - there are 3 places where we do something special for instructions with that flag set. Each of those places does its own checking of this flag and implements code customization. Any changes to how we print/encode VSX/VMX registers require modifying all 3 places. This patch unifies this into a static function in PPCInstrInfo that returns the register number adjusted as needed.
I was going to commit this NFC patch without a review, but it's a somewhat significant refactoring so I thought I'd put it up to see if anyone objects first.
Patch not up to date? Need to also update code from https://reviews.llvm.org/D52244.