[LLVMdev] Explicitly Freeing Allocas

Frits van Bommel fvbommel at wxs.nl
Thu Jun 18 07:32:00 PDT 2009


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



More information about the llvm-dev mailing list