[cfe-users] How to 'reloop' llvm code into ifs, whiles, fors?
Larry Evans via cfe-users
cfe-users at lists.llvm.org
Mon Nov 7 14:47:27 PST 2016
On 11/07/2016 02:37 PM, Philipp Klaus Krause via cfe-users wrote:
> On 06.11.2016 09:17, Hugh Perkins via cfe-users wrote:
>> Hi,
>>
>> I have a project to rewrite llvm output as OpenCL,
>> https://github.com/hughperkins/cuda-on-cl It currently contains lots of
>> conditional branches, whch become /labels / gotos in the output OpenCL.
>>
>> What options are available to 'reloop' this to contain strictly
>> ifs/fors/switches/breaks/whiles ?
>>
>> Hugh
>
> There is the Böhm-Jacopini theorem, but that will probably be
> inefficient, but necessary as a last resort for cases that can't
> behandled otherwise.
> The cbe (https://github.com/Ace17/llvm-cbe) seems to actually put some
> loop constructs in the output, even though teh actual control flow is
> done via goto, but the loop constructs there might help as a starting point.
>
> Philipp
You might try:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.50.7827&rep=rep1&type=pdf
which claims to remove goto's without code replication.
the method avoids problems of code replication
HTH.
/Larry
More information about the cfe-users
mailing list