Hi, Sorry for not being specific. I just wanted to know if there is any way at all to force clang to generate intermediate code for static functions when they are not being called anywhere inside the current module. Other compilers seem to generate intermediate code (lcc, for instance). Thanks for your reply..Olivier. Sincerely Arvind On Mon, Dec 14, 2009 at 1:10 PM, Olivier Meurant <meurant.olivier at gmail.com> wrote:> Hi Arvind, > > you need to use it effectively : > > > static int add(int a, int b) { > return a+b; > } > int use() { > return add(4,5); > } > > ==> > > ; ModuleID = '<stdin>' > target datalayout > "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" > target triple = "i386-pc-linux-gnu" > > define i32 @use() nounwind { > [...] > } > > define internal i32 @add(i32 %a, i32 %b) nounwind { > [...] > } > > Olivier. > > > On Mon, Dec 14, 2009 at 8:49 PM, Arvind Sudarsanam > <arvind.sudarsanam at aggiemail.usu.edu> wrote: >> >> Hi, >> >> I am trying to compile a single module (dgemm.c) using clang and >> generate dgemm.ll. >> Command: clang -emit-llvm dgemm.c -S -o dgemm.ll >> Some of the functions are declared as static and clang ignores these >> functions: >> >> One of the functions is: >> static void innerloop(double a, const double* b, double* c, double beta) >> { >> *b = a*beta; >> return; >> } >> >> Is there any way to make clang generate llvm code for the static >> functions? >> >> Thanks >> Sincerely >> Arvind >> >> -- >> Arvind Sudarsanam >> Utah State University >> Phone: (435) 512-7769 >> E-mail: theonemorpheus at gmail.com >> Web-site: http://cc.usu.edu/~asudarsanam >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- Arvind Sudarsanam Utah State University Phone: (435) 512-7769 E-mail: theonemorpheus at gmail.com Web-site: http://cc.usu.edu/~asudarsanam
On Dec 14, 2009, at 12:18 PM, Arvind Sudarsanam wrote:> Hi, > > Sorry for not being specific. I just wanted to know if there is any > way at all to force clang to generate intermediate code for static > functions when they are not being called anywhere inside the current > module. Other compilers seem to generate intermediate code (lcc, for > instance).You can mark it with 'attribute used'. Other than that, no, clang tries hard not to generate dead code. Also, in C++, it's not even valid to instantiate unused templates. -Chris
Ah ok. Sorry. :) I think that argument "-femit-all-decls" will help you. Olivier. On Mon, Dec 14, 2009 at 9:18 PM, Arvind Sudarsanam < arvind.sudarsanam at aggiemail.usu.edu> wrote:> Hi, > > Sorry for not being specific. I just wanted to know if there is any > way at all to force clang to generate intermediate code for static > functions when they are not being called anywhere inside the current > module. Other compilers seem to generate intermediate code (lcc, for > instance). > > Thanks for your reply..Olivier. > > Sincerely > Arvind > > On Mon, Dec 14, 2009 at 1:10 PM, Olivier Meurant > <meurant.olivier at gmail.com> wrote: > > Hi Arvind, > > > > you need to use it effectively : > > > > > > static int add(int a, int b) { > > return a+b; > > } > > int use() { > > return add(4,5); > > } > > > > ==> > > > > ; ModuleID = '<stdin>' > > target datalayout > > > "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" > > target triple = "i386-pc-linux-gnu" > > > > define i32 @use() nounwind { > > [...] > > } > > > > define internal i32 @add(i32 %a, i32 %b) nounwind { > > [...] > > } > > > > Olivier. > > > > > > On Mon, Dec 14, 2009 at 8:49 PM, Arvind Sudarsanam > > <arvind.sudarsanam at aggiemail.usu.edu> wrote: > >> > >> Hi, > >> > >> I am trying to compile a single module (dgemm.c) using clang and > >> generate dgemm.ll. > >> Command: clang -emit-llvm dgemm.c -S -o dgemm.ll > >> Some of the functions are declared as static and clang ignores these > >> functions: > >> > >> One of the functions is: > >> static void innerloop(double a, const double* b, double* c, double beta) > >> { > >> *b = a*beta; > >> return; > >> } > >> > >> Is there any way to make clang generate llvm code for the static > >> functions? > >> > >> Thanks > >> Sincerely > >> Arvind > >> > >> -- > >> Arvind Sudarsanam > >> Utah State University > >> Phone: (435) 512-7769 > >> E-mail: theonemorpheus at gmail.com > >> Web-site: http://cc.usu.edu/~asudarsanam<http://cc.usu.edu/%7Easudarsanam> > >> _______________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > > > > -- > Arvind Sudarsanam > Utah State University > Phone: (435) 512-7769 > E-mail: theonemorpheus at gmail.com > Web-site: http://cc.usu.edu/~asudarsanam<http://cc.usu.edu/%7Easudarsanam> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091214/ea52714b/attachment.html>
Hi Olivier, That worked....Thanks.... Arvind On Mon, Dec 14, 2009 at 1:44 PM, Olivier Meurant <meurant.olivier at gmail.com> wrote:> Ah ok. Sorry. :) > > I think that argument "-femit-all-decls" will help you. > > Olivier. > > On Mon, Dec 14, 2009 at 9:18 PM, Arvind Sudarsanam > <arvind.sudarsanam at aggiemail.usu.edu> wrote: >> >> Hi, >> >> Sorry for not being specific. I just wanted to know if there is any >> way at all to force clang to generate intermediate code for static >> functions when they are not being called anywhere inside the current >> module. Other compilers seem to generate intermediate code (lcc, for >> instance). >> >> Thanks for your reply..Olivier. >> >> Sincerely >> Arvind >> >> On Mon, Dec 14, 2009 at 1:10 PM, Olivier Meurant >> <meurant.olivier at gmail.com> wrote: >> > Hi Arvind, >> > >> > you need to use it effectively : >> > >> > >> > static int add(int a, int b) { >> > return a+b; >> > } >> > int use() { >> > return add(4,5); >> > } >> > >> > ==> >> > >> > ; ModuleID = '<stdin>' >> > target datalayout >> > >> > "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" >> > target triple = "i386-pc-linux-gnu" >> > >> > define i32 @use() nounwind { >> > [...] >> > } >> > >> > define internal i32 @add(i32 %a, i32 %b) nounwind { >> > [...] >> > } >> > >> > Olivier. >> > >> > >> > On Mon, Dec 14, 2009 at 8:49 PM, Arvind Sudarsanam >> > <arvind.sudarsanam at aggiemail.usu.edu> wrote: >> >> >> >> Hi, >> >> >> >> I am trying to compile a single module (dgemm.c) using clang and >> >> generate dgemm.ll. >> >> Command: clang -emit-llvm dgemm.c -S -o dgemm.ll >> >> Some of the functions are declared as static and clang ignores these >> >> functions: >> >> >> >> One of the functions is: >> >> static void innerloop(double a, const double* b, double* c, double >> >> beta) >> >> { >> >> *b = a*beta; >> >> return; >> >> } >> >> >> >> Is there any way to make clang generate llvm code for the static >> >> functions? >> >> >> >> Thanks >> >> Sincerely >> >> Arvind >> >> >> >> -- >> >> Arvind Sudarsanam >> >> Utah State University >> >> Phone: (435) 512-7769 >> >> E-mail: theonemorpheus at gmail.com >> >> Web-site: http://cc.usu.edu/~asudarsanam >> >> _______________________________________________ >> >> LLVM Developers mailing list >> >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >> > >> >> >> >> -- >> Arvind Sudarsanam >> Utah State University >> Phone: (435) 512-7769 >> E-mail: theonemorpheus at gmail.com >> Web-site: http://cc.usu.edu/~asudarsanam > >-- Arvind Sudarsanam Utah State University Phone: (435) 512-7769 E-mail: theonemorpheus at gmail.com Web-site: http://cc.usu.edu/~asudarsanam