Skip to content
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

Targeted Procedure In-lining #46

Open
Thomas-Malcolm opened this issue Jul 20, 2023 · 0 comments
Open

Targeted Procedure In-lining #46

Thomas-Malcolm opened this issue Jul 20, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Thomas-Malcolm
Copy link
Member

NOTE: whether or not this development is worth completing is dependent on whether procedure in-lining will be of use to us at all. Consult Mark / Kirsten / Nick before committing any serious amount of time to this.

The broad CFG generation algorithm goes:

  1. Generate intra-procedural CFG for each known procedure
  2. While not at inline depth, for each leaf call node in those intra-procedural CFGs, inline that procedure.
  3. At inline depth, for each leaf call node, link that (as an inter-procedural call edge) to the target's intra-procedural CFG.

This feature targets step (2). Currently the approach to in-lining is flat, in the sense we have a maximum in-line depth, and we continue to inline every leaf call node we identify until we reach that depth. One of the main problems with in-lining is that it increases space complexity exponentially, which is not fantastic. However, some optimisations can be made. Instead of blindly in-lining every function we come across, we can introduce a "smarter" approach to this which in-lines certain functions to certain depths.

There are a couple ways this could be achieved. We could request input from the user, e.g. via a config, to specify manual inline depths - though this is cumbersome, and the less input required from the user the better. Another approach is to profile certain procedures and decide how much to in-line them. For example, it is pointless to in-line a self-recursive function 5 times. We can also blacklist procedures to bar them from being in-lined, e.g., ELF internal functions such as frame_dummy. There are a number of approaches that could be taken, some with different benefits, of which Mark / Kirsten / Nick should be consulted to make a decision on what's best.

@Thomas-Malcolm Thomas-Malcolm added the enhancement New feature or request label Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant