[LLVMdev] Controlling the stack layout

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Dec 30 02:25:00 PST 2008


Hi Bill,

Bill Wendling wrote:
>
> I suppose that it's possible, though not as elegant. :-) What type of  
> information are you storing? 

I want to store a methodID, so that when walking the stack I know which 
function the frame belongs to.

> Is it stuff that is known before we  
> convert the LLVM IR into its DAG format for the back-end?

Yes. If I didn't need a fixed offset, I'd do:

ptr = alloca(MethodType)
store MethodId, ptr

>  If so, then  
> it's probably cleaner to go the way of the stack protector. It's  
> easier to send this information to the back-end so that it knows how  
> to set up the prologue and epilogue. I'm not too familiar with the  
> JIT, so I don't know if making this a machine function pass will work.
>
> In all, modifying LLVM to create a new intrinsic (a la stack  
> protectors) isn't all that much work. ;-) And modifying LLVM IR is  
> *much* easier than modifying its DAG format.
>   

Yeah, the intrinsic way is the easiest. It just looked nice to write 
that as a new pass and not modify the LLVM codebase.

Nicolas

> -bw
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list