This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Use searchable-table for banked registers
ClosedPublic

Authored by javed.absar on Aug 3 2017, 12:57 AM.

Details

Summary

This is a continuation of https://reviews.llvm.org/D36219

This patch uses reverse mapping (encoding->name) in ARMInstPrinter::printBankedRegOperand to get rid of hard-coded values (as pointed out by @olista01).

Diff Detail

Repository
rL LLVM

Event Timeline

javed.absar created this revision.Aug 3 2017, 12:57 AM
fhahn added inline comments.Aug 3 2017, 7:13 AM
lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
878 ↗(On Diff #109491)

How about using assert(TheReg && "invalid banked register operand"); instead of the if + assert + return ? The original code seems to behave similar to the assert (no early return in the error case)

881 ↗(On Diff #109491)

Why use a lowercase n instead of Name?

886 ↗(On Diff #109491)

can we just use an assert here and get rid of the if?

javed.absar marked an inline comment as done.Aug 3 2017, 8:38 PM
javed.absar added inline comments.
lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
886 ↗(On Diff #109491)

I don't see how that would work since its just a conditional action and not a constraint

Revised based on review comments

olista01 accepted this revision.Aug 4 2017, 2:02 AM

LGTM with one nit.

lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
880 ↗(On Diff #109679)

This comment isn't needed any more.

This revision is now accepted and ready to land.Aug 4 2017, 2:02 AM
fhahn added inline comments.Aug 4 2017, 2:03 AM
lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp
882 ↗(On Diff #109679)

Hm maybe we should rename R to isSPSR or something, to make that clearer or just get rid of the variable and move it into the condition (with a comment)

885 ↗(On Diff #109679)

Should this be Name (declared on line 878?)

fhahn edited edge metadata.Aug 4 2017, 2:04 AM

Besides the outstanding comments, LGTM

This revision was automatically updated to reflect the committed changes.