[LLVMdev] Another two questions on LLVM

Eli Friedman eli.friedman at gmail.com
Mon Jun 7 12:33:05 PDT 2010

On Mon, Jun 7, 2010 at 12:03 PM, Xiaolong Tang <xiaolong.snake at gmail.com> wrote:
> Hi all,
> Considering the limit time I have for an implementation, I better ask
> for your inputs on a few questions. Any answer is to be much
> appreciated.
> First, how does LLVM handle the "new statement" of C++? Could any one
> give me any hint?

Try looking at the output of llvm-g++ or clang++.  Essentially, it
expands into a call to operator new and a call to the appropriate

> Second, what properties does the callgraph generated by LLVM has? One
> property I am interesting in is whether the callgraph is a safe
> approximation of its corresponding run-time callgraph.

It's safe in the sense that it's conservatively correct.

> Third, does LLVM provide any strategy to resolve function calls? If
> yes, what strategies does it employ?

LLVM has general constant propagation, which also applies to function
pointers.  There aren't really any strategies specific to indirect
calls, besides minor tweaks like varying inlining thresholds.
Resolving C++ virtual function calls is a problem which isn't
completely solved yet; see http://llvm.org/bugs/show_bug.cgi?id=3100 .


More information about the llvm-dev mailing list