[cfe-dev] stack-less model on small devices

Chris Lattner clattner at apple.com
Thu Apr 24 09:46:02 PDT 2008


On Apr 23, 2008, at 4:25 PM, Alireza.Moshtaghi at microchip.com wrote:
> Let me summarize...
> (patches)
> Ok, that makes sense to have the patches applied by someone else,
> however, my patches will surely break other peoples work. I'm just
> curious, how are you going to merge them? Conditional compiling?
> Commandline flags?

The best way to do this is to add a target to clang for your  
architecture, and conditionalize the codegen aspects on your target  
being active.  This means you'll be able to compile with 'clang t.c - 
arch myarch'.

> (alloca)
> We tried code generation in llvm by replacing alloca with global
> addresses however, (1) the name of local variable is not as easily
> available, (2)I don't feel quite comfortable with having the storage
> class of variable change at the last phase of translation. It sounds
> more reasonable to get it right in the front-end to begin with.

Using global variables should work reasonably well.  Just make sure  
they are marked as 'internal'.  The 'globalopt' pass will do SROA and  
other optimizations on them to help eliminate them.  I imagine that  
there are improvements we could also make, but there is nothing "in  
principle" that would prevent this from working.

-Chris



More information about the cfe-dev mailing list