2
0

MachineModuleInfo.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. //===-- llvm/CodeGen/MachineModuleInfo.cpp ----------------------*- C++ -*-===//
  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. #include "llvm/CodeGen/MachineModuleInfo.h"
  10. #include "llvm/ADT/PointerUnion.h"
  11. #include "llvm/Analysis/LibCallSemantics.h"
  12. #include "llvm/Analysis/ValueTracking.h"
  13. #include "llvm/CodeGen/MachineFunction.h"
  14. #include "llvm/CodeGen/MachineFunctionPass.h"
  15. #include "llvm/CodeGen/Passes.h"
  16. #include "llvm/CodeGen/WinEHFuncInfo.h"
  17. #include "llvm/IR/Constants.h"
  18. #include "llvm/IR/DerivedTypes.h"
  19. #include "llvm/IR/GlobalVariable.h"
  20. #include "llvm/IR/Module.h"
  21. #include "llvm/MC/MCObjectFileInfo.h"
  22. #include "llvm/MC/MCSymbol.h"
  23. #include "llvm/Support/Dwarf.h"
  24. #include "llvm/Support/ErrorHandling.h"
  25. using namespace llvm;
  26. using namespace llvm::dwarf;
  27. // Handle the Pass registration stuff necessary to use DataLayout's.
  28. INITIALIZE_PASS(MachineModuleInfo, "machinemoduleinfo",
  29. "Machine Module Information", false, false)
  30. char MachineModuleInfo::ID = 0;
  31. // Out of line virtual method.
  32. MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
  33. namespace llvm {
  34. class MMIAddrLabelMapCallbackPtr : CallbackVH {
  35. MMIAddrLabelMap *Map;
  36. public:
  37. MMIAddrLabelMapCallbackPtr() : Map(nullptr) {}
  38. MMIAddrLabelMapCallbackPtr(Value *V) : CallbackVH(V), Map(nullptr) {}
  39. void setPtr(BasicBlock *BB) {
  40. ValueHandleBase::operator=(BB);
  41. }
  42. void setMap(MMIAddrLabelMap *map) { Map = map; }
  43. void deleted() override;
  44. void allUsesReplacedWith(Value *V2) override;
  45. };
  46. class MMIAddrLabelMap {
  47. MCContext &Context;
  48. struct AddrLabelSymEntry {
  49. /// Symbols - The symbols for the label.
  50. TinyPtrVector<MCSymbol *> Symbols;
  51. Function *Fn; // The containing function of the BasicBlock.
  52. unsigned Index; // The index in BBCallbacks for the BasicBlock.
  53. };
  54. DenseMap<AssertingVH<BasicBlock>, AddrLabelSymEntry> AddrLabelSymbols;
  55. /// BBCallbacks - Callbacks for the BasicBlock's that we have entries for. We
  56. /// use this so we get notified if a block is deleted or RAUWd.
  57. std::vector<MMIAddrLabelMapCallbackPtr> BBCallbacks;
  58. /// DeletedAddrLabelsNeedingEmission - This is a per-function list of symbols
  59. /// whose corresponding BasicBlock got deleted. These symbols need to be
  60. /// emitted at some point in the file, so AsmPrinter emits them after the
  61. /// function body.
  62. DenseMap<AssertingVH<Function>, std::vector<MCSymbol*> >
  63. DeletedAddrLabelsNeedingEmission;
  64. public:
  65. MMIAddrLabelMap(MCContext &context) : Context(context) {}
  66. ~MMIAddrLabelMap() {
  67. assert(DeletedAddrLabelsNeedingEmission.empty() &&
  68. "Some labels for deleted blocks never got emitted");
  69. }
  70. ArrayRef<MCSymbol *> getAddrLabelSymbolToEmit(BasicBlock *BB);
  71. void takeDeletedSymbolsForFunction(Function *F,
  72. std::vector<MCSymbol*> &Result);
  73. void UpdateForDeletedBlock(BasicBlock *BB);
  74. void UpdateForRAUWBlock(BasicBlock *Old, BasicBlock *New);
  75. };
  76. }
  77. ArrayRef<MCSymbol *> MMIAddrLabelMap::getAddrLabelSymbolToEmit(BasicBlock *BB) {
  78. assert(BB->hasAddressTaken() &&
  79. "Shouldn't get label for block without address taken");
  80. AddrLabelSymEntry &Entry = AddrLabelSymbols[BB];
  81. // If we already had an entry for this block, just return it.
  82. if (!Entry.Symbols.empty()) {
  83. assert(BB->getParent() == Entry.Fn && "Parent changed");
  84. return Entry.Symbols;
  85. }
  86. // Otherwise, this is a new entry, create a new symbol for it and add an
  87. // entry to BBCallbacks so we can be notified if the BB is deleted or RAUWd.
  88. BBCallbacks.emplace_back(BB);
  89. BBCallbacks.back().setMap(this);
  90. Entry.Index = BBCallbacks.size() - 1;
  91. Entry.Fn = BB->getParent();
  92. Entry.Symbols.push_back(Context.createTempSymbol());
  93. return Entry.Symbols;
  94. }
  95. /// takeDeletedSymbolsForFunction - If we have any deleted symbols for F, return
  96. /// them.
  97. void MMIAddrLabelMap::
  98. takeDeletedSymbolsForFunction(Function *F, std::vector<MCSymbol*> &Result) {
  99. DenseMap<AssertingVH<Function>, std::vector<MCSymbol*> >::iterator I =
  100. DeletedAddrLabelsNeedingEmission.find(F);
  101. // If there are no entries for the function, just return.
  102. if (I == DeletedAddrLabelsNeedingEmission.end()) return;
  103. // Otherwise, take the list.
  104. std::swap(Result, I->second);
  105. DeletedAddrLabelsNeedingEmission.erase(I);
  106. }
  107. void MMIAddrLabelMap::UpdateForDeletedBlock(BasicBlock *BB) {
  108. // If the block got deleted, there is no need for the symbol. If the symbol
  109. // was already emitted, we can just forget about it, otherwise we need to
  110. // queue it up for later emission when the function is output.
  111. AddrLabelSymEntry Entry = std::move(AddrLabelSymbols[BB]);
  112. AddrLabelSymbols.erase(BB);
  113. assert(!Entry.Symbols.empty() && "Didn't have a symbol, why a callback?");
  114. BBCallbacks[Entry.Index] = nullptr; // Clear the callback.
  115. assert((BB->getParent() == nullptr || BB->getParent() == Entry.Fn) &&
  116. "Block/parent mismatch");
  117. for (MCSymbol *Sym : Entry.Symbols) {
  118. if (Sym->isDefined())
  119. return;
  120. // If the block is not yet defined, we need to emit it at the end of the
  121. // function. Add the symbol to the DeletedAddrLabelsNeedingEmission list
  122. // for the containing Function. Since the block is being deleted, its
  123. // parent may already be removed, we have to get the function from 'Entry'.
  124. DeletedAddrLabelsNeedingEmission[Entry.Fn].push_back(Sym);
  125. }
  126. }
  127. void MMIAddrLabelMap::UpdateForRAUWBlock(BasicBlock *Old, BasicBlock *New) {
  128. // Get the entry for the RAUW'd block and remove it from our map.
  129. AddrLabelSymEntry OldEntry = std::move(AddrLabelSymbols[Old]);
  130. AddrLabelSymbols.erase(Old);
  131. assert(!OldEntry.Symbols.empty() && "Didn't have a symbol, why a callback?");
  132. AddrLabelSymEntry &NewEntry = AddrLabelSymbols[New];
  133. // If New is not address taken, just move our symbol over to it.
  134. if (NewEntry.Symbols.empty()) {
  135. BBCallbacks[OldEntry.Index].setPtr(New); // Update the callback.
  136. NewEntry = std::move(OldEntry); // Set New's entry.
  137. return;
  138. }
  139. BBCallbacks[OldEntry.Index] = nullptr; // Update the callback.
  140. // Otherwise, we need to add the old symbols to the new block's set.
  141. NewEntry.Symbols.insert(NewEntry.Symbols.end(), OldEntry.Symbols.begin(),
  142. OldEntry.Symbols.end());
  143. }
  144. void MMIAddrLabelMapCallbackPtr::deleted() {
  145. Map->UpdateForDeletedBlock(cast<BasicBlock>(getValPtr()));
  146. }
  147. void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) {
  148. Map->UpdateForRAUWBlock(cast<BasicBlock>(getValPtr()), cast<BasicBlock>(V2));
  149. }
  150. //===----------------------------------------------------------------------===//
  151. MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI,
  152. const MCRegisterInfo &MRI,
  153. const MCObjectFileInfo *MOFI)
  154. : ImmutablePass(ID), Context(&MAI, &MRI, MOFI, nullptr, false) {
  155. initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
  156. }
  157. MachineModuleInfo::MachineModuleInfo()
  158. : ImmutablePass(ID), Context(nullptr, nullptr, nullptr) {
  159. llvm_unreachable("This MachineModuleInfo constructor should never be called, "
  160. "MMI should always be explicitly constructed by "
  161. "LLVMTargetMachine");
  162. }
  163. MachineModuleInfo::~MachineModuleInfo() {
  164. }
  165. bool MachineModuleInfo::doInitialization(Module &M) {
  166. ObjFileMMI = nullptr;
  167. CurCallSite = 0;
  168. CallsEHReturn = false;
  169. CallsUnwindInit = false;
  170. DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;
  171. // Always emit some info, by default "no personality" info.
  172. Personalities.push_back(nullptr);
  173. PersonalityTypeCache = EHPersonality::Unknown;
  174. AddrLabelSymbols = nullptr;
  175. TheModule = nullptr;
  176. return false;
  177. }
  178. bool MachineModuleInfo::doFinalization(Module &M) {
  179. Personalities.clear();
  180. delete AddrLabelSymbols;
  181. AddrLabelSymbols = nullptr;
  182. Context.reset();
  183. delete ObjFileMMI;
  184. ObjFileMMI = nullptr;
  185. return false;
  186. }
  187. /// EndFunction - Discard function meta information.
  188. ///
  189. void MachineModuleInfo::EndFunction() {
  190. // Clean up frame info.
  191. FrameInstructions.clear();
  192. // Clean up exception info.
  193. LandingPads.clear();
  194. PersonalityTypeCache = EHPersonality::Unknown;
  195. CallSiteMap.clear();
  196. TypeInfos.clear();
  197. FilterIds.clear();
  198. FilterEnds.clear();
  199. CallsEHReturn = false;
  200. CallsUnwindInit = false;
  201. VariableDbgInfos.clear();
  202. }
  203. //===- Address of Block Management ----------------------------------------===//
  204. /// getAddrLabelSymbolToEmit - Return the symbol to be used for the specified
  205. /// basic block when its address is taken. If other blocks were RAUW'd to
  206. /// this one, we may have to emit them as well, return the whole set.
  207. ArrayRef<MCSymbol *>
  208. MachineModuleInfo::getAddrLabelSymbolToEmit(const BasicBlock *BB) {
  209. // Lazily create AddrLabelSymbols.
  210. if (!AddrLabelSymbols)
  211. AddrLabelSymbols = new MMIAddrLabelMap(Context);
  212. return AddrLabelSymbols->getAddrLabelSymbolToEmit(const_cast<BasicBlock*>(BB));
  213. }
  214. /// takeDeletedSymbolsForFunction - If the specified function has had any
  215. /// references to address-taken blocks generated, but the block got deleted,
  216. /// return the symbol now so we can emit it. This prevents emitting a
  217. /// reference to a symbol that has no definition.
  218. void MachineModuleInfo::
  219. takeDeletedSymbolsForFunction(const Function *F,
  220. std::vector<MCSymbol*> &Result) {
  221. // If no blocks have had their addresses taken, we're done.
  222. if (!AddrLabelSymbols) return;
  223. return AddrLabelSymbols->
  224. takeDeletedSymbolsForFunction(const_cast<Function*>(F), Result);
  225. }
  226. //===- EH -----------------------------------------------------------------===//
  227. /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the
  228. /// specified MachineBasicBlock.
  229. LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo
  230. (MachineBasicBlock *LandingPad) {
  231. unsigned N = LandingPads.size();
  232. for (unsigned i = 0; i < N; ++i) {
  233. LandingPadInfo &LP = LandingPads[i];
  234. if (LP.LandingPadBlock == LandingPad)
  235. return LP;
  236. }
  237. LandingPads.push_back(LandingPadInfo(LandingPad));
  238. return LandingPads[N];
  239. }
  240. /// addInvoke - Provide the begin and end labels of an invoke style call and
  241. /// associate it with a try landing pad block.
  242. void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad,
  243. MCSymbol *BeginLabel, MCSymbol *EndLabel) {
  244. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  245. LP.BeginLabels.push_back(BeginLabel);
  246. LP.EndLabels.push_back(EndLabel);
  247. }
  248. /// addLandingPad - Provide the label of a try LandingPad block.
  249. ///
  250. MCSymbol *MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {
  251. MCSymbol *LandingPadLabel = Context.createTempSymbol();
  252. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  253. LP.LandingPadLabel = LandingPadLabel;
  254. return LandingPadLabel;
  255. }
  256. /// addPersonality - Provide the personality function for the exception
  257. /// information.
  258. void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad,
  259. const Function *Personality) {
  260. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  261. LP.Personality = Personality;
  262. addPersonality(Personality);
  263. }
  264. void MachineModuleInfo::addPersonality(const Function *Personality) {
  265. for (unsigned i = 0; i < Personalities.size(); ++i)
  266. if (Personalities[i] == Personality)
  267. return;
  268. // If this is the first personality we're adding go
  269. // ahead and add it at the beginning.
  270. if (!Personalities[0])
  271. Personalities[0] = Personality;
  272. else
  273. Personalities.push_back(Personality);
  274. }
  275. void MachineModuleInfo::addWinEHState(MachineBasicBlock *LandingPad,
  276. int State) {
  277. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  278. LP.WinEHState = State;
  279. }
  280. /// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
  281. ///
  282. void MachineModuleInfo::
  283. addCatchTypeInfo(MachineBasicBlock *LandingPad,
  284. ArrayRef<const GlobalValue *> TyInfo) {
  285. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  286. for (unsigned N = TyInfo.size(); N; --N)
  287. LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1]));
  288. }
  289. /// addFilterTypeInfo - Provide the filter typeinfo for a landing pad.
  290. ///
  291. void MachineModuleInfo::
  292. addFilterTypeInfo(MachineBasicBlock *LandingPad,
  293. ArrayRef<const GlobalValue *> TyInfo) {
  294. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  295. std::vector<unsigned> IdsInFilter(TyInfo.size());
  296. for (unsigned I = 0, E = TyInfo.size(); I != E; ++I)
  297. IdsInFilter[I] = getTypeIDFor(TyInfo[I]);
  298. LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));
  299. }
  300. /// addCleanup - Add a cleanup action for a landing pad.
  301. ///
  302. void MachineModuleInfo::addCleanup(MachineBasicBlock *LandingPad) {
  303. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  304. LP.TypeIds.push_back(0);
  305. }
  306. void MachineModuleInfo::addSEHCatchHandler(MachineBasicBlock *LandingPad,
  307. const Function *Filter,
  308. const BlockAddress *RecoverBA) {
  309. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  310. SEHHandler Handler;
  311. Handler.FilterOrFinally = Filter;
  312. Handler.RecoverBA = RecoverBA;
  313. LP.SEHHandlers.push_back(Handler);
  314. }
  315. void MachineModuleInfo::addSEHCleanupHandler(MachineBasicBlock *LandingPad,
  316. const Function *Cleanup) {
  317. LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
  318. SEHHandler Handler;
  319. Handler.FilterOrFinally = Cleanup;
  320. Handler.RecoverBA = nullptr;
  321. LP.SEHHandlers.push_back(Handler);
  322. }
  323. /// TidyLandingPads - Remap landing pad labels and remove any deleted landing
  324. /// pads.
  325. void MachineModuleInfo::TidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {
  326. for (unsigned i = 0; i != LandingPads.size(); ) {
  327. LandingPadInfo &LandingPad = LandingPads[i];
  328. if (LandingPad.LandingPadLabel &&
  329. !LandingPad.LandingPadLabel->isDefined() &&
  330. (!LPMap || (*LPMap)[LandingPad.LandingPadLabel] == 0))
  331. LandingPad.LandingPadLabel = nullptr;
  332. // Special case: we *should* emit LPs with null LP MBB. This indicates
  333. // "nounwind" case.
  334. if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {
  335. LandingPads.erase(LandingPads.begin() + i);
  336. continue;
  337. }
  338. for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
  339. MCSymbol *BeginLabel = LandingPad.BeginLabels[j];
  340. MCSymbol *EndLabel = LandingPad.EndLabels[j];
  341. if ((BeginLabel->isDefined() ||
  342. (LPMap && (*LPMap)[BeginLabel] != 0)) &&
  343. (EndLabel->isDefined() ||
  344. (LPMap && (*LPMap)[EndLabel] != 0))) continue;
  345. LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
  346. LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
  347. --j, --e;
  348. }
  349. // Remove landing pads with no try-ranges.
  350. if (LandingPads[i].BeginLabels.empty()) {
  351. LandingPads.erase(LandingPads.begin() + i);
  352. continue;
  353. }
  354. // If there is no landing pad, ensure that the list of typeids is empty.
  355. // If the only typeid is a cleanup, this is the same as having no typeids.
  356. if (!LandingPad.LandingPadBlock ||
  357. (LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0]))
  358. LandingPad.TypeIds.clear();
  359. ++i;
  360. }
  361. }
  362. /// setCallSiteLandingPad - Map the landing pad's EH symbol to the call site
  363. /// indexes.
  364. void MachineModuleInfo::setCallSiteLandingPad(MCSymbol *Sym,
  365. ArrayRef<unsigned> Sites) {
  366. LPadToCallSiteMap[Sym].append(Sites.begin(), Sites.end());
  367. }
  368. /// getTypeIDFor - Return the type id for the specified typeinfo. This is
  369. /// function wide.
  370. unsigned MachineModuleInfo::getTypeIDFor(const GlobalValue *TI) {
  371. for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)
  372. if (TypeInfos[i] == TI) return i + 1;
  373. TypeInfos.push_back(TI);
  374. return TypeInfos.size();
  375. }
  376. /// getFilterIDFor - Return the filter id for the specified typeinfos. This is
  377. /// function wide.
  378. int MachineModuleInfo::getFilterIDFor(std::vector<unsigned> &TyIds) {
  379. // If the new filter coincides with the tail of an existing filter, then
  380. // re-use the existing filter. Folding filters more than this requires
  381. // re-ordering filters and/or their elements - probably not worth it.
  382. for (std::vector<unsigned>::iterator I = FilterEnds.begin(),
  383. E = FilterEnds.end(); I != E; ++I) {
  384. unsigned i = *I, j = TyIds.size();
  385. while (i && j)
  386. if (FilterIds[--i] != TyIds[--j])
  387. goto try_next;
  388. if (!j)
  389. // The new filter coincides with range [i, end) of the existing filter.
  390. return -(1 + i);
  391. try_next:;
  392. }
  393. // Add the new filter.
  394. int FilterID = -(1 + FilterIds.size());
  395. FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);
  396. FilterIds.insert(FilterIds.end(), TyIds.begin(), TyIds.end());
  397. FilterEnds.push_back(FilterIds.size());
  398. FilterIds.push_back(0); // terminator
  399. return FilterID;
  400. }
  401. /// getPersonality - Return the personality function for the current function.
  402. const Function *MachineModuleInfo::getPersonality() const {
  403. for (const LandingPadInfo &LPI : LandingPads)
  404. if (LPI.Personality)
  405. return LPI.Personality;
  406. return nullptr;
  407. }
  408. EHPersonality MachineModuleInfo::getPersonalityType() {
  409. if (PersonalityTypeCache == EHPersonality::Unknown) {
  410. if (const Function *F = getPersonality())
  411. PersonalityTypeCache = classifyEHPersonality(F);
  412. }
  413. return PersonalityTypeCache;
  414. }
  415. /// getPersonalityIndex - Return unique index for current personality
  416. /// function. NULL/first personality function should always get zero index.
  417. unsigned MachineModuleInfo::getPersonalityIndex() const {
  418. const Function* Personality = nullptr;
  419. // Scan landing pads. If there is at least one non-NULL personality - use it.
  420. for (unsigned i = 0, e = LandingPads.size(); i != e; ++i)
  421. if (LandingPads[i].Personality) {
  422. Personality = LandingPads[i].Personality;
  423. break;
  424. }
  425. for (unsigned i = 0, e = Personalities.size(); i < e; ++i) {
  426. if (Personalities[i] == Personality)
  427. return i;
  428. }
  429. // This will happen if the current personality function is
  430. // in the zero index.
  431. return 0;
  432. }
  433. const Function *MachineModuleInfo::getWinEHParent(const Function *F) const {
  434. StringRef WinEHParentName =
  435. F->getFnAttribute("wineh-parent").getValueAsString();
  436. if (WinEHParentName.empty() || WinEHParentName == F->getName())
  437. return F;
  438. return F->getParent()->getFunction(WinEHParentName);
  439. }
  440. WinEHFuncInfo &MachineModuleInfo::getWinEHFuncInfo(const Function *F) {
  441. auto &Ptr = FuncInfoMap[getWinEHParent(F)];
  442. if (!Ptr)
  443. Ptr.reset(new WinEHFuncInfo);
  444. return *Ptr;
  445. }