Move getDRegFromQReg generic function from ARMAsmParser to Utils where it belongs.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Why not use MCRegisterInfo::getSubReg for this purpose, thus avoiding repeating information that's already present in ARMRegisterInfo.td? MRI->getSubReg(QReg, ARM::dsub_0) should replace the functionality of getDRegFromQReg.
That's a good idea. Have done that instead. I don't see other uses of this function otherwise moving it to Utils as earlier would have been better i think.
Would it be possible to just used MRI->getSubReg(QReg, ARM::dsub_0) wherever getDRegFromQReg is called? It does not seem like having a getDRegFromQReg function adds much value now.
I count 8 instance of it being called, so woulld really prefer a separate function for clarity and let the compiler inline it.
Looks good to me. I agree it seems almost unnecessary to have a helper for MRI->getSubReg(QReg, ARM::dsub_0), but as Javed points out it's called many times and getDRegFromQReg is much more readable.
lib/Target/ARM/AsmParser/ARMAsmParser.cpp | ||
---|---|---|
268 ↗ | (On Diff #112715) | Yes indeed. Will do so before committing |