[llvm-dev] Exception handling support for a target

Ben Craig via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 24 06:27:43 PST 2018


I apologize.  I had __builtin_eh_return confused with __builtin_unwind_init.  __builtin_unwind_init is the intrinsic that forces a register spill.  I don’t recall the purpose of __builtin_eh_return, and I don’t have access to the source that can clear that up.

From: 陳韋任 [mailto:chenwj.cs97g at g2.nctu.edu.tw]
Sent: Wednesday, January 24, 2018 5:47 AM
To: Ben Craig <ben.craig at ni.com>
Cc: Krzysztof Parzyszek <kparzysz at codeaurora.org>; llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Exception handling support for a target



2018-01-24 0:23 GMT+08:00 Ben Craig <ben.craig at ni.com<mailto:ben.craig at ni.com>>:
The high level of what happens is that __builtin_eh_return forces a spill of all the non-volatile registers.  The unwinder then has a starting point for populating and adjusting those non-volatile registers.

This approach usually requires that the function calling __builtin_eh_return be built without optimizations, because the optimizer will then remove the spills.

​Ben, thanks for your input. However, I don't quite understand what you said.

​The prototype of ​__builtin_eh_return (offset, handler) [1], I can't see why it forces spilling all non-volatile registers (I assume non-volatile == callee-saved).

​Take libgcc as an example, __built_eh_return is called in uw_install_context [1], which is called in the end of _Unwind_RaiseException [2]. Do you mean we should compile libgcc without optimization?

​[1] https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind-dw2.c<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_gcc-2Dmirror_gcc_blob_master_libgcc_unwind-2Ddw2.c&d=DwMFaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=W6d6aOAH-KJ7Ynpp4z785FyTUmIUd1NO1skuzIUgBm4&s=38ta3VPBIus_2t1eAF-ix92p_L4MzOXd0K9n-Q4N_RQ&e=>​
[2] https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind.inc<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_gcc-2Dmirror_gcc_blob_master_libgcc_unwind.inc&d=DwMFaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=W6d6aOAH-KJ7Ynpp4z785FyTUmIUd1NO1skuzIUgBm4&s=v9HwsMJYbHmIKG9qlQA06nazcYKBCmYRhvMrFOskSTU&e=>​

--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj<https://urldefense.proofpoint.com/v2/url?u=https-3A__people.cs.nctu.edu.tw_-7Echenwj&d=DwMFaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=y8mub81SfUi-UCZRX0Vl1g&m=W6d6aOAH-KJ7Ynpp4z785FyTUmIUd1NO1skuzIUgBm4&s=24Y5LxPst6gyesosBF_taeZwb0weE4iFnYpyccRODYs&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180124/5f51e9da/attachment.html>


More information about the llvm-dev mailing list