jump to function

Hello,

Is it possible to jump from one function to the beginning of another function?

For instance, assume wrapper_FOO is a wrapper for FOO. I replace the code

bar() {
FOO(…)
}

with

bar() {
wrapper_FOO(…)
}

Now, for efficiency, I’d like to have
wrapper_FOO() {

jump FOO;
}

Thank you,
Dan

Hello,

Is it possible to jump from one function to the beginning of another function?

This can’t be represented in llvm IR (or in standard C/C++). An optimization called (in LLVM) “tail call” will generate this at the assembly level, but not all back ends have this implemented.

dan mihai wrote:

Hello,

Is it possible to jump from one function to the beginning of another function?

For instance, assume wrapper_FOO is a wrapper for FOO. I replace the code
..............................
bar() {
FOO(...)
}
..............................
with
..............................
bar() {
  wrapper_FOO(...)
}
..............................

Now, for efficiency, I'd like to have
wrapper_FOO() {
  <do some work>
  jump FOO;
}

Tail call optimization can optimize calls into jumps. See http://llvm.org/docs/CodeGenerator.html#tailcallopt for details.