[LLVMdev] Detail question about how to implement Win64 SEH

Duncan Sands baldrick at free.fr
Mon Sep 17 10:51:21 PDT 2012


Hi Kai,

> I try to add more functionality to Win64 exception handling, based on the posted
> patches from Charles Davis and João Matos.
>
> But I have a question about how to map SEH handling to LLVM IR.

are you sure you don't mean: map LLVM IR to SEH?  I.e. are you talking about
how to implement LLVM's "dwarf" exception handling intrinsics and landingpad
instruction using SEH?

Ciao, Duncan.

>
> The basic structure of SEH in C is as follows:
>
>    __try {
>      // Do something.
>    }
>    __except (filter(GetExceptionCode(), GetExceptionInformation()))
>    {
>      // Handle exception
>    }
>
> How to translate this?
>
> - The filter expression is basically a nested function which is called with the
> exception code and exception information.
> - The body of the __except statement is the landing pad. It is always executed
> if the filter expression returns 1.
> - The exception machinery first asks _C_specific_handler, which calls the filter
> expression and possible jump to the body of the __except statement.
>
> Everything looks fine except that I need a reference to the filter expression in
> order to generate the EH tables.
> Is there a way to associate the filter expression with the landingpad
> instruction? I am qite sure that I miss here some LLVM API or idiom....
>
> 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