Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 1 | //===-- CodeGen/AsmPrinter/DwarfException.cpp - Dwarf Exception Impl ------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 10 | // This file contains support for writing DWARF exception info into asm files. |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "DwarfException.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/SmallString.h" |
| 16 | #include "llvm/ADT/StringExtras.h" |
| 17 | #include "llvm/ADT/Twine.h" |
Chris Lattner | da790ea | 2010-04-05 05:28:23 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/AsmPrinter.h" |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineFrameInfo.h" |
David Greene | a5be1b1 | 2009-08-19 21:55:33 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/MachineFunction.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/MachineModuleInfo.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 22 | #include "llvm/IR/DataLayout.h" |
Rafael Espindola | 894843c | 2014-01-07 21:19:40 +0000 | [diff] [blame] | 23 | #include "llvm/IR/Mangler.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 24 | #include "llvm/IR/Module.h" |
Chris Lattner | b866602 | 2009-09-16 01:46:41 +0000 | [diff] [blame] | 25 | #include "llvm/MC/MCAsmInfo.h" |
| 26 | #include "llvm/MC/MCContext.h" |
| 27 | #include "llvm/MC/MCExpr.h" |
Bill Wendling | bf56268 | 2009-09-10 01:12:47 +0000 | [diff] [blame] | 28 | #include "llvm/MC/MCSection.h" |
Chris Lattner | 4b7dadb | 2009-08-19 05:49:37 +0000 | [diff] [blame] | 29 | #include "llvm/MC/MCStreamer.h" |
Chris Lattner | 555ceabe | 2010-01-16 18:37:32 +0000 | [diff] [blame] | 30 | #include "llvm/MC/MCSymbol.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 31 | #include "llvm/Support/Dwarf.h" |
| 32 | #include "llvm/Support/ErrorHandling.h" |
| 33 | #include "llvm/Support/FormattedStream.h" |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 34 | #include "llvm/Support/LEB128.h" |
Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 35 | #include "llvm/Target/TargetFrameLowering.h" |
Chris Lattner | c16c75e | 2009-08-02 01:34:32 +0000 | [diff] [blame] | 36 | #include "llvm/Target/TargetLoweringObjectFile.h" |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 37 | #include "llvm/Target/TargetOptions.h" |
Chris Lattner | c16c75e | 2009-08-02 01:34:32 +0000 | [diff] [blame] | 38 | #include "llvm/Target/TargetRegisterInfo.h" |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 39 | using namespace llvm; |
| 40 | |
Chris Lattner | 1198002 | 2010-04-04 07:48:20 +0000 | [diff] [blame] | 41 | DwarfException::DwarfException(AsmPrinter *A) |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 42 | : Asm(A), MMI(Asm->MMI) {} |
Bill Wendling | dd20b98 | 2009-05-15 01:18:50 +0000 | [diff] [blame] | 43 | |
Bill Wendling | fcc1414 | 2010-04-07 09:28:04 +0000 | [diff] [blame] | 44 | DwarfException::~DwarfException() {} |
Bill Wendling | dd20b98 | 2009-05-15 01:18:50 +0000 | [diff] [blame] | 45 | |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 46 | /// SharedTypeIds - How many leading type ids two landing pads have in common. |
| 47 | unsigned DwarfException::SharedTypeIds(const LandingPadInfo *L, |
| 48 | const LandingPadInfo *R) { |
| 49 | const std::vector<int> &LIds = L->TypeIds, &RIds = R->TypeIds; |
| 50 | unsigned LSize = LIds.size(), RSize = RIds.size(); |
| 51 | unsigned MinSize = LSize < RSize ? LSize : RSize; |
| 52 | unsigned Count = 0; |
| 53 | |
| 54 | for (; Count != MinSize; ++Count) |
| 55 | if (LIds[Count] != RIds[Count]) |
| 56 | return Count; |
| 57 | |
| 58 | return Count; |
| 59 | } |
| 60 | |
| 61 | /// PadLT - Order landing pads lexicographically by type id. |
| 62 | bool DwarfException::PadLT(const LandingPadInfo *L, const LandingPadInfo *R) { |
| 63 | const std::vector<int> &LIds = L->TypeIds, &RIds = R->TypeIds; |
| 64 | unsigned LSize = LIds.size(), RSize = RIds.size(); |
| 65 | unsigned MinSize = LSize < RSize ? LSize : RSize; |
| 66 | |
| 67 | for (unsigned i = 0; i != MinSize; ++i) |
| 68 | if (LIds[i] != RIds[i]) |
| 69 | return LIds[i] < RIds[i]; |
| 70 | |
| 71 | return LSize < RSize; |
| 72 | } |
| 73 | |
Bill Wendling | 6c574d8 | 2009-07-28 23:23:00 +0000 | [diff] [blame] | 74 | /// ComputeActionsTable - Compute the actions table and gather the first action |
| 75 | /// index for each landing pad site. |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 76 | unsigned DwarfException:: |
| 77 | ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads, |
| 78 | SmallVectorImpl<ActionEntry> &Actions, |
| 79 | SmallVectorImpl<unsigned> &FirstActions) { |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 80 | |
| 81 | // The action table follows the call-site table in the LSDA. The individual |
| 82 | // records are of two types: |
| 83 | // |
| 84 | // * Catch clause |
| 85 | // * Exception specification |
| 86 | // |
| 87 | // The two record kinds have the same format, with only small differences. |
| 88 | // They are distinguished by the "switch value" field: Catch clauses |
| 89 | // (TypeInfos) have strictly positive switch values, and exception |
| 90 | // specifications (FilterIds) have strictly negative switch values. Value 0 |
| 91 | // indicates a catch-all clause. |
| 92 | // |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 93 | // Negative type IDs index into FilterIds. Positive type IDs index into |
| 94 | // TypeInfos. The value written for a positive type ID is just the type ID |
| 95 | // itself. For a negative type ID, however, the value written is the |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 96 | // (negative) byte offset of the corresponding FilterIds entry. The byte |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 97 | // offset is usually equal to the type ID (because the FilterIds entries are |
| 98 | // written using a variable width encoding, which outputs one byte per entry |
| 99 | // as long as the value written is not too large) but can differ. This kind |
| 100 | // of complication does not occur for positive type IDs because type infos are |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 101 | // output using a fixed width encoding. FilterOffsets[i] holds the byte |
| 102 | // offset corresponding to FilterIds[i]. |
Bill Wendling | 4505734 | 2009-07-29 21:19:44 +0000 | [diff] [blame] | 103 | |
| 104 | const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 105 | SmallVector<int, 16> FilterOffsets; |
| 106 | FilterOffsets.reserve(FilterIds.size()); |
| 107 | int Offset = -1; |
Bill Wendling | 4505734 | 2009-07-29 21:19:44 +0000 | [diff] [blame] | 108 | |
| 109 | for (std::vector<unsigned>::const_iterator |
| 110 | I = FilterIds.begin(), E = FilterIds.end(); I != E; ++I) { |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 111 | FilterOffsets.push_back(Offset); |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 112 | Offset -= getULEB128Size(*I); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 113 | } |
| 114 | |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 115 | FirstActions.reserve(LandingPads.size()); |
| 116 | |
| 117 | int FirstAction = 0; |
| 118 | unsigned SizeActions = 0; |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 119 | const LandingPadInfo *PrevLPI = 0; |
Bill Wendling | 4505734 | 2009-07-29 21:19:44 +0000 | [diff] [blame] | 120 | |
Bill Wendling | 23b177e | 2009-07-28 23:44:43 +0000 | [diff] [blame] | 121 | for (SmallVectorImpl<const LandingPadInfo *>::const_iterator |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 122 | I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) { |
| 123 | const LandingPadInfo *LPI = *I; |
| 124 | const std::vector<int> &TypeIds = LPI->TypeIds; |
Chris Lattner | 07c1b94 | 2010-04-04 20:10:41 +0000 | [diff] [blame] | 125 | unsigned NumShared = PrevLPI ? SharedTypeIds(LPI, PrevLPI) : 0; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 126 | unsigned SizeSiteActions = 0; |
| 127 | |
| 128 | if (NumShared < TypeIds.size()) { |
| 129 | unsigned SizeAction = 0; |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 130 | unsigned PrevAction = (unsigned)-1; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 131 | |
| 132 | if (NumShared) { |
Chris Lattner | 07c1b94 | 2010-04-04 20:10:41 +0000 | [diff] [blame] | 133 | unsigned SizePrevIds = PrevLPI->TypeIds.size(); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 134 | assert(Actions.size()); |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 135 | PrevAction = Actions.size() - 1; |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 136 | SizeAction = getSLEB128Size(Actions[PrevAction].NextAction) + |
| 137 | getSLEB128Size(Actions[PrevAction].ValueForTypeID); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 138 | |
| 139 | for (unsigned j = NumShared; j != SizePrevIds; ++j) { |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 140 | assert(PrevAction != (unsigned)-1 && "PrevAction is invalid!"); |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 141 | SizeAction -= getSLEB128Size(Actions[PrevAction].ValueForTypeID); |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 142 | SizeAction += -Actions[PrevAction].NextAction; |
| 143 | PrevAction = Actions[PrevAction].Previous; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 144 | } |
| 145 | } |
| 146 | |
| 147 | // Compute the actions. |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 148 | for (unsigned J = NumShared, M = TypeIds.size(); J != M; ++J) { |
| 149 | int TypeID = TypeIds[J]; |
| 150 | assert(-1 - TypeID < (int)FilterOffsets.size() && "Unknown filter id!"); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 151 | int ValueForTypeID = TypeID < 0 ? FilterOffsets[-1 - TypeID] : TypeID; |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 152 | unsigned SizeTypeID = getSLEB128Size(ValueForTypeID); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 153 | |
| 154 | int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0; |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 155 | SizeAction = SizeTypeID + getSLEB128Size(NextAction); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 156 | SizeSiteActions += SizeAction; |
| 157 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 158 | ActionEntry Action = { ValueForTypeID, NextAction, PrevAction }; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 159 | Actions.push_back(Action); |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 160 | PrevAction = Actions.size() - 1; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 161 | } |
| 162 | |
| 163 | // Record the first action of the landing pad site. |
| 164 | FirstAction = SizeActions + SizeSiteActions - SizeAction + 1; |
| 165 | } // else identical - re-use previous FirstAction |
| 166 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 167 | // Information used when created the call-site table. The action record |
| 168 | // field of the call site record is the offset of the first associated |
| 169 | // action record, relative to the start of the actions table. This value is |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 170 | // biased by 1 (1 indicating the start of the actions table), and 0 |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 171 | // indicates that there are no actions. |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 172 | FirstActions.push_back(FirstAction); |
| 173 | |
| 174 | // Compute this sites contribution to size. |
| 175 | SizeActions += SizeSiteActions; |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 176 | |
| 177 | PrevLPI = LPI; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 178 | } |
| 179 | |
Bill Wendling | 1fddd87 | 2009-07-28 23:22:13 +0000 | [diff] [blame] | 180 | return SizeActions; |
| 181 | } |
| 182 | |
Bill Wendling | e412064 | 2009-11-12 21:59:20 +0000 | [diff] [blame] | 183 | /// CallToNoUnwindFunction - Return `true' if this is a call to a function |
| 184 | /// marked `nounwind'. Return `false' otherwise. |
| 185 | bool DwarfException::CallToNoUnwindFunction(const MachineInstr *MI) { |
Evan Cheng | 7f8e563 | 2011-12-07 07:15:52 +0000 | [diff] [blame] | 186 | assert(MI->isCall() && "This should be a call instruction!"); |
Bill Wendling | e412064 | 2009-11-12 21:59:20 +0000 | [diff] [blame] | 187 | |
| 188 | bool MarkedNoUnwind = false; |
| 189 | bool SawFunc = false; |
| 190 | |
| 191 | for (unsigned I = 0, E = MI->getNumOperands(); I != E; ++I) { |
| 192 | const MachineOperand &MO = MI->getOperand(I); |
| 193 | |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 194 | if (!MO.isGlobal()) continue; |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 195 | |
Dan Gohman | bcaf681 | 2010-04-15 01:51:59 +0000 | [diff] [blame] | 196 | const Function *F = dyn_cast<Function>(MO.getGlobal()); |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 197 | if (F == 0) continue; |
Bill Wendling | c781d7a | 2009-11-12 23:13:08 +0000 | [diff] [blame] | 198 | |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 199 | if (SawFunc) { |
| 200 | // Be conservative. If we have more than one function operand for this |
| 201 | // call, then we can't make the assumption that it's the callee and |
| 202 | // not a parameter to the call. |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 203 | // |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 204 | // FIXME: Determine if there's a way to say that `F' is the callee or |
| 205 | // parameter. |
| 206 | MarkedNoUnwind = false; |
| 207 | break; |
Bill Wendling | e412064 | 2009-11-12 21:59:20 +0000 | [diff] [blame] | 208 | } |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 209 | |
| 210 | MarkedNoUnwind = F->doesNotThrow(); |
| 211 | SawFunc = true; |
Bill Wendling | e412064 | 2009-11-12 21:59:20 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | return MarkedNoUnwind; |
| 215 | } |
| 216 | |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 217 | /// ComputeCallSiteTable - Compute the call-site table. The entry for an invoke |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 218 | /// has a try-range containing the call, a non-zero landing pad, and an |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 219 | /// appropriate action. The entry for an ordinary call has a try-range |
| 220 | /// containing the call and zero for the landing pad and the action. Calls |
| 221 | /// marked 'nounwind' have no entry and must not be contained in the try-range |
| 222 | /// of any entry - they form gaps in the table. Entries must be ordered by |
| 223 | /// try-range address. |
| 224 | void DwarfException:: |
| 225 | ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites, |
| 226 | const RangeMapType &PadMap, |
| 227 | const SmallVectorImpl<const LandingPadInfo *> &LandingPads, |
| 228 | const SmallVectorImpl<unsigned> &FirstActions) { |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 229 | // The end label of the previous invoke or nounwind try-range. |
Chris Lattner | 34adc8d | 2010-03-14 01:41:15 +0000 | [diff] [blame] | 230 | MCSymbol *LastLabel = 0; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 231 | |
| 232 | // Whether there is a potentially throwing instruction (currently this means |
| 233 | // an ordinary call) between the end of the previous try-range and now. |
| 234 | bool SawPotentiallyThrowing = false; |
| 235 | |
Bill Wendling | 23b177e | 2009-07-28 23:44:43 +0000 | [diff] [blame] | 236 | // Whether the last CallSite entry was for an invoke. |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 237 | bool PreviousIsInvoke = false; |
| 238 | |
| 239 | // Visit all instructions in order of address. |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 240 | for (MachineFunction::const_iterator I = Asm->MF->begin(), E = Asm->MF->end(); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 241 | I != E; ++I) { |
| 242 | for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end(); |
| 243 | MI != E; ++MI) { |
Rafael Espindola | 736bec8 | 2014-03-06 16:31:40 +0000 | [diff] [blame^] | 244 | if (!MI->isEHLabel()) { |
Evan Cheng | 7f8e563 | 2011-12-07 07:15:52 +0000 | [diff] [blame] | 245 | if (MI->isCall()) |
Bill Wendling | e412064 | 2009-11-12 21:59:20 +0000 | [diff] [blame] | 246 | SawPotentiallyThrowing |= !CallToNoUnwindFunction(MI); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 247 | continue; |
| 248 | } |
| 249 | |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 250 | // End of the previous try-range? |
Chris Lattner | ff1fdd6 | 2010-03-14 08:17:53 +0000 | [diff] [blame] | 251 | MCSymbol *BeginLabel = MI->getOperand(0).getMCSymbol(); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 252 | if (BeginLabel == LastLabel) |
| 253 | SawPotentiallyThrowing = false; |
| 254 | |
| 255 | // Beginning of a new try-range? |
Jeffrey Yasskin | b40d3f7 | 2009-11-10 01:02:17 +0000 | [diff] [blame] | 256 | RangeMapType::const_iterator L = PadMap.find(BeginLabel); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 257 | if (L == PadMap.end()) |
| 258 | // Nope, it was just some random label. |
| 259 | continue; |
| 260 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 261 | const PadRange &P = L->second; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 262 | const LandingPadInfo *LandingPad = LandingPads[P.PadIndex]; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 263 | assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] && |
| 264 | "Inconsistent landing pad map!"); |
| 265 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 266 | // For Dwarf exception handling (SjLj handling doesn't use this). If some |
| 267 | // instruction between the previous try-range and this one may throw, |
| 268 | // create a call-site entry with no landing pad for the region between the |
| 269 | // try-ranges. |
Anton Korobeynikov | 9be547c | 2011-01-14 21:58:08 +0000 | [diff] [blame] | 270 | if (SawPotentiallyThrowing && Asm->MAI->isExceptionHandlingDwarf()) { |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 271 | CallSiteEntry Site = { LastLabel, BeginLabel, 0, 0 }; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 272 | CallSites.push_back(Site); |
| 273 | PreviousIsInvoke = false; |
| 274 | } |
| 275 | |
| 276 | LastLabel = LandingPad->EndLabels[P.RangeIndex]; |
| 277 | assert(BeginLabel && LastLabel && "Invalid landing pad!"); |
| 278 | |
Chris Lattner | 17d3859 | 2010-03-31 06:09:04 +0000 | [diff] [blame] | 279 | if (!LandingPad->LandingPadLabel) { |
| 280 | // Create a gap. |
| 281 | PreviousIsInvoke = false; |
| 282 | } else { |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 283 | // This try-range is for an invoke. |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 284 | CallSiteEntry Site = { |
| 285 | BeginLabel, |
| 286 | LastLabel, |
| 287 | LandingPad->LandingPadLabel, |
| 288 | FirstActions[P.PadIndex] |
| 289 | }; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 290 | |
Jim Grosbach | 5afbf2b | 2009-09-01 17:19:13 +0000 | [diff] [blame] | 291 | // Try to merge with the previous call-site. SJLJ doesn't do this |
Anton Korobeynikov | 9be547c | 2011-01-14 21:58:08 +0000 | [diff] [blame] | 292 | if (PreviousIsInvoke && Asm->MAI->isExceptionHandlingDwarf()) { |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 293 | CallSiteEntry &Prev = CallSites.back(); |
| 294 | if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) { |
| 295 | // Extend the range of the previous entry. |
| 296 | Prev.EndLabel = Site.EndLabel; |
| 297 | continue; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | // Otherwise, create a new call-site. |
Anton Korobeynikov | 9be547c | 2011-01-14 21:58:08 +0000 | [diff] [blame] | 302 | if (Asm->MAI->isExceptionHandlingDwarf()) |
Jim Grosbach | 54c0530 | 2010-01-28 01:45:32 +0000 | [diff] [blame] | 303 | CallSites.push_back(Site); |
| 304 | else { |
| 305 | // SjLj EH must maintain the call sites in the order assigned |
| 306 | // to them by the SjLjPrepare pass. |
| 307 | unsigned SiteNo = MMI->getCallSiteBeginLabel(BeginLabel); |
| 308 | if (CallSites.size() < SiteNo) |
| 309 | CallSites.resize(SiteNo); |
| 310 | CallSites[SiteNo - 1] = Site; |
| 311 | } |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 312 | PreviousIsInvoke = true; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | // If some instruction between the previous try-range and the end of the |
| 318 | // function may throw, create a call-site entry with no landing pad for the |
| 319 | // region following the try-range. |
Anton Korobeynikov | 9be547c | 2011-01-14 21:58:08 +0000 | [diff] [blame] | 320 | if (SawPotentiallyThrowing && Asm->MAI->isExceptionHandlingDwarf()) { |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 321 | CallSiteEntry Site = { LastLabel, 0, 0, 0 }; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 322 | CallSites.push_back(Site); |
| 323 | } |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 324 | } |
| 325 | |
Bill Wendling | 2cf0014 | 2009-07-29 00:50:05 +0000 | [diff] [blame] | 326 | /// EmitExceptionTable - Emit landing pads and actions. |
| 327 | /// |
| 328 | /// The general organization of the table is complex, but the basic concepts are |
| 329 | /// easy. First there is a header which describes the location and organization |
| 330 | /// of the three components that follow. |
Eric Christopher | d517ac0 | 2009-08-28 22:33:43 +0000 | [diff] [blame] | 331 | /// |
Bill Wendling | 2cf0014 | 2009-07-29 00:50:05 +0000 | [diff] [blame] | 332 | /// 1. The landing pad site information describes the range of code covered by |
| 333 | /// the try. In our case it's an accumulation of the ranges covered by the |
| 334 | /// invokes in the try. There is also a reference to the landing pad that |
| 335 | /// handles the exception once processed. Finally an index into the actions |
| 336 | /// table. |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 337 | /// 2. The action table, in our case, is composed of pairs of type IDs and next |
Bill Wendling | 2cf0014 | 2009-07-29 00:50:05 +0000 | [diff] [blame] | 338 | /// action offset. Starting with the action index from the landing pad |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 339 | /// site, each type ID is checked for a match to the current exception. If |
Bill Wendling | 2cf0014 | 2009-07-29 00:50:05 +0000 | [diff] [blame] | 340 | /// it matches then the exception and type id are passed on to the landing |
| 341 | /// pad. Otherwise the next action is looked up. This chain is terminated |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 342 | /// with a next action of zero. If no type id is found then the frame is |
Bill Wendling | 2cf0014 | 2009-07-29 00:50:05 +0000 | [diff] [blame] | 343 | /// unwound and handling continues. |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 344 | /// 3. Type ID table contains references to all the C++ typeinfo for all |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 345 | /// catches in the function. This tables is reverse indexed base 1. |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 346 | void DwarfException::EmitExceptionTable() { |
Dan Gohman | bcaf681 | 2010-04-15 01:51:59 +0000 | [diff] [blame] | 347 | const std::vector<const GlobalVariable *> &TypeInfos = MMI->getTypeInfos(); |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 348 | const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); |
| 349 | const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads(); |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 350 | |
| 351 | // Sort the landing pads in order of their type ids. This is used to fold |
| 352 | // duplicate actions. |
| 353 | SmallVector<const LandingPadInfo *, 64> LandingPads; |
| 354 | LandingPads.reserve(PadInfos.size()); |
| 355 | |
| 356 | for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) |
| 357 | LandingPads.push_back(&PadInfos[i]); |
| 358 | |
| 359 | std::sort(LandingPads.begin(), LandingPads.end(), PadLT); |
| 360 | |
| 361 | // Compute the actions table and gather the first action index for each |
| 362 | // landing pad site. |
| 363 | SmallVector<ActionEntry, 32> Actions; |
| 364 | SmallVector<unsigned, 64> FirstActions; |
Bill Wendling | 7742b64 | 2010-02-10 21:41:57 +0000 | [diff] [blame] | 365 | unsigned SizeActions=ComputeActionsTable(LandingPads, Actions, FirstActions); |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 366 | |
| 367 | // Invokes and nounwind calls have entries in PadMap (due to being bracketed |
| 368 | // by try-range labels when lowered). Ordinary calls do not, so appropriate |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 369 | // try-ranges for them need be deduced when using DWARF exception handling. |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 370 | RangeMapType PadMap; |
| 371 | for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) { |
| 372 | const LandingPadInfo *LandingPad = LandingPads[i]; |
| 373 | for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) { |
Chris Lattner | 34adc8d | 2010-03-14 01:41:15 +0000 | [diff] [blame] | 374 | MCSymbol *BeginLabel = LandingPad->BeginLabels[j]; |
Bill Wendling | b67440e | 2009-07-29 00:31:35 +0000 | [diff] [blame] | 375 | assert(!PadMap.count(BeginLabel) && "Duplicate landing pad labels!"); |
| 376 | PadRange P = { i, j }; |
| 377 | PadMap[BeginLabel] = P; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | // Compute the call-site table. |
| 382 | SmallVector<CallSiteEntry, 64> CallSites; |
Jim Grosbach | 486be66 | 2009-08-17 16:41:22 +0000 | [diff] [blame] | 383 | ComputeCallSiteTable(CallSites, PadMap, LandingPads, FirstActions); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 384 | |
| 385 | // Final tallies. |
| 386 | |
| 387 | // Call sites. |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 388 | bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj; |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 389 | bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true; |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 390 | |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 391 | unsigned CallSiteTableLength; |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 392 | if (IsSJLJ) |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 393 | CallSiteTableLength = 0; |
Chris Lattner | 07c1b94 | 2010-04-04 20:10:41 +0000 | [diff] [blame] | 394 | else { |
| 395 | unsigned SiteStartSize = 4; // dwarf::DW_EH_PE_udata4 |
| 396 | unsigned SiteLengthSize = 4; // dwarf::DW_EH_PE_udata4 |
| 397 | unsigned LandingPadSize = 4; // dwarf::DW_EH_PE_udata4 |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 398 | CallSiteTableLength = |
Chris Lattner | 07c1b94 | 2010-04-04 20:10:41 +0000 | [diff] [blame] | 399 | CallSites.size() * (SiteStartSize + SiteLengthSize + LandingPadSize); |
| 400 | } |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 401 | |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 402 | for (unsigned i = 0, e = CallSites.size(); i < e; ++i) { |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 403 | CallSiteTableLength += getULEB128Size(CallSites[i].Action); |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 404 | if (IsSJLJ) |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 405 | CallSiteTableLength += getULEB128Size(i); |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 406 | } |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 407 | |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 408 | // Type infos. |
Chris Lattner | c16c75e | 2009-08-02 01:34:32 +0000 | [diff] [blame] | 409 | const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection(); |
Anton Korobeynikov | ae4ccc1 | 2010-02-15 22:35:59 +0000 | [diff] [blame] | 410 | unsigned TTypeEncoding; |
Bill Wendling | 9e5c206 | 2009-09-10 06:27:16 +0000 | [diff] [blame] | 411 | unsigned TypeFormatSize; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 412 | |
Bill Wendling | bf56268 | 2009-09-10 01:12:47 +0000 | [diff] [blame] | 413 | if (!HaveTTData) { |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 414 | // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say |
| 415 | // that we're omitting that bit. |
Anton Korobeynikov | ae4ccc1 | 2010-02-15 22:35:59 +0000 | [diff] [blame] | 416 | TTypeEncoding = dwarf::DW_EH_PE_omit; |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 417 | // dwarf::DW_EH_PE_absptr |
Chandler Carruth | 5da3f05 | 2012-11-01 09:14:31 +0000 | [diff] [blame] | 418 | TypeFormatSize = Asm->getDataLayout().getPointerSize(); |
Chris Lattner | 47fc235 | 2009-07-31 22:03:47 +0000 | [diff] [blame] | 419 | } else { |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 420 | // Okay, we have actual filters or typeinfos to emit. As such, we need to |
| 421 | // pick a type encoding for them. We're about to emit a list of pointers to |
| 422 | // typeinfo objects at the end of the LSDA. However, unless we're in static |
| 423 | // mode, this reference will require a relocation by the dynamic linker. |
Chris Lattner | f4b92a8 | 2009-07-31 22:18:14 +0000 | [diff] [blame] | 424 | // |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 425 | // Because of this, we have a couple of options: |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 426 | // |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 427 | // 1) If we are in -static mode, we can always use an absolute reference |
| 428 | // from the LSDA, because the static linker will resolve it. |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 429 | // |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 430 | // 2) Otherwise, if the LSDA section is writable, we can output the direct |
| 431 | // reference to the typeinfo and allow the dynamic linker to relocate |
| 432 | // it. Since it is in a writable section, the dynamic linker won't |
| 433 | // have a problem. |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 434 | // |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 435 | // 3) Finally, if we're in PIC mode and the LDSA section isn't writable, |
| 436 | // we need to use some form of indirection. For example, on Darwin, |
| 437 | // we can output a statically-relocatable reference to a dyld stub. The |
| 438 | // offset to the stub is constant, but the contents are in a section |
| 439 | // that is updated by the dynamic linker. This is easy enough, but we |
| 440 | // need to tell the personality function of the unwinder to indirect |
| 441 | // through the dyld stub. |
| 442 | // |
Bill Wendling | bf56268 | 2009-09-10 01:12:47 +0000 | [diff] [blame] | 443 | // FIXME: When (3) is actually implemented, we'll have to emit the stubs |
Chris Lattner | 7005cd3 | 2009-08-02 03:59:56 +0000 | [diff] [blame] | 444 | // somewhere. This predicate should be moved to a shared location that is |
| 445 | // in target-independent code. |
| 446 | // |
Anton Korobeynikov | ae4ccc1 | 2010-02-15 22:35:59 +0000 | [diff] [blame] | 447 | TTypeEncoding = Asm->getObjFileLowering().getTTypeEncoding(); |
Chris Lattner | e619c0d | 2010-04-04 20:20:50 +0000 | [diff] [blame] | 448 | TypeFormatSize = Asm->GetSizeOfEncodedValue(TTypeEncoding); |
Bill Wendling | 243ac56 | 2009-09-10 02:07:37 +0000 | [diff] [blame] | 449 | } |
Bill Wendling | bf56268 | 2009-09-10 01:12:47 +0000 | [diff] [blame] | 450 | |
Bill Wendling | 243ac56 | 2009-09-10 02:07:37 +0000 | [diff] [blame] | 451 | // Begin the exception table. |
Anton Korobeynikov | fe3a6e0 | 2011-01-30 22:07:31 +0000 | [diff] [blame] | 452 | // Sometimes we want not to emit the data into separate section (e.g. ARM |
| 453 | // EHABI). In this case LSDASection will be NULL. |
Anton Korobeynikov | b15beb2 | 2011-01-24 22:38:40 +0000 | [diff] [blame] | 454 | if (LSDASection) |
| 455 | Asm->OutStreamer.SwitchSection(LSDASection); |
Chris Lattner | 9e06e53 | 2010-04-28 01:05:45 +0000 | [diff] [blame] | 456 | Asm->EmitAlignment(2); |
Bill Wendling | bf56268 | 2009-09-10 01:12:47 +0000 | [diff] [blame] | 457 | |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 458 | // Emit the LSDA. |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 459 | MCSymbol *GCCETSym = |
Chris Lattner | eec9bf1 | 2010-03-10 02:48:06 +0000 | [diff] [blame] | 460 | Asm->OutContext.GetOrCreateSymbol(Twine("GCC_except_table")+ |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 461 | Twine(Asm->getFunctionNumber())); |
Chris Lattner | eec9bf1 | 2010-03-10 02:48:06 +0000 | [diff] [blame] | 462 | Asm->OutStreamer.EmitLabel(GCCETSym); |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 463 | Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("exception", |
| 464 | Asm->getFunctionNumber())); |
Bill Wendling | 243ac56 | 2009-09-10 02:07:37 +0000 | [diff] [blame] | 465 | |
Chris Lattner | eec9bf1 | 2010-03-10 02:48:06 +0000 | [diff] [blame] | 466 | if (IsSJLJ) |
Chris Lattner | a179b52 | 2010-04-04 19:25:43 +0000 | [diff] [blame] | 467 | Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("_LSDA_", |
| 468 | Asm->getFunctionNumber())); |
Bill Wendling | 243ac56 | 2009-09-10 02:07:37 +0000 | [diff] [blame] | 469 | |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 470 | // Emit the LSDA header. |
Chris Lattner | b75af3c | 2010-04-04 20:04:21 +0000 | [diff] [blame] | 471 | Asm->EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart"); |
| 472 | Asm->EmitEncodingByte(TTypeEncoding, "@TType"); |
Bill Wendling | 243ac56 | 2009-09-10 02:07:37 +0000 | [diff] [blame] | 473 | |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 474 | // The type infos need to be aligned. GCC does this by inserting padding just |
| 475 | // before the type infos. However, this changes the size of the exception |
| 476 | // table, so you need to take this into account when you output the exception |
| 477 | // table size. However, the size is output using a variable length encoding. |
| 478 | // So by increasing the size by inserting padding, you may increase the number |
| 479 | // of bytes used for writing the size. If it increases, say by one byte, then |
| 480 | // you now need to output one less byte of padding to get the type infos |
| 481 | // aligned. However this decreases the size of the exception table. This |
| 482 | // changes the value you have to output for the exception table size. Due to |
| 483 | // the variable length encoding, the number of bytes used for writing the |
| 484 | // length may decrease. If so, you then have to increase the amount of |
| 485 | // padding. And so on. If you look carefully at the GCC code you will see that |
| 486 | // it indeed does this in a loop, going on and on until the values stabilize. |
| 487 | // We chose another solution: don't output padding inside the table like GCC |
| 488 | // does, instead output it before the table. |
| 489 | unsigned SizeTypes = TypeInfos.size() * TypeFormatSize; |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 490 | unsigned CallSiteTableLengthSize = getULEB128Size(CallSiteTableLength); |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 491 | unsigned TTypeBaseOffset = |
| 492 | sizeof(int8_t) + // Call site format |
| 493 | CallSiteTableLengthSize + // Call site table length size |
| 494 | CallSiteTableLength + // Call site table length |
| 495 | SizeActions + // Actions size |
| 496 | SizeTypes; |
Logan Chien | 5b776b7 | 2014-02-22 14:00:39 +0000 | [diff] [blame] | 497 | unsigned TTypeBaseOffsetSize = getULEB128Size(TTypeBaseOffset); |
Bill Wendling | 88fdcd3 | 2010-02-24 23:34:35 +0000 | [diff] [blame] | 498 | unsigned TotalSize = |
| 499 | sizeof(int8_t) + // LPStart format |
| 500 | sizeof(int8_t) + // TType format |
| 501 | (HaveTTData ? TTypeBaseOffsetSize : 0) + // TType base offset size |
| 502 | TTypeBaseOffset; // TType base offset |
| 503 | unsigned SizeAlign = (4 - TotalSize) & 3; |
| 504 | |
Bill Wendling | 24c74f1 | 2010-02-25 23:52:44 +0000 | [diff] [blame] | 505 | if (HaveTTData) { |
Bill Wendling | fea6c4e | 2010-02-26 21:31:01 +0000 | [diff] [blame] | 506 | // Account for any extra padding that will be added to the call site table |
Bill Wendling | 60aa4df | 2010-02-25 21:19:47 +0000 | [diff] [blame] | 507 | // length. |
Chris Lattner | 9efd118 | 2010-04-04 19:09:29 +0000 | [diff] [blame] | 508 | Asm->EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign); |
Bill Wendling | c3a9376 | 2010-02-26 22:17:52 +0000 | [diff] [blame] | 509 | SizeAlign = 0; |
Bill Wendling | 24c74f1 | 2010-02-25 23:52:44 +0000 | [diff] [blame] | 510 | } |
Bill Wendling | 15349f8 | 2009-07-28 22:23:45 +0000 | [diff] [blame] | 511 | |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 512 | bool VerboseAsm = Asm->OutStreamer.isVerboseAsm(); |
| 513 | |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 514 | // SjLj Exception handling |
Bill Wendling | a482ec8 | 2009-09-10 00:17:04 +0000 | [diff] [blame] | 515 | if (IsSJLJ) { |
Chris Lattner | b75af3c | 2010-04-04 20:04:21 +0000 | [diff] [blame] | 516 | Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); |
Bill Wendling | c3a9376 | 2010-02-26 22:17:52 +0000 | [diff] [blame] | 517 | |
| 518 | // Add extra padding if it wasn't added to the TType base offset. |
Chris Lattner | 9efd118 | 2010-04-04 19:09:29 +0000 | [diff] [blame] | 519 | Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 520 | |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 521 | // Emit the landing pad site information. |
Jim Grosbach | 486be66 | 2009-08-17 16:41:22 +0000 | [diff] [blame] | 522 | unsigned idx = 0; |
| 523 | for (SmallVectorImpl<CallSiteEntry>::const_iterator |
| 524 | I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) { |
| 525 | const CallSiteEntry &S = *I; |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 526 | |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 527 | // Offset of the landing pad, counted in 16-byte bundles relative to the |
| 528 | // @LPStart address. |
Bill Wendling | ddec683 | 2011-06-21 22:40:24 +0000 | [diff] [blame] | 529 | if (VerboseAsm) { |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 530 | Asm->OutStreamer.AddComment(">> Call Site " + Twine(idx) + " <<"); |
| 531 | Asm->OutStreamer.AddComment(" On exception at call site "+Twine(idx)); |
Bill Wendling | ddec683 | 2011-06-21 22:40:24 +0000 | [diff] [blame] | 532 | } |
Bill Wendling | ddec683 | 2011-06-21 22:40:24 +0000 | [diff] [blame] | 533 | Asm->EmitULEB128(idx); |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 534 | |
| 535 | // Offset of the first associated action record, relative to the start of |
| 536 | // the action table. This value is biased by 1 (1 indicates the start of |
| 537 | // the action table), and 0 indicates that there are no actions. |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 538 | if (VerboseAsm) { |
| 539 | if (S.Action == 0) |
| 540 | Asm->OutStreamer.AddComment(" Action: cleanup"); |
| 541 | else |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 542 | Asm->OutStreamer.AddComment(" Action: " + |
| 543 | Twine((S.Action - 1) / 2 + 1)); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 544 | } |
Bill Wendling | ddec683 | 2011-06-21 22:40:24 +0000 | [diff] [blame] | 545 | Asm->EmitULEB128(S.Action); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 546 | } |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 547 | } else { |
| 548 | // DWARF Exception handling |
Anton Korobeynikov | 9be547c | 2011-01-14 21:58:08 +0000 | [diff] [blame] | 549 | assert(Asm->MAI->isExceptionHandlingDwarf()); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 550 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 551 | // The call-site table is a list of all call sites that may throw an |
| 552 | // exception (including C++ 'throw' statements) in the procedure |
| 553 | // fragment. It immediately follows the LSDA header. Each entry indicates, |
| 554 | // for a given call, the first corresponding action record and corresponding |
| 555 | // landing pad. |
| 556 | // |
| 557 | // The table begins with the number of bytes, stored as an LEB128 |
| 558 | // compressed, unsigned integer. The records immediately follow the record |
| 559 | // count. They are sorted in increasing call-site address. Each record |
| 560 | // indicates: |
| 561 | // |
| 562 | // * The position of the call-site. |
| 563 | // * The position of the landing pad. |
| 564 | // * The first action record for that call site. |
| 565 | // |
| 566 | // A missing entry in the call-site table indicates that a call is not |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 567 | // supposed to throw. |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 568 | |
| 569 | // Emit the landing pad call site table. |
Chris Lattner | b75af3c | 2010-04-04 20:04:21 +0000 | [diff] [blame] | 570 | Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); |
Bill Wendling | c3a9376 | 2010-02-26 22:17:52 +0000 | [diff] [blame] | 571 | |
| 572 | // Add extra padding if it wasn't added to the TType base offset. |
Chris Lattner | 9efd118 | 2010-04-04 19:09:29 +0000 | [diff] [blame] | 573 | Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 574 | |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 575 | unsigned Entry = 0; |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 576 | for (SmallVectorImpl<CallSiteEntry>::const_iterator |
| 577 | I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { |
| 578 | const CallSiteEntry &S = *I; |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 579 | |
Chris Lattner | a179b52 | 2010-04-04 19:25:43 +0000 | [diff] [blame] | 580 | MCSymbol *EHFuncBeginSym = |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 581 | Asm->GetTempSymbol("eh_func_begin", Asm->getFunctionNumber()); |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 582 | |
Chris Lattner | 34adc8d | 2010-03-14 01:41:15 +0000 | [diff] [blame] | 583 | MCSymbol *BeginLabel = S.BeginLabel; |
| 584 | if (BeginLabel == 0) |
| 585 | BeginLabel = EHFuncBeginSym; |
| 586 | MCSymbol *EndLabel = S.EndLabel; |
| 587 | if (EndLabel == 0) |
Chris Lattner | fd79502 | 2010-04-05 00:26:50 +0000 | [diff] [blame] | 588 | EndLabel = Asm->GetTempSymbol("eh_func_end", Asm->getFunctionNumber()); |
Anton Korobeynikov | 61d167e | 2011-01-14 21:57:45 +0000 | [diff] [blame] | 589 | |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 590 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 591 | // Offset of the call site relative to the previous call site, counted in |
| 592 | // number of 16-byte bundles. The first call site is counted relative to |
| 593 | // the start of the procedure fragment. |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 594 | if (VerboseAsm) |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 595 | Asm->OutStreamer.AddComment(">> Call Site " + Twine(++Entry) + " <<"); |
Chris Lattner | c7cc815 | 2010-04-04 21:31:54 +0000 | [diff] [blame] | 596 | Asm->EmitLabelDifference(BeginLabel, EHFuncBeginSym, 4); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 597 | if (VerboseAsm) |
| 598 | Asm->OutStreamer.AddComment(Twine(" Call between ") + |
| 599 | BeginLabel->getName() + " and " + |
| 600 | EndLabel->getName()); |
Chris Lattner | f1429f1 | 2010-04-04 19:58:12 +0000 | [diff] [blame] | 601 | Asm->EmitLabelDifference(EndLabel, BeginLabel, 4); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 602 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 603 | // Offset of the landing pad, counted in 16-byte bundles relative to the |
| 604 | // @LPStart address. |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 605 | if (!S.PadLabel) { |
| 606 | if (VerboseAsm) |
| 607 | Asm->OutStreamer.AddComment(" has no landing pad"); |
Eric Christopher | ce0cfce | 2013-01-09 01:35:34 +0000 | [diff] [blame] | 608 | Asm->OutStreamer.EmitIntValue(0, 4/*size*/); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 609 | } else { |
| 610 | if (VerboseAsm) |
| 611 | Asm->OutStreamer.AddComment(Twine(" jumps to ") + |
| 612 | S.PadLabel->getName()); |
Chris Lattner | c7cc815 | 2010-04-04 21:31:54 +0000 | [diff] [blame] | 613 | Asm->EmitLabelDifference(S.PadLabel, EHFuncBeginSym, 4); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 614 | } |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 615 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 616 | // Offset of the first associated action record, relative to the start of |
| 617 | // the action table. This value is biased by 1 (1 indicates the start of |
| 618 | // the action table), and 0 indicates that there are no actions. |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 619 | if (VerboseAsm) { |
| 620 | if (S.Action == 0) |
| 621 | Asm->OutStreamer.AddComment(" On action: cleanup"); |
| 622 | else |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 623 | Asm->OutStreamer.AddComment(" On action: " + |
| 624 | Twine((S.Action - 1) / 2 + 1)); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 625 | } |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 626 | Asm->EmitULEB128(S.Action); |
Jim Grosbach | 693e36a | 2009-08-11 00:09:57 +0000 | [diff] [blame] | 627 | } |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 628 | } |
| 629 | |
Bill Wendling | 0e749fe | 2009-08-20 22:02:24 +0000 | [diff] [blame] | 630 | // Emit the Action Table. |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 631 | int Entry = 0; |
Bill Wendling | 23b177e | 2009-07-28 23:44:43 +0000 | [diff] [blame] | 632 | for (SmallVectorImpl<ActionEntry>::const_iterator |
| 633 | I = Actions.begin(), E = Actions.end(); I != E; ++I) { |
| 634 | const ActionEntry &Action = *I; |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 635 | |
| 636 | if (VerboseAsm) { |
| 637 | // Emit comments that decode the action table. |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 638 | Asm->OutStreamer.AddComment(">> Action Record " + Twine(++Entry) + " <<"); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | // Type Filter |
| 642 | // |
| 643 | // Used by the runtime to match the type of the thrown exception to the |
| 644 | // type of the catch clauses or the types in the exception specification. |
| 645 | if (VerboseAsm) { |
Duncan Sands | 2e67937 | 2011-09-28 09:13:02 +0000 | [diff] [blame] | 646 | if (Action.ValueForTypeID > 0) |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 647 | Asm->OutStreamer.AddComment(" Catch TypeInfo " + |
| 648 | Twine(Action.ValueForTypeID)); |
Duncan Sands | 2e67937 | 2011-09-28 09:13:02 +0000 | [diff] [blame] | 649 | else if (Action.ValueForTypeID < 0) |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 650 | Asm->OutStreamer.AddComment(" Filter TypeInfo " + |
| 651 | Twine(Action.ValueForTypeID)); |
Duncan Sands | 2e67937 | 2011-09-28 09:13:02 +0000 | [diff] [blame] | 652 | else |
| 653 | Asm->OutStreamer.AddComment(" Cleanup"); |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 654 | } |
| 655 | Asm->EmitSLEB128(Action.ValueForTypeID); |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 656 | |
Renato Golin | c8d4065 | 2011-08-18 23:43:14 +0000 | [diff] [blame] | 657 | // Action Record |
| 658 | // |
| 659 | // Self-relative signed displacement in bytes of the next action record, |
| 660 | // or 0 if there is no next action record. |
| 661 | if (VerboseAsm) { |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 662 | if (Action.NextAction == 0) { |
| 663 | Asm->OutStreamer.AddComment(" No further actions"); |
| 664 | } else { |
| 665 | unsigned NextAction = Entry + (Action.NextAction + 1) / 2; |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 666 | Asm->OutStreamer.AddComment(" Continue to action "+Twine(NextAction)); |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 667 | } |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 668 | } |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 669 | Asm->EmitSLEB128(Action.NextAction); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 670 | } |
| 671 | |
Anton Korobeynikov | f65a638 | 2012-11-19 21:06:26 +0000 | [diff] [blame] | 672 | EmitTypeInfos(TTypeEncoding); |
| 673 | |
| 674 | Asm->EmitAlignment(2); |
| 675 | } |
| 676 | |
| 677 | void DwarfException::EmitTypeInfos(unsigned TTypeEncoding) { |
| 678 | const std::vector<const GlobalVariable *> &TypeInfos = MMI->getTypeInfos(); |
| 679 | const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); |
| 680 | |
| 681 | bool VerboseAsm = Asm->OutStreamer.isVerboseAsm(); |
| 682 | |
| 683 | int Entry = 0; |
Bill Wendling | 4f0b8d7 | 2009-10-22 20:48:59 +0000 | [diff] [blame] | 684 | // Emit the Catch TypeInfos. |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 685 | if (VerboseAsm && !TypeInfos.empty()) { |
| 686 | Asm->OutStreamer.AddComment(">> Catch TypeInfos <<"); |
Chris Lattner | 566cae9 | 2010-03-09 23:52:58 +0000 | [diff] [blame] | 687 | Asm->OutStreamer.AddBlankLine(); |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 688 | Entry = TypeInfos.size(); |
Chris Lattner | 566cae9 | 2010-03-09 23:52:58 +0000 | [diff] [blame] | 689 | } |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 690 | |
Dan Gohman | bcaf681 | 2010-04-15 01:51:59 +0000 | [diff] [blame] | 691 | for (std::vector<const GlobalVariable *>::const_reverse_iterator |
Bill Wendling | 4b384b0 | 2009-11-19 00:09:14 +0000 | [diff] [blame] | 692 | I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) { |
Bill Wendling | 31c74db | 2009-11-19 19:21:09 +0000 | [diff] [blame] | 693 | const GlobalVariable *GV = *I; |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 694 | if (VerboseAsm) |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 695 | Asm->OutStreamer.AddComment("TypeInfo " + Twine(Entry--)); |
Anton Korobeynikov | 097b0e9 | 2012-11-19 21:17:20 +0000 | [diff] [blame] | 696 | Asm->EmitTTypeReference(GV, TTypeEncoding); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 697 | } |
| 698 | |
Bill Wendling | 4f0b8d7 | 2009-10-22 20:48:59 +0000 | [diff] [blame] | 699 | // Emit the Exception Specifications. |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 700 | if (VerboseAsm && !FilterIds.empty()) { |
| 701 | Asm->OutStreamer.AddComment(">> Filter TypeInfos <<"); |
Chris Lattner | 566cae9 | 2010-03-09 23:52:58 +0000 | [diff] [blame] | 702 | Asm->OutStreamer.AddBlankLine(); |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 703 | Entry = 0; |
Chris Lattner | 566cae9 | 2010-03-09 23:52:58 +0000 | [diff] [blame] | 704 | } |
Bill Wendling | 23b177e | 2009-07-28 23:44:43 +0000 | [diff] [blame] | 705 | for (std::vector<unsigned>::const_iterator |
| 706 | I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) { |
| 707 | unsigned TypeID = *I; |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 708 | if (VerboseAsm) { |
| 709 | --Entry; |
| 710 | if (TypeID != 0) |
Benjamin Kramer | cb6b02a | 2011-10-16 15:46:29 +0000 | [diff] [blame] | 711 | Asm->OutStreamer.AddComment("FilterInfo " + Twine(Entry)); |
Bill Wendling | a8339eb | 2011-06-21 22:30:20 +0000 | [diff] [blame] | 712 | } |
| 713 | |
| 714 | Asm->EmitULEB128(TypeID); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 715 | } |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 716 | } |
| 717 | |
Timur Iskhodzhanov | 119f307 | 2013-11-26 13:34:55 +0000 | [diff] [blame] | 718 | /// endModule - Emit all exception information that should come after the |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 719 | /// content. |
Timur Iskhodzhanov | 119f307 | 2013-11-26 13:34:55 +0000 | [diff] [blame] | 720 | void DwarfException::endModule() { |
Craig Topper | ee4dab5 | 2012-02-05 08:31:47 +0000 | [diff] [blame] | 721 | llvm_unreachable("Should be implemented"); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 722 | } |
| 723 | |
Timur Iskhodzhanov | 119f307 | 2013-11-26 13:34:55 +0000 | [diff] [blame] | 724 | /// beginFunction - Gather pre-function exception information. Assumes it's |
Bill Wendling | 023ed64 | 2009-09-10 06:50:01 +0000 | [diff] [blame] | 725 | /// being emitted immediately after the function entry point. |
Timur Iskhodzhanov | 119f307 | 2013-11-26 13:34:55 +0000 | [diff] [blame] | 726 | void DwarfException::beginFunction(const MachineFunction *MF) { |
Craig Topper | ee4dab5 | 2012-02-05 08:31:47 +0000 | [diff] [blame] | 727 | llvm_unreachable("Should be implemented"); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 728 | } |
| 729 | |
Timur Iskhodzhanov | 119f307 | 2013-11-26 13:34:55 +0000 | [diff] [blame] | 730 | /// endFunction - Gather and emit post-function exception information. |
Timur Iskhodzhanov | 1cd1444 | 2013-12-03 15:10:23 +0000 | [diff] [blame] | 731 | void DwarfException::endFunction(const MachineFunction *) { |
Craig Topper | ee4dab5 | 2012-02-05 08:31:47 +0000 | [diff] [blame] | 732 | llvm_unreachable("Should be implemented"); |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 733 | } |