On Thu, 2006-11-16 at 21:08 -0800, Chris Lattner wrote:> On Fri, 17 Nov 2006, Mohd-Hanafiah Abdullah wrote: > > After converting a piece of C++ code to C one of the functions that are > > generated is this: > > _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc > > This is defined in the C++ standard library. You can get the demangled > name like so: > $ c++filt _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc > std::basic_ostream<char, std::char_traits<char> >& std::operator<< > <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> > >&, char const*) > > > Where is it defined and where can I find the source for it? I need the > > source to compile it with a C compiler (AMPC) that will convert the C > > code to Java Bytecode. If the above function is in C++ then I need to > > convert it to C first. > > It comes with llvm-gcc4 in libstdc++. You'll need to compile it to > bytecode by modifying the makefile though.Thanks. Do I need to deal with the long names like _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc() or is there an option to use the shorter version? Cheers. Napi
Mohd-Hanafiah Abdullah wrote:> On Thu, 2006-11-16 at 21:08 -0800, Chris Lattner wrote: > >> On Fri, 17 Nov 2006, Mohd-Hanafiah Abdullah wrote: >> >>> After converting a piece of C++ code to C one of the functions that are >>> generated is this: >>> _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc >>> >> This is defined in the C++ standard library. You can get the demangled >> name like so: >> $ c++filt _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc >> std::basic_ostream<char, std::char_traits<char> >& std::operator<< >> <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >> >>> &, char const*) >>> >>> Where is it defined and where can I find the source for it? I need the >>> source to compile it with a C compiler (AMPC) that will convert the C >>> code to Java Bytecode. If the above function is in C++ then I need to >>> convert it to C first. >>> >> It comes with llvm-gcc4 in libstdc++. You'll need to compile it to >> bytecode by modifying the makefile though. >> > > Thanks. Do I need to deal with the long names like > _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc() or is there an > option to use the shorter version? >I don't think you will need to deal with any names. The C++ standard library has already been compiled to LLVM bytecode (it is part of the llvm-gcc/llvm-g++ distribution). If you use "llvm-g++ -lstdc++" it should link in whatever libstdc++ functions are needed by your program; they will get translated to C code along with the rest of your program when you use llc. -- John T.> Cheers. > > Napi > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
On Fri, 17 Nov 2006, John Criswell wrote:> I don't think you will need to deal with any names. The C++ standard > library has already been compiled to LLVM bytecode (it is part of the > llvm-gcc/llvm-g++ distribution). If you use "llvm-g++ -lstdc++" it > should link in whatever libstdc++ functions are needed by your program; > they will get translated to C code along with the rest of your program > when you use llc.Note that that only works with llvm-gcc3. With llvm-gcc4 you need to compile libstdc++ to bytecode explicitly. -Chris -- http://nondot.org/sabre/ http://llvm.org/