<div dir="ltr">Stack colouring should be able to reuse the same stack space, if the live ranges of the pointers don't overlap. But I don't think anyone has built a general solution for alloca'd space.<br></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 4, 2013 at 6:30 AM, Ali Javadi <span dir="ltr"><<a href="mailto:aj14889@yahoo.com" target="_blank">aj14889@yahoo.com</a>></span> wrote:<br><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><br></div>