It's a common pattern in GISel to have a MachineInstrBuilder from which we get various regs (commonly MIB->getOperand(0).getReg()). This adds a helper method and the above can be replaced with MIB.getOperandReg(0).
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Target/AArch64/AArch64LegalizerInfo.cpp | ||
---|---|---|
501 | Why does buildGEP use register inputs instead of SrcOp/DstOp like most of the other build functions? |
lib/Target/AArch64/AArch64LegalizerInfo.cpp | ||
---|---|---|
501 | I believe this was written way before the improvements to MachineIRBuilder and hasn't been updated since. |
If we're going to add a helper to shave some characters off, we might as well go for something really short like getOpReg().
That works for me as well. While this seems really trivial, this is repeated lots of times and gets annoying very quickly - kind of like MI->getMF() vs MI->getParent()->getParent().
Or simply getReg(unsigned OpIdx)---this would keep the names identical. Also, should there be something like this for subregs as well?
Why does buildGEP use register inputs instead of SrcOp/DstOp like most of the other build functions?