diff options
author | Dale Johannesen <dalej@apple.com> | 2008-03-31 23:40:23 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-03-31 23:40:23 +0000 |
commit | 80caa49bb50211658df49e9340fc562e7c3db625 (patch) | |
tree | 21bb1802da1e2ff5e6c426b200ee4f75f87cb0c0 /lib/CodeGen/DwarfWriter.cpp | |
parent | 6e04eac0dd956243c4f2d275d01a8157bff53726 (diff) | |
download | external_llvm-80caa49bb50211658df49e9340fc562e7c3db625.zip external_llvm-80caa49bb50211658df49e9340fc562e7c3db625.tar.gz external_llvm-80caa49bb50211658df49e9340fc562e7c3db625.tar.bz2 |
Emit exception handling info for functions which are
not marked nounwind, or for all functions when -enable-eh
is set, provided the target supports Dwarf EH.
llvm-gcc generates nounwind in the right places; other FEs
will need to do so also. Given such a FE, -enable-eh should
no longer be needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/DwarfWriter.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index e72ff07..3296e11 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -2778,9 +2778,13 @@ private: std::vector<FunctionEHFrameInfo> EHFrames; - /// shouldEmit - Flag to indicate if debug information should be emitted. - /// + /// shouldEmit - Per-function flag to indicate if EH information should + /// be emitted. bool shouldEmit; + + /// shouldEmitModule - Per-module flag to indicate if EH information should + /// be emitted. + bool shouldEmitModule; /// EmitCommonEHFrame - Emit the common eh unwind frame. /// @@ -3368,6 +3372,7 @@ public: DwarfException(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) : Dwarf(OS, A, T, "eh") , shouldEmit(false) + , shouldEmitModule(false) {} virtual ~DwarfException() {} @@ -3387,7 +3392,7 @@ public: /// EndModule - Emit all exception information that should come after the /// content. void EndModule() { - if (!shouldEmit) return; + if (!shouldEmitModule) return; const std::vector<Function *> Personalities = MMI->getPersonalities(); for (unsigned i =0; i < Personalities.size(); ++i) @@ -3403,13 +3408,14 @@ public: void BeginFunction(MachineFunction *MF) { this->MF = MF; - if (MMI && - ExceptionHandling && + shouldEmit = false; + if ((ExceptionHandling || !MF->getFunction()->doesNotThrow()) && TAI->doesSupportExceptionHandling()) { shouldEmit = true; // Assumes in correct section after the entry point. EmitLabel("eh_func_begin", ++SubprogramCount); } + shouldEmitModule |= shouldEmit; } /// EndFunction - Gather and emit post-function exception information. |