[LLVMdev] Test compiler help

Reid Kleckner rnk at mit.edu
Wed Aug 19 15:04:03 PDT 2009


Alternatively, you could do your own trampolining, so that you don't
have to worry about whether tail call optimization is working.  Make
each state be a function that returns a function pointer to the next
state or NULL, and then make the main function call that pointer in a
loop.

Reid

On Wed, Aug 19, 2009 at 2:45 PM, Renato Golin<rengolin at systemcall.org> wrote:
> Hi All,
>
> Thanks for all the ideas, seems that the easiest approach is to create
> a single main function and work up the goto statement back and forth
> and put a return at the end of every block to avoid unwanted state
> change.
>
> Although, if I ever want to merge two pieces of code, which is not at
> all unlikely, I might have non-trivial problems. In that case, the
> tail call optimization seems a good idea to follow.
>
> Luckily, on both cases, a simple return should suffice to exit the program.
>
> I'm trying to make my code as educational as possible and maybe that
> can also help other people to understand the basics of LLVM (when it's
> finished)...
>
> cheers,
> --renato
>
> Reclaim your digital rights, eliminate DRM, learn more at
> http://www.defectivebydesign.org/what_is_drm
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list