Brian Fahs wrote:> Question 1:
>
> I am trying to get a function not to be inlined. What are llvm's rules
> pertaining to inlining? I have tried all of the standard gcc options
> for turning off inlining and they do not seem to work. Here is the
> sample code that I am working with:
With LLVM, the linker optimizes the bytecode (I believe this is to
allow for the inter-procedural optimizations that LLVM can do). IIRC,
the llvm-gcc options won't affect whether or not the LLVM linker (gccld)
inlines functions.
Try using the "-Wl,-disable-inlining" option to llvm-gcc/g++. That
should pass the option to gccld to tell it not to do any inlining. You
can use gccld --help to display other options that control gccld's
optimizations.
>
> #include <stdio.h>
>
> void print_string(char* strval);
>
> int main()
> {
> char* strval = "Hello world\n";
>
> while(1){
> print_string(strval);
> sleep(15);
> }
> return 0;
> }
>
> void
> print_string(char* strval)
> {
> int i;
> for(i=0;i<12;i++){
> putc(strval[i], stdout);
> }
> }
>
> gcc 3.2.2 does not inline this by default. Also, on
> llvm.cs.uiuc.edu/demo, the compiler does not inline the function.
> However, on my version of the compiler, the function print_string is
> inlined by default.
>
> Question 2:
>
> What is the behavior of the function "recompileAndRelinkFunction"
(in
> VM.{h,cpp}) if a program running in lli is currently executing within
> the function that is being recompiled?
Sorry. I don't know the answer to this question. Other members of the
LLVM team can answer this, but unfortunetly, most of them are at MICRO
this week.
If you really need an answer sooner rather than later, I can try to
find some time and dig into the function to see what it does. Or, if
you want, you can try jumping into the code and seeing what it does.
However, I find it odd that the JIT would try to recompile and relink a
function that is currently executing. I believe it only compiles
functions when they are called but not yet generated. Are you seeing
this behavior occur, or does your project require re-generating a
function that is currently running?
>
> Thanks in advance,
> Brian
>
> Brian M. Fahs
> Graduate Student
> University of Illinois
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
Regards,
John T. Criswell
--
*********************************************************************
* John T. Criswell Email: criswell at uiuc.edu *
* Research Programmer *
* University of Illinois at Urbana-Champaign *
* *
* "It's today!" said Piglet. "My favorite day," said
Pooh. *
*********************************************************************