[PATCH] D52467: [PowerPC] [NFC] Refactor code for printing register operands

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 06:49:04 PDT 2018


nemanjai created this revision.
nemanjai added reviewers: echristo, hfinkel, jsji, kbarton.
nemanjai added a reviewer: syzaara.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D52467

Files:
  lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
  lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
  lib/Target/PowerPC/PPCAsmPrinter.cpp
  lib/Target/PowerPC/PPCInstrInfo.h
  lib/Target/PowerPC/PPCRegisterInfo.h
  lib/Target/PowerPC/PPCRegisterInfo.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52467.166871.patch
Type: text/x-patch
Size: 9725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180925/e4b07076/attachment.bin>


More information about the llvm-commits mailing list