diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-14 14:06:15 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-14 14:06:15 +0000 |
commit | 2365f51ed03afe6993bae962fdc2e5a956a64cd5 (patch) | |
tree | 8b31c4075bfb21456ae1257eb68b2368220f7840 /include | |
parent | a73d11efd435cfa5ab275400c9881724f9224ca0 (diff) | |
download | external_llvm-2365f51ed03afe6993bae962fdc2e5a956a64cd5.zip external_llvm-2365f51ed03afe6993bae962fdc2e5a956a64cd5.tar.gz external_llvm-2365f51ed03afe6993bae962fdc2e5a956a64cd5.tar.bz2 |
Long live the exception handling!
This patch fills the last necessary bits to enable exceptions
handling in LLVM. Currently only on x86-32/linux.
In fact, this patch adds necessary intrinsics (and their lowering) which
represent really weird target-specific gcc builtins used inside unwinder.
After corresponding llvm-gcc patch will land (easy) exceptions should be
more or less workable. However, exceptions handling support should not be
thought as 'finished': I expect many small and not so small glitches
everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfo.h | 9 | ||||
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 11 | ||||
-rw-r--r-- | include/llvm/Intrinsics.td | 8 | ||||
-rw-r--r-- | include/llvm/Target/MRegisterInfo.h | 6 |
4 files changed, 32 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 1f9decf..778b75c 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -1030,6 +1030,9 @@ private: // Personalities - Vector of all personality functions ever seen. Used to emit // common EH frames. std::vector<Function *> Personalities; + + bool CallsEHReturn; + bool CallsUnwindInit; public: static char ID; // Pass identification, replacement for typeid @@ -1072,6 +1075,12 @@ public: /// needsFrameInfo - Returns true if we need to gather callee-saved register /// move info for the frame. bool needsFrameInfo() const; + + bool callsEHReturn() const { return CallsEHReturn; } + void setCallsEHReturn(bool b) { CallsEHReturn = b; } + + bool callsUnwindInit() const { return CallsUnwindInit; } + void setCallsUnwindInit(bool b) { CallsUnwindInit = b; } /// NextLabelID - Return the next unique label id. /// diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 316b02a..c96d516 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -110,6 +110,11 @@ namespace ISD { // to the current function's frame or return address, an index of one to the // parent's frame or return address, and so on. FRAMEADDR, RETURNADDR, + + // FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to + // first (possible) on-stack argument. This is needed for correct stack + // adjustment during unwind. + FRAME_TO_ARGS_OFFSET, // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the // address of the exception block on entry to an landing pad block. @@ -119,6 +124,12 @@ namespace ISD { // the selection index of the exception thrown. EHSELECTION, + // OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents + // 'eh_return' gcc dwarf builtin, which is used to return from + // exception. The general meaning is: adjust stack by OFFSET and pass + // execution to HANDLER. Many platform-related details also :) + EH_RETURN, + // TargetConstant* - Like Constant*, but the DAG does not do any folding or // simplification of the constant. TargetConstant, diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td index df3afde..e5bb2f6 100644 --- a/include/llvm/Intrinsics.td +++ b/include/llvm/Intrinsics.td @@ -233,6 +233,14 @@ def int_eh_selector : Intrinsic<[llvm_i32_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty]>; def int_eh_typeid_for : Intrinsic<[llvm_i32_ty, llvm_ptr_ty]>; +def int_eh_return : Intrinsic<[llvm_void_ty, llvm_i32_ty, llvm_ptr_ty]>, + GCCBuiltin<"__builtin_eh_return">; + +def int_eh_unwind_init: Intrinsic<[llvm_void_ty]>, + GCCBuiltin<"__builtin_unwind_init">; + +def int_eh_dwarf_cfa : Intrinsic<[llvm_ptr_ty, llvm_i32_ty]>; + //===---------------- Generic Variable Attribute Intrinsics----------------===// // def int_var_annotation : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty, diff --git a/include/llvm/Target/MRegisterInfo.h b/include/llvm/Target/MRegisterInfo.h index ecfe1ec..d2b76b8 100644 --- a/include/llvm/Target/MRegisterInfo.h +++ b/include/llvm/Target/MRegisterInfo.h @@ -396,12 +396,14 @@ public: /// callee saved registers on this target. The register should be in the /// order of desired callee-save stack frame offset. The first register is /// closed to the incoming stack pointer if stack grows down, and vice versa. - virtual const unsigned* getCalleeSavedRegs() const = 0; + virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF = 0) + const = 0; /// getCalleeSavedRegClasses - Return a null-terminated list of the preferred /// register classes to spill each callee saved register with. The order and /// length of this list match the getCalleeSaveRegs() list. - virtual const TargetRegisterClass* const *getCalleeSavedRegClasses() const =0; + virtual const TargetRegisterClass* const *getCalleeSavedRegClasses( + const MachineFunction *MF) const =0; /// getReservedRegs - Returns a bitset indexed by physical register number /// indicating if a register is a special register that has particular uses and |