Comments (7)
Yeah, we already take into account function calls clobbering registers and such. But argument registers are very often used as temps, and called unknown functions are treated as writing to r3/r4/f1.
from m2c.
Fixed in 008adfc (for variadic functions, lmk if this generates too many false positives and I can back it out) and 6b6e139 (for functions not in context, based on the "unread register" heuristic).
from m2c.
Looks like we don't recognize that r5 is an argument to sprintf, so we optimize it out. Knowing which registers to pass as arguments to functions on ppc is difficult in general, unfortunately, though we should be able to add a heuristic that captures this particular case based on the deduction that the register is not used in any other way.
from m2c.
Ohh, I see.
I changed the function definition to:
void sprintf(char* __s, char* __format, unsigned int d); // @8045decc
from:
void sprintf(char* __s, char* __format, ...); // @8045deccZ
Maybe you can see also check if the function is variadic
from m2c.
And have variadic functions consume all the registers they can? Yeah, that's not unreasonable. Will lead to false positives but that may be okay given variadic functions are a rare case.
from m2c.
consume all the registers they can
I don't know if possible, but you can exclude most registers that haven't being touched since the last call to a function (before the call to the variadic)
from m2c.
Thank you, seems to be working correctly as far as I can see.
from m2c.
Related Issues (20)
- Investigate if/when `BinaryOp.negated()` should swap left/right for better matches
- Handle f64 values in phis
- Fix irregular switch labels so ordering is consecutive HOT 2
- Incorrect reordering of function calls & memory reads
- Common PPC instructions HOT 2
- GCC `if (thing - 12 < 3U)` pattern
- Internal error on empty glabel HOT 2
- Typedef ordering issue. HOT 2
- Better handling of instructions on 64bit variables HOT 1
- s32 typedef should be long instead of int in PPC code HOT 2
- PPC instruction stwu not parsing: maybe related to negative numbers HOT 2
- Recognize MWCCEPPC 1.3.2-specific `_savegpr_*`/`_restgpr_*` runtime helpers
- Redundant typedef causes m2c to hang
- PSP Allegrex Extended Instructions HOT 2
- Should non-ASCII contents in .asci blocks be rejected? HOT 4
- [BUG] Missing Stack Variable HOT 2
- [Bug] Does Absolutely Nothing HOT 9
- Issue decompiling from PowerPC ASM generated by IDA Pro HOT 7
- Unrecognized linker macro %gp_rel HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m2c.