echo "_Znwj" | c++filt<br>=> operator new(unsigned int)<br><br>echo "_Znaj" | c++filt<br>=> operator new[](unsigned int)<br><br>So yes, they are memory allocators. Names are just mangled.<br><br>Olivier.<br>
<br><br><div class="gmail_quote">On Fri, Oct 15, 2010 at 1:37 PM, Theresia Hansson <span dir="ltr"><<a href="mailto:theresia.hansson@gmail.com">theresia.hansson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I tried to compile this snippet of C++ code:<br>
<br>
void FuncTest() {<br>
    int* a = new int;<br>
    int* b = new int[2];<br>
}<br>
<br>
using:<br>
<br>
clang test.cpp -S -emit-llvm -o - > test.llvm<br>
<br>
and obtained this:<br>
<br>
define void @_Z8FuncTestv() {<br>
entry:<br>
  %a = alloca i32*, align 4<br>
  %b = alloca i32*, align 4<br>
  %call = call noalias i8* @_Znwj(i32 4)<br>
  %0 = bitcast i8* %call to i32*<br>
  store i32* %0, i32** %a, align 4<br>
  %call1 = call noalias i8* @_Znaj(i32 8)<br>
  %1 = bitcast i8* %call1 to i32*<br>
  store i32* %1, i32** %b, align 4<br>
  ret void<br>
}<br>
<br>
declare noalias i8* @_Znwj(i32)<br>
declare noalias i8* @_Znaj(i32)<br>
<br>
What I am wondering now is: where do the _Znwj and _Znaj symbols come<br>
from? Are they just randomly assigned or is there a system to it? I<br>
would like to be able to tell that the lines<br>
<br>
%call = call noalias i8* @_Znwj(i32 4)<br>
<br>
and<br>
<br>
%call1 = call noalias i8* @_Znaj(i32 8)<br>
<br>
perform memory allocations. But it does not look that promising...<br>
Some llvm expert here who has an idea?<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>