7

我正在尝试生成一个全面的调用图(完成对 Linux、运行时、很多的低级调用)。

我已经使用“-fdump-rtl-expand”静态编译了我的源文件并创建了 RTL 文件,我将其传递给名为埃及的 PERL 脚本(我相信它是 Graphviz/Dot)并生成了调用图的 PDF 文件。这完美地工作,完全没有问题。

除此之外,有些库被调用,这些库被显示为内置的。我想看看是否有办法不将调用图打印为库中的真实调用?

如果问题不清楚,请告诉我。

http://i.imgur.com/sp58v.jpg

基本上,我试图避免调用图生成 <built-in>

有没有办法做到这一点 ?

- - - - 代码 - - - - -

#include <cilk/cilk.h>
#include <stdio.h>
#include <stdlib.h>

unsigned long int t0, t5;
unsigned int NOSPAWN_THRESHOLD = 32;

int fib_nospawn(int n)
{
  if (n < 2) 
    return n;
  else 
    {
      int x = fib_nospawn(n-1);
      int y = fib_nospawn(n-2);
      return x + y;
    }
}

// spawning fibonacci function
int fib(long int n)
{
  long int x, y;
  if (n < 2) 
    return n;
  else if (n <= NOSPAWN_THRESHOLD)
    {
      x = fib_nospawn(n-1);
      y = fib_nospawn(n-2);
      return x + y;
    }
  else 
    {
      x = cilk_spawn fib(n-1);
      y = cilk_spawn fib(n-2);
      cilk_sync;
      return x + y;
    }
}

int main(int argc, char *argv[])
{
  int n;
  long int result;
  long int exec_time;

  n = atoi(argv[1]);
  NOSPAWN_THRESHOLD = atoi(argv[2]);
  result = fib(n);

  printf("%ld\n", result);
  return 0;
}

我从源代码编译了 Cilk 库。

4

2 回答 2

4

我可能已经找到了问题的部分解决方案

您需要将以下选项传递给埃及

--include-external

这产生了一个稍微更全面的调用图,尽管仍然有“可见

http://i.imgur.com/GWPJO.jpg?1

谁能建议我是否在调用图中获得更多深度?

于 2012-04-17T22:31:25.757 回答
0

You can use the GCC VCG Plugin: A gcc plugin, which can be loaded when debugging gcc, to show internal structures graphically.

gcc -fplugin=/path/to/vcg_plugin.so -fplugin-arg-vcg_plugin-cgraph foo.c

Call-graph is place to store data needed for inter-procedural optimization. All datastructures are divided into three components: local_info that is produced while analyzing the function, global_info that is result of global walking of the call-graph on the end of compilation and rtl_info used by RTL back-end to propagate data from already compiled functions to their callers.

于 2015-07-12T14:47:32.360 回答