espressif / llvm-project

Fork of LLVM with Xtensa specific patches. To be upstreamed.
Other
229 stars 20 forks source link

tail call (LLVM-266) #72

Open yamt opened 1 year ago

yamt commented 1 year ago

there is a todo comment about tail call optimization: https://github.com/espressif/llvm-project/blob/6ef268936af6df777f165827ecc97a717b95f9fc/llvm/lib/Target/Xtensa/XtensaISelLowering.cpp#L1039-L1040

do you have any plans or ideas about implementation? i understand that it isn't straightforward with the windowed abi.

yamt commented 1 year ago

the current code just ignores the musttail attribute. it should bail out at least.

void
f(void)
{
        void g(void);
        __attribute__((musttail)) return g();
}
yamt commented 1 year ago

the current code just ignores the musttail attribute. it should bail out at least.

void
f(void)
{
        void g(void);
        __attribute__((musttail)) return g();
}

https://github.com/espressif/llvm-project/pull/73

andreisfr commented 1 year ago

Hi @yamt ! Thank you for comment, we have a plans about "tail call" implementation.

yamt commented 1 year ago

Hi @yamt ! Thank you for comment, we have a plans about "tail call" implementation.

are you implying a general implementation is possible? how? just curious.

when caller and callee happen to have the same frame size, maybe you can make it jump into callee+3. otherwise, i'm not sure how it can be done.

ProfFan commented 4 months ago

Hello @andreisfr do you know what is the status for tail call?