Giter Site home page Giter Site logo

Comments (7)

simonlindholm avatar simonlindholm commented on June 8, 2024 1

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.

simonlindholm avatar simonlindholm commented on June 8, 2024 1

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.

simonlindholm avatar simonlindholm commented on June 8, 2024

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.

InusualZ avatar InusualZ commented on June 8, 2024

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

And now it "work"
image

Maybe you can see also check if the function is variadic

from m2c.

simonlindholm avatar simonlindholm commented on June 8, 2024

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.

InusualZ avatar InusualZ commented on June 8, 2024

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.

InusualZ avatar InusualZ commented on June 8, 2024

Thank you, seems to be working correctly as far as I can see.

from m2c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.