<p dir="ltr">We treat allocas in the entry block as normal stack space and allocas outside the entry block as similar to C alloca calls. You likely want all of your local variables allocated in the entry block. It should help. </p>

<div class="gmail_quote">On Nov 3, 2013 12:04 PM, "Ali Javadi" <<a href="mailto:aj14889@yahoo.com">aj14889@yahoo.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>Hi,</div><div><br></div><div>In my llvm code I want to create some function calls. The function prototype is as follows: </div><div>  </div><div><div>int memoize ( char *function_name, </div>
<div>               <span style="white-space:pre-wrap">           </span>int *int_params, unsigned num_ints,</div><div><span style="white-space:pre-wrap">      </span>               double *double_params, unsigned num_doubles)</div></div>
<div><br></div><div>In order to create these calls I do the following for example:</div><div><br></div><div>  %88 = <b>alloca</b> [7 x i8]</div><div>  store volatile [7 x i8] c"ORACLE\00", [7 x i8]* %88</div><div>
  %89 = getelementptr [7 x i8]* %88, i32 0, i32 0</div><div>  </div><div>  %90 = <b>alloca</b> [1 x i32]</div><div>  %91 = getelementptr inbounds [1 x i32]* %90, i32 0, i32 0</div><div>  store volatile i32 3, i32* %91</div>
<div>  %92 = getelementptr inbounds [1 x i32]* %90, i32 0, i32 0</div><div>  </div><div>  %93 = <b>alloca</b> [0 x double]</div><div>  %94 = getelementptr inbounds [0 x double]* %93, i32 0, i32 0</div><div><br></div><div>
  %95 = call i32 @memoize(i8* %89, i32* %92, i32 1, double* %94, i32 0)</div><div><br></div><div>This works, but I need to create *many* such function calls in one "parent" function, and eventually all the "<b>alloca</b>" instructions add up to overflowing the stack. So I have two questions:</div>
<div><br></div><div>a) Is it possible to create the arrays for my function call args without using the alloca instruction (maybe use heap)?</div><div>b) If not, can I release those alloca'd spaces during the function execution and not after it returns?</div>
<div><br></div><div>Thanks,</div><div>Ali</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div>