Git Product home page Git Product logo

Comments (2)

chaudron avatar chaudron commented on August 22, 2024

I quickly looked at this, but if we take multiple expand outputs, the tool does not know the relation to each other (there is no linker input).

We could assume that if the function is called and present in the same .expand file it should matched against that specific one, and not a global one.

I do not know enough about the RTL expand output, but it looks like the flags could tell us the function is static or global:

a.c.233r.expand:(call_insn 5 2 0 2 (call (mem:QI (symbol_ref:DI ("a") [flags 0xc03] <function_decl 0x15036ef00 a>) [0 a S1 A8])
c.c.233r.expand:(call_insn 5 2 6 2 (call (mem:QI (symbol_ref:DI ("a") [flags 0x41] <function_decl 0x15192de00 a>) [0 a S1 A8])

With this, we could do detect if it links against global or local version, which could help a lot in optimizing the code. From a quick look on the web there is SYMBOL_FLAG_LOCAL and SYMBOL_FLAG_EXTERNAL which could help.

I'm rather busy, but if I get time I'll try to add support...

from cally.

matheustavares avatar matheustavares commented on August 22, 2024

Hi, @chaudron . I tried solving this problem but, apparently, -fdump-rtl-expand doesn't dump enough information. As stated here:

GCC was designed to use RTL internally only. Correct RTL for a given program is very dependent on the particular target machine. And the RTL does not contain all the information about the program.

But a friend of mine suggested using GCC's LTO feature to overcome this problem. Since LTO happens during link-time, it already has all the information from the different compilation unities. Using this idea and the gcc-python-plugin, I managed to write a plugin to dump the call graphs. In case you might want to take a look, it is at: https://github.com/matheustavares/gcc-callgraph-plugin

from cally.

Related Issues (3)

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.