[LLVMdev] Re: how to code a loop in llvm assembly

Reid Spencer reid at x10sys.com
Sat Apr 15 12:24:18 PDT 2006


FYI, in case you're wondering about the validity of this approach,
generating alloca instructions and relying on -mem2reg is what the C/C++
front ends do. It is a little more straight forward to code than
manually worrying about the PHI nodes. Either approach will work, take
your pick :)

Reid.

On Sat, 2006-04-15 at 09:13 -0500, Misha Brukman wrote:
> As others have pointed out, because LLVM is in SSA form, you will need
> to use a phi node.  To see how it would be written, try using the demo
> script as Oscar suggested, or you can do what you suggested (I would use
> alloca instead of malloc, though I think either should work) and then
> run it through "opt -mem2reg" to convert it to the phi-node form.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060415/d094d6e2/attachment.sig>


More information about the llvm-dev mailing list