[LLVMdev] how to code a loop in llvm assembly

Ralph Corderoy ralph at inputplus.co.uk
Sat Apr 15 02:43:38 PDT 2006


Hi Simon,

> I've read over the "LLVM Language Reference Manual" a few times, and
> writing some ll code, but i'm stuck at a very basic point. How to
> decrement a counter variable ?

As Oscar pointed out, you need a phi-node.  I read some of the published
papers on LLVM before the Language Reference Manual and found them to be
of use.  You may also find Wikipedia's explanation of SSA useful,
especially the key paragraph

    http://en.wikipedia.org/wiki/Static_single_assignment_form

    "Note: the phi functions are not actually implemented; instead,
    they're just markers for the compiler to place the value of all the
    variables grouped together by the phi function, in the same location
    in memory (or same register)."

Cheers,


Ralph.





More information about the llvm-dev mailing list