avr-llvm / llvm

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

Print the lower register when printing register pairs #98

Closed dylanmckay closed 9 years ago

dylanmckay commented 9 years ago

As of PR #96, the MOVW Rd+1:Rd, Rr+1:Rr instruction is properly parsed.

The problem is that GCC does not use this syntax. GCC prints the lower register to indicate the pair. For example, we print movw r17:r16, r19:r18 but GCC prints movw r16, r18.

Our assembly parser correctly handles both syntaxes. We should however print the latter syntax with the lower register, because otherwise GCC will not be able to compile assembly files generated by AVR-LLVM.

This should be as simple as implementing a custom operand printing function in AVRInstPrinter.cpp.

Note that once this issue is fixed, we will be able to correct a large number of AVR CodeGen tests marked XFAIL from issue #27. We could fix them to use the current (GCC incompatible) syntax right now, but it would be nicer if we fixed the problem as opposed to side-stepping it and having to update the tests in the future regardless.

agnat commented 9 years ago

Done in c095afadcd2898f88616731b5b6450b22b0633aa.

dylanmckay commented 9 years ago

I believe you are right, you're on a roll!