summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2015-05-11 19:41:19 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2015-05-11 19:41:19 +0000
commit762a6bea1f28c5a9375b639ceedc4d1e378a7c88 (patch)
treef130d7ef77262e4e1b1d2cd7c0667b81e64bba4c /llvm/lib/CodeGen/AsmPrinter
parentba2d52291568ffaf5d99921ecba69acf62fa38cf (diff)
downloadbcm5719-llvm-762a6bea1f28c5a9375b639ceedc4d1e378a7c88.tar.gz
bcm5719-llvm-762a6bea1f28c5a9375b639ceedc4d1e378a7c88.zip
[WinEH] Update exception numbering to give handlers their own base state.
Differential Revision: http://reviews.llvm.org/D9512 llvm-svn: 237014
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
index b89ca011648..72aa4214f9a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp
@@ -299,6 +299,17 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
// The parent function and the catch handlers contribute to the 'ip2state'
// table.
+
+ // Include ip2state entries for the beginning of the main function and
+ // for catch handler functions.
+ if (F == ParentF) {
+ FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel, -1));
+ LastEHState = -1;
+ } else if (FuncInfo.HandlerBaseState.count(F)) {
+ FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel,
+ FuncInfo.HandlerBaseState[F]));
+ LastEHState = FuncInfo.HandlerBaseState[F];
+ }
for (const auto &MBB : *MF) {
for (const auto &MI : MBB) {
if (!MI.isEHLabel()) {
@@ -323,7 +334,8 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] &&
"Inconsistent landing pad map!");
- if (SawPotentiallyThrowing) {
+ // FIXME: Should this be using FuncInfo.HandlerBaseState?
+ if (SawPotentiallyThrowing && LastEHState != -1) {
FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel, -1));
SawPotentiallyThrowing = false;
LastEHState = -1;
OpenPOWER on IntegriCloud