I am interested in analyzing the bytecode code produced for C files. By default, inlining of user and library functions (libc) is done. If I turn off inlining (-disable-inlining in gccas and gccld) then no inlining is done. I want to be able to inline user code but disallow library code to be inlined. In trying to understand the InlineSimple.cpp code, I see that library functions are tagged as having internal linkage, just as other user functions in a module, and so these library functions are inlined if they satisfy other inlining rules (e.g., strcpy() is quite often inlined). My questions: - is there a simple way to disallow inlining of library functions? - in what part of the code tree is the internal linkage attribute being set for library functions? I am using LLVM1.9 (due to a dependency of some C code on gcc3.4) but I'd imagine that this functionality hasn't changed much in more recent versions. Thanks, Cristina
Try adding the gcc 'noinline' attribute to functions you don't want inlined (see the gcc docs for details). Ciao, Duncan.
The defined gcc interface for this is -fno-builtin. It seems not be to be working in llvm-gcc, however. On Feb 20, 2008, at 6:55 PM, Cristina Cifuentes wrote:> I am interested in analyzing the bytecode code produced for C files. > By default, inlining of user and library functions (libc) is done. If > I turn off inlining (-disable-inlining in gccas and gccld) then no > inlining is done. I want to be able to inline user code but disallow > library code to be inlined. > > In trying to understand the InlineSimple.cpp code, I see that library > functions are tagged as having internal linkage, just as other user > functions in a module, and so these library functions are inlined if > they satisfy other inlining rules (e.g., strcpy() is quite often > inlined). > > My questions: > - is there a simple way to disallow inlining of library functions? > - in what part of the code tree is the internal linkage attribute > being set for library functions? > > I am using LLVM1.9 (due to a dependency of some C code on gcc3.4) but > I'd imagine that this functionality hasn't changed much in more recent > versions. > > Thanks, > Cristina > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Feb 20, 2008, at 6:55 PM, Cristina Cifuentes wrote:> - in what part of the code tree is the internal linkage attribute > being set for library functions?Internalize pass (Transforms/IPO/Internalize.cpp) sets internal linkage if the function is not in export list. If you're using 'llvm- ld' try -disable-internalize. - Devang
On Thu, 21 Feb 2008, Dale Johannesen wrote:> The defined gcc interface for this is -fno-builtin. It seems not be > to be working in llvm-gcc, however.Please file a reduced testcase in bugzilla, -Chris> >> I am interested in analyzing the bytecode code produced for C files. >> By default, inlining of user and library functions (libc) is done. If >> I turn off inlining (-disable-inlining in gccas and gccld) then no >> inlining is done. I want to be able to inline user code but disallow >> library code to be inlined. >> >> In trying to understand the InlineSimple.cpp code, I see that library >> functions are tagged as having internal linkage, just as other user >> functions in a module, and so these library functions are inlined if >> they satisfy other inlining rules (e.g., strcpy() is quite often >> inlined). >> >> My questions: >> - is there a simple way to disallow inlining of library functions? >> - in what part of the code tree is the internal linkage attribute >> being set for library functions? >> >> I am using LLVM1.9 (due to a dependency of some C code on gcc3.4) but >> I'd imagine that this functionality hasn't changed much in more recent >> versions. >> >> Thanks, >> Cristina >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-Chris -- http://nondot.org/sabre/ http://llvm.org/
This option doesn't always help as various C library functions are built-in into the compiler. Regards, Cristina On Feb 21, 2008, at 7:32 PM, Duncan Sands wrote:> Try adding the gcc 'noinline' attribute to functions you don't > want inlined (see the gcc docs for details). > > Ciao, > > Duncan.
On Feb 22, 2008, at 9:30 AM, Devang Patel wrote:> > On Feb 20, 2008, at 6:55 PM, Cristina Cifuentes wrote: > >> - in what part of the code tree is the internal linkage attribute >> being set for library functions? > > > Internalize pass (Transforms/IPO/Internalize.cpp) sets internal > linkage if the function is not in export list. If you're using 'llvm- > ld' try -disable-internalize.This is equivalent to using the -fno-builtin option in llvm-gcc. Regards, Cristina> > > - > Devang > > >
Seemingly Similar Threads
- [LLVMdev] Removing inlining of library functions
- [LLVMdev] Removing inlining of library functions
- [LLVMdev] Removing inlining of library functions
- [LLVMdev] Removing inlining of library functions
- [LLVMdev] Does the gcc frontend do inlining or deadcode elimination ?