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