[PATCH] D27984: [ARM] [RFC] Use AddDefaultCC/Pred where possible. NFC

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 05:16:12 PST 2016


rovka created this revision.
rovka added reviewers: MatzeB, t.p.northover, jmolloy, kristof.beyls.
rovka added subscribers: llvm-commits, rengolin.
Herald added a subscriber: aemerson.

Use the AddDefaultCC and AddDefaultPred helpers wherever it makes sense around
the ARM backend (instead of plain addReg(0) and respectively
addImm(AL).addReg(0)).

RFC 1:
We still have several places where we do .addImm(Pred).addReg(PredReg). Would it
be sensible to add another helper? Something like:
addPred(const MachineInstrBuilder &MIB, ARMCC::CondCodes Pred, unsigned PredReg = 0)

RFC 2:
These helpers are a bit, um, backwards. I would like to introduce an
ARMMachineInstrBuilder class inheriting from MachineInstrBuilder, that would have
addDefaultPred/CC methods.

This would allow us to change from:
AddDefaultPred(MIB.addSomeOperand().addSomeOtherOperand()
to:
MIB.addSomeOperand().addSomeOtherOperand().addDefaultPred()

IMO this would look much more natural (the order of the calls would match
the order of the operands).

RFC 3:
We have this pattern for the MCInstBuilder [1] as well (lots of places where
we call the same addImm(Pred).addReg(PredReg) on a MCInstBuilder instead
of a MachineInstrBuilder. Should we make AddDefaultPred/CC templates, so
we can use them at the MCInst layer as well?

[1] See ARMAsmPrinter.cpp


https://reviews.llvm.org/D27984

Files:
  lib/Target/ARM/ARMBaseInstrInfo.cpp
  lib/Target/ARM/ARMConstantIslandPass.cpp
  lib/Target/ARM/ARMExpandPseudoInsts.cpp
  lib/Target/ARM/ARMFrameLowering.cpp
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ThumbRegisterInfo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27984.82097.patch
Type: text/x-patch
Size: 23932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161220/af272b5b/attachment.bin>


More information about the llvm-commits mailing list