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)
{
...
}
...
Hi Xiaolong,> First, there is a "indirect call node" dominating all other nodes > (include "main"). My question is: what does this special node serves > for?what version of LLVM are you using? I don't think LLVM 2.7 uses a "indirect call node". However it does use a "external node", which is used when a function external to the current module is called.> 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?These are generated by the C++ front-end, and represent the base object constructor and the complete object constructor respectively. Ciao, Duncan.
Hello Duncan, Thanks!> > First, there is a "indirect call node" dominating all other nodes > > (include "main"). My question is: what does this special node serves > > for? > > what version of LLVM are you using? I don't think LLVM 2.7 uses a > "indirect call node". However it does use a "external node", which > is used when a function external to the current module is called. >The "external node" makes sense. However, I am using LLVM 2.8. (See the output from "opt -version") and build it against Revision 105271 in the svn repository. So, can I say that the presence of "indirect call node" is new in LLVM 2.8? Low Level Virtual Machine (http://llvm.org/): llvm version 2.8svn DEBUG build with assertions. Built Jun 1 2010 (12:21:00). Host: x86_64-apple-darwin10 Host CPU: core2 Best, Xiaolong