-
Notifications
You must be signed in to change notification settings - Fork 14
Invalid assembly generated: "Expected either Y or Z register" #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Related: avr-llvm/llvm#213 |
Looks like you pasted the LLVM IR again. |
Oops, sorry. The correct asm is:
|
Yes, |
Actually, isn't the real bug that it is using |
It could not because
That being said...
We should be able to make use of that to change this
into (pseudo ASM)
Which should reduce the number of usages of that register class |
Yes, I meant Unfortunately, changing the expansion to that still fails, but with a different error message now: in
(with this fails with
|
I've seen this number of times, it normally happens when you change something on a pseudo instruction. It looks like I've got a similar bug which I've fixed at avr-llvm/llvm#37, which was fixed in 26896ec4. In that case, there was just a typo. |
You're right, I can fix this by removing the |
OK, the problem then is that now I have the following in
but that
The problematic line is, of course, this one:
since I understand that Do we have any other, working examples of instructions that change one of their arguments as a side-effect? |
I'm still struggling with this; now because I haven't figured out yet how to tell in the definition of |
I think in this case we may actually need In this case, both In LLVM, in order to have an operand which is both input AND output, you define an input and you define a separate output. Then you add We also must add Obviously that because this pseudo instruction increments the
If you clobber Z, all you should need to do is define
You can see the definition of the
|
OK so I managed to solve the fundamental problem of However, the same approach doesn't seem to work for The reason for that is that |
I think avr-rust/llvm@331ded7 is safe for upstreaming on its own, even though it doesn't solve the |
Just took a peek at it and it looks good to me Added a personal note to upstream this in the next few days |
I should have held my horses -- I am now seeing CHIP-8 diverging at some point with the LDW fix :( Don't upstream it just yet, until I've had time to debug what's going on. |
That's algood, no rush :) |
It looks like this problem is caused because the The problem is that with 16-bit loads, we generate a I will adjust the |
Got a fix, upstreaming and cherry-picking now. |
Compiling this into
.s
results inbut turns out this is invalid (I guess the
ld
or theldd
withX
?); and so trying to generate machine code instead fails:The text was updated successfully, but these errors were encountered: