-
Notifications
You must be signed in to change notification settings - Fork 23
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
"while" structring loses induction statements, was: "if" structuring doesn't work properly in tricky CFGs #31
Comments
Thanks for the report. I'm travelling most of this month, so not sure how soon I'll be able to look into details of this. So, usual questions would: a) complete stack trace; b) did you try to make a minimal reproduction testcase.
Taking literally what you provide, it would mean that neg() doesn't know how to negate a REG. You can quickly check if that's true by:
If that works as expected, then well, we need to teach neg() to be able to negate REGs like that. (It very well could be, because Xtensa I worked with is a classical RISC without flag register, so all conditions are indeed of the form |
I commented the above mentioned line out but I still cannot get the code correctly decompiled. Give me a day or two to figure out what's going wrong and to prepare a test case. |
Sounds good. I'm also overbusy with real life and didn't have a chance to look at it, but slowly coming back to hacking now (looking at other projects so far), so hope to get to it in few weeks too. |
Sorry for the delay with looking into this. So, fixing the crash for trivial: 9e2e886 But then structuring pass gives out rather nonsense. It detects while loop, even though to naked eye it's do-while with goto inside (so, maybe it's indeed optimized while, and SAB is smart!), but loses control variable of the loop, $ctr. So, I'm not closing this, but changing title, will be looking further. |
Oh, forgot suggestions:
|
And to capture the current output I get:
|
SAB fails to decompile the following real-world code:
It returns
AttributeError: 'REG' object has no attribute 'op'
After some debugging, I was able to spot the place of the failure: match_if is unable to negate the following condition:
My bet is that $cr0.gt cannot be substituted because its value changes across basic blocks. So it's left as is. Finally, match_if() fails because it expects COND to be an expression, not REG.
Any idea how to fix that?
The text was updated successfully, but these errors were encountered: