diff options
author | Reid Kleckner <rnk@google.com> | 2015-10-09 21:27:28 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-10-09 21:27:28 +0000 |
commit | e1c8a7f9c7e3614b5ab7141a0f520d71767de4e8 (patch) | |
tree | eb76ab45756702d1e71f4b48bcf75ec0d29427e4 /llvm/lib/CodeGen/AsmPrinter/WinException.cpp | |
parent | f6e237e60611f66b66e1e583383ad4664ddd8edd (diff) | |
download | bcm5719-llvm-e1c8a7f9c7e3614b5ab7141a0f520d71767de4e8.tar.gz bcm5719-llvm-e1c8a7f9c7e3614b5ab7141a0f520d71767de4e8.zip |
[SEH] Fix _except_handler4 table base states
We got them right for the old IR, but not with funclets. Port the old
test to the new IR and fix the code.
llvm-svn: 249906
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinException.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index 56a8b844ca5..a5172fdd7d7 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -902,7 +902,10 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) { for (SEHUnwindMapEntry &UME : FuncInfo.SEHUnwindMap) { MCSymbol *ExceptOrFinally = UME.Handler.get<MachineBasicBlock *>()->getSymbol(); - OS.EmitIntValue(UME.ToState, 4); // ToState + // -1 is usually the base state for "unwind to caller", but for + // _except_handler4 it's -2. Do that replacement here if necessary. + int ToState = UME.ToState == -1 ? BaseState : UME.ToState; + OS.EmitIntValue(ToState, 4); // ToState OS.EmitValue(create32bitRef(UME.Filter), 4); // Filter OS.EmitValue(create32bitRef(ExceptOrFinally), 4); // Except/Finally } |