avr-llvm / llvm

[MERGED UPSTREAM] AVR backend for the LLVM compiler library
220 stars 21 forks source link

Print pointer register names only when they are requested #125

Closed dylanmckay closed 9 years ago

dylanmckay commented 9 years ago

This PR changes AVRRegisterInfo.td to treat X, Y, and Z as aliases of r27:r26, r29:r28, and r31:r30 respectively.

It modifies TableGen to match based on register aliases as well as their names in AVRAsmParser::MatchRegisterName.

It also modifies the instruction printer to only print the X, Y, and Z aliases if the instruction has operands of type PTRREGS, PTRDISPREGS, or ZREGS. This causes movw r30, r28 to be printed unchanged - movw r30, r28, instead of movw Z, Y.

@agnat Could you look over this?

agnat commented 9 years ago

lol. I was working on the same patch.

Could you look over this?

Will do.

agnat commented 9 years ago

I finished my review. LGTM.

Oh, and since "register aliases" are ... something else, could you use "alt names" or the like in the final commit message?

agnat commented 9 years ago

Btw, I came across this little bug regarding alt names. Do you have any experience in pushing patches upstream?

dylanmckay commented 9 years ago

I don't, but I am under the impression that you attach a patch, describing it in an email, and send it to the llvm-commits list.

dylanmckay commented 9 years ago

I changed the behaviour from extending MatchRegisterName to adding MatchRegisterAltName, and renamed everything from "register alias" to "alternative name".

I also sent the target-agnostic part of the patch upstream (see the mailing list post here).

Committed in b21056bae1f11906de38cbdc301525174291a7ac.