[LLVMdev] Explicitly Freeing Allocas

Nyx mcheva at cs.mcgill.ca
Thu Jun 18 08:12:18 PDT 2009


What kind of overhead does that have? Does it only restore the stack pointer
to what it was (what I want), or does it do more than that, and try to
restore values that were on the stack prior to save, etc?


Frits van Bommel wrote:
> 
> Nyx wrote:
>> Hello,
>> 
>> I would just like to ask if it's possible to explicitly free allocas.
>> This
>> is because I need to call functions that take structs of different sizes
>> as
>> input, (possibly inside of loops) and I would rather avoid a stack
>> overflow.
> 
> You can't explicitly free a specific alloca, but you can use the
> llvm.stacksave 
> and llvm.stackrestore intrinsics to free all allocas performed after
> calling the 
> stacksave intrinsic.
> 
> http://llvm.org/docs/LangRef.html#int_stacksave
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 

-- 
View this message in context: http://www.nabble.com/Explicitly-Freeing-Allocas-tp24093351p24095072.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list