[LLVMdev] not to break 'for' statement into basic blocks
David A. Greene
greened at obbligato.org
Sat Jul 14 19:26:14 PDT 2007
On Saturday 14 July 2007 17:23, Anton Korobeynikov wrote:
> > 1) First, I tried to re-unite basic blocks which llvm-gcc spits out to
> > make 'for' again. But this is quite tricky. Generalizing it for the
> > optimzed llvm bytecode is not easy.
>
> I'd say 'is not possible at all'.
No, it certainly is possible. One does this, for example, when constructing
a control dependence graph. It can't be represented in llvm, so one needs
a higher-level abstraction. A control dependence graph is one such
abstraction.
Even llvm has a notion of "loops" that it extracts from the control flow
graph. Now, these are very low-level abstractions and probably won't work
for the purposes of this ISA.
And when you get difficult control behavior...
> However, I really don't see, how you can transform C code (in general)
> to your target, because C *has* explicit goto statement. Maybe you can
> split the whole CFG into "cycles" and "paths" and try to "lower" them.
> But this can be pretty complicated.
Again, gotos can be eliminated with some program analysis and transformation.
See, for example, http://citeseer.ist.psu.edu/22521.html.
-Dave
More information about the llvm-dev
mailing list