[LLVMdev] Eliminating gotos
benedict.gaster at amd.com
Mon Aug 11 16:02:11 CDT 2008
We would like to develop a code generator using LLVM for a target language
that does not support conditional branches and in fact only supports
structured control flow, eg. If and while. As far as I can tell that the
problem with doing this in LLVM today, is that it does not support these
high-level constructs and instead all control flow is implemented as
It is ³fairly² straightforward to restructure a program written with
conditional/unconditional branches into to one that uses completely
high-level control flow structures, the algorithm I have in mind is
described in , the problem is how to best represent the resulting IL
within the LLVM framework:
1. Extend LLVM with news ops to support if/loop.
2. Implement this with the insertion of intrinsics to represent high-level
control-flow, introducing ³false² dependencies if necessary to allow
optimizations to be applied without changing the semantics.
3. Implement some structure of to the side that represents this high-level
 "Taming Control Flow: A structured approach to eliminating goto
statements", A.M. Erosa and L.J. Hedren, ICCL 1994
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LLVMdev