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;
}
Thank you,
Dan
_________________________________________________________________
Insert movie times and more without leaving HotmailĀ®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20090520/69c04440/attachment.html>
On May 20, 2009, at 2:22 PMPDT, dan mihai wrote:> 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.> 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; > } > > Thank you, > Dan-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090520/e6a62892/attachment.html>
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. -- Richard Osborne | XMOS http://www.xmos.com