From 1b747ad8a0694b86e8d98a8b9a05ddfe74ec0cd3 Mon Sep 17 00:00:00 2001
From: Jim Grosbach
Date: Tue, 11 Aug 2009 00:09:57 +0000
Subject: [PATCH] SjLj based exception handling unwinding support. This patch
is nasty, brutish and short. Well, it's kinda short. Definitely nasty and
brutish.
The front-end generates the register/unregister calls into the SjLj runtime,
call-site indices and landing pad dispatch. The back end fills in the LSDA
with the call-site information provided by the front end. Catch blocks are
not yet implemented.
Built on Darwin and verified no llvm-core "make check" regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78625 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/ExceptionHandling.html | 39 ++++-
include/llvm/CodeGen/MachineFunction.h | 45 +++++
include/llvm/CodeGen/SelectionDAGNodes.h | 4 +
include/llvm/Intrinsics.td | 6 +-
include/llvm/Target/TargetAsmInfo.h | 10 +-
include/llvm/Target/TargetOptions.h | 12 +-
lib/CodeGen/AsmPrinter/DwarfException.cpp | 164 +++++++++++++-----
lib/CodeGen/AsmPrinter/DwarfException.h | 1 +
lib/CodeGen/LLVMTargetMachine.cpp | 13 +-
lib/CodeGen/MachineFunction.cpp | 3 +
lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 1 +
.../SelectionDAG/SelectionDAGBuild.cpp | 11 +-
lib/ExecutionEngine/JIT/JITEmitter.cpp | 8 +-
lib/Target/ARM/ARMConstantPoolValue.cpp | 2 +-
lib/Target/ARM/ARMConstantPoolValue.h | 2 +
lib/Target/ARM/ARMISelLowering.cpp | 31 ++++
lib/Target/ARM/ARMInstrInfo.td | 9 +-
lib/Target/ARM/ARMTargetAsmInfo.cpp | 6 +
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 2 +
lib/Target/CellSPU/SPUTargetAsmInfo.cpp | 2 +-
lib/Target/PowerPC/PPCTargetAsmInfo.cpp | 6 +-
lib/Target/TargetAsmInfo.cpp | 2 +-
lib/Target/TargetMachine.cpp | 12 +-
lib/Target/X86/X86TargetAsmInfo.cpp | 4 +-
tools/lto/LTOCodeGenerator.cpp | 16 +-
25 files changed, 332 insertions(+), 79 deletions(-)
diff --git a/docs/ExceptionHandling.html b/docs/ExceptionHandling.html
index 6ec6ab8233e..851ed1238be 100644
--- a/docs/ExceptionHandling.html
+++ b/docs/ExceptionHandling.html
@@ -33,6 +33,8 @@
llvm.eh.typeid.for
llvm.eh.sjlj.setjmp
llvm.eh.sjlj.longjmp
+ llvm.eh.sjlj.lsda
+ llvm.eh.sjlj.callsite
Asm Table Formats
@@ -414,7 +416,7 @@ a reference to a type info.
The SJLJ exception handling uses this intrinsic to force register saving
for the current function and to store the address of the following instruction
-for use as a destination address by
+for use as a destination address by
llvm.eh.sjlj.longjmp. The buffer format and the overall functioning
of this intrinsic is compatible with the GCC __builtin_setjmp
implementation, allowing code built with the two compilers to interoperate.
@@ -428,6 +430,41 @@ are available for use in a target-specific manner.
+
+
+
+
+
+ i8* %llvm.eh.sjlj.lsda( )
+
+
+
Used for SJLJ based exception handling, the
+ llvm.eh.sjlj.lsda intrinsic returns the address of the Language
+Specific Data Area (LSDA) for the current function. The SJLJ front-end code
+stores this address in the exception handling function context for use by
+the runtime.
+
+
+
+
+
+
+
+
+ void %llvm.eh.sjlj.callsite(i32)
+
+
+
The SJLJ front-end allocates call site indices for invoke instrucitons.
+These values are passed to the back-end via the
+llvm.eh.sjlj.callsite
+intrinsic, where they are used to build the LSDA call-site table.
+
+
+
Asm Table Formats
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 57c946c789a..f30cb821c1a 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -18,6 +18,7 @@
#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
#define LLVM_CODEGEN_MACHINEFUNCTION_H
+#include