[PATCH] Remap frame variables used in outlined C++ exception handlers
Andy Kaylor
andrew.kaylor at intel.com
Thu Feb 19 14:02:15 PST 2015
Hi rnk, majnemer, ABataev,
These changes implement the code to find values referenced inside outlined catch and cleanup handlers and relocate them to a frame allocation structure that is shared by the parent function and the handlers.
During outlining, temporary allocas are created in the handler function to represent the variable. If the value referenced was an alloca in the parent frame, the mapping is simple. Otherwise, the value will need to be spilled. (Spilling isn't working yet.) As values are referenced in handlers, they are added to a map that will be used for resolution later.
After all handlers have been outlined, we walk the map and add each referenced variable to a structure definition and store the index for the corresponding element. When this is complete, we add bitcasts to all of the handlers (which already have an instruction to get a raw pointer to the frame allocation block), create a frame allocation call in the parent function and finally replace both original and temporary allocas with GEPs.
In the case of an alloca which is referenced from only one handler and is not used in the parent frame after the outlined function have been pruned, the alloca is simply erased from the parent and left in the handler. No entry in the frame allocation structure is created for such variables. (This will probably require some additional handling once spills are working.)
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7770
Files:
include/llvm/Transforms/Utils/Cloning.h
lib/CodeGen/WinEHPrepare.cpp
lib/Transforms/Utils/CloneFunction.cpp
test/CodeGen/X86/cppeh-catch-all.ll
test/CodeGen/X86/cppeh-catch-scalar.ll
test/CodeGen/X86/cppeh-frame-vars.ll
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7770.20337.patch
Type: text/x-patch
Size: 35768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150219/9d2da8df/attachment.bin>
More information about the llvm-commits
mailing list