[LLVMdev] Two quick questions on call graph nodes

Xiaolong Tang xiaolong.snake at gmail.com
Sun Jun 6 06:11:09 PDT 2010


Hello all, 

When I examined the callgraph generated by LLVM via this command: 

  opt -print-callgraph-sccs -dot-callgraph a.out.bc

I ran into two confusions: 

First, there is a "indirect call node" dominating all other nodes
(include "main"). My question is: what does this special node serves
for? 

Second, there are two identical functions except that the functions
have slightly different names. 

  define void @_ZN6StringC2Ev(%struct.String* %this) nounwind ssp {}
  define void @_ZN6StringC1Ev(%struct.String* %this) nounwind ssp {} 

So, why is it so? 

Thanks!

best, 
Xiaolong

PS: My running example is a simple code as below: 

  #include "string.h"

  int main()
  {
    String y, z;
    String x("Hello World!");
    y = x; // strongly update y
    z = y; // use y
    return 0;
  }

The string class definition is: 

  class String {
  public:
    // Default constructor
    String();

    // Copy constructor
    String(const String& that);

    // One argument constructor that takes a character array as the initial
    //  value for the string
    String(const char str[]);

    // Destructor
    ~String();

    // Assignment operator
    String& operator=(const String& that);
                                                                          
  private:
    int length;
    int capacity;
    char* buffer;
  };

  String::String() : capacity(0), length(0), buffer(0)
  {
    // Nothing else to do
  }
                                                                          
  String::String(const String& that) 
  {
    ...
  }

  ...



More information about the llvm-dev mailing list