[LLVMdev] How to always generate epilogue code?

Kai Nacke kai.nacke at redstar.de
Sat Jun 1 03:06:47 PDT 2013


Hi!

Nobody there who can give me a hint?

Regards
Kai

On 26.05.2013 13:22, Kai Nacke wrote:
> Hi!
>
> I am still working on the Win64 EH code and now have a pretty usable
> result. (The MC part is already posted to llvm-commits, the other
> part follows soon. If you are curious the whole patch is here:
> http://www.redstar.de/ldc/win64eh_all_20130524.diff.)
>
> However, in one case I have a problem with LLVM being too smart.
> Consider the following D code:
>
> void doIt()
> {
>      printf("doIt: start\n");
>      try
>      {
>          printf("doIt: try\n");
>          throw new Exception("Failure");
>      }
>      finally
>      {
>          printf("doIt: finally\n");
>      }
>      printf("doIt: end\n");
> }
>
> The code after the throw statement is unreachable. The last instruction
> of the finally block is a resume. LLVM now removes the last printf call
> and the epilogue code because it is all dead code. In fact the last
> instruction generated for this function is a call to the unwind_resume
> library function.
>
> Unfortunately Windows 64bit requires the epilogue code to perform the
> stack unwinding. In this special case it is not dead code but another
> form of metadata. See here:
> http://msdn.microsoft.com/en-us/library/8ydc79k6.aspx.
>
> Is there a simple way to always enforce the generation of the epilogue?
> E.g. can I mark the epilogue as always reachable?
>
> Regards
> Kai
> _______________________________________________
> 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