Hi all! Now that LLVM has support for a larger attribute set, I think it is a good idea to add one that stops LLVM from generating segmented stacked version of a function. While implementing it, I ran into an issue: Currently, with segmented stacks enabled, LLVM sets the action for DYNAMIC_STACKALLOC to Custom, and lowers it into native X86 code. However, if a function has the nosegmentedstack attribute, DYNAMIC_STACKALLOC will need to be expanded. Is there some idiomatic way to choose whether a pseudo op is to be lowered or expanded based on some function attribute? Thanks! -- Sanjoy Das http://playingwithpointers.com
Hi Sanjoy,> Now that LLVM has support for a larger attribute set, I think it is a > good idea to add one that stops LLVM from generating segmented stacked > version of a function.why? If some functions have segmented stacks, don't all functions called by it need segmented stacks too? Ciao, Duncan. While implementing it, I ran into an issue:> > Currently, with segmented stacks enabled, LLVM sets the action for > DYNAMIC_STACKALLOC to Custom, and lowers it into native X86 code. > However, if a function has the nosegmentedstack attribute, > DYNAMIC_STACKALLOC will need to be expanded. Is there some idiomatic > way to choose whether a pseudo op is to be lowered or expanded based > on some function attribute? > > Thanks!
On Sat, Feb 04, 2012 at 09:57:29AM +0100, Duncan Sands wrote:> Hi Sanjoy, > > > Now that LLVM has support for a larger attribute set, I think it is a > > good idea to add one that stops LLVM from generating segmented stacked > > version of a function. > > why? If some functions have segmented stacks, don't all functions called > by it need segmented stacks too?No, the check for stack usage can be lifted. E.g. if you have the call graph A -- B -- C \- D -/ B can require the stack space for B, D and C and call the non-checking versions of them. Joerg
----- Original Message -----> From: "Sanjoy Das" <sanjoy at playingwithpointers.com> > To: "llvmdev at cs.uiuc.edu Mailing List" <llvmdev at cs.uiuc.edu> > Sent: Sunday, January 29, 2012 12:18:56 AM > Subject: [LLVMdev] nosegmentedstacks function attribute > > Hi all! > > Now that LLVM has support for a larger attribute set, I think it is a > good idea to add one that stops LLVM from generating segmented > stackedI'm glad to hear this news, Sanjoy. Rust currently generates some functions that run with segmented stacks and some that run on big stacks (for C interop and the main function). When we switch to the C stack we have to reconfigure the stack boundary so it doesn't trip the call to __morestack. It would be cleaner if we could just tell LLVM not to generate the check for these functions.