diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/ARMException.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 19 |
5 files changed, 29 insertions, 34 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp index fff3f003478..5294c98e314 100644 --- a/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp @@ -75,7 +75,7 @@ void ARMException::endFunction(const MachineFunction *MF) { F->hasPersonalityFn() && !isNoOpWithoutInvoke(classifyEHPersonality(Per)) && F->needsUnwindTableEntry(); bool shouldEmitPersonality = forceEmitPersonality || - !MF->getLandingPads().empty(); + !MMI->getLandingPads().empty(); if (!Asm->MF->getFunction()->needsUnwindTableEntry() && !shouldEmitPersonality) ATS.emitCantUnwind(); @@ -99,9 +99,8 @@ void ARMException::endFunction(const MachineFunction *MF) { } void ARMException::emitTypeInfos(unsigned TTypeEncoding) { - const MachineFunction *MF = Asm->MF; - const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos(); - const std::vector<unsigned> &FilterIds = MF->getFilterIds(); + const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos(); + const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); bool VerboseAsm = Asm->OutStreamer->isVerboseAsm(); diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 4d5a099a303..8394ed3adbf 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -947,8 +947,8 @@ void AsmPrinter::EmitFunctionBody() { // Emit target-specific gunk after the function body. EmitFunctionBodyEnd(); - if (!MF->getLandingPads().empty() || MMI->hasDebugInfo() || - MF->hasEHFunclets() || MAI->hasDotTypeDotSizeDirective()) { + if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() || + MMI->hasEHFunclets() || MAI->hasDotTypeDotSizeDirective()) { // Create a symbol for the end of function. CurrentFnEnd = createTempSymbol("func_end"); OutStreamer->EmitLabel(CurrentFnEnd); @@ -981,6 +981,7 @@ void AsmPrinter::EmitFunctionBody() { HI.TimerGroupDescription, TimePassesIsEnabled); HI.Handler->endFunction(MF); } + MMI->EndFunction(); OutStreamer->AddBlankLine(); } @@ -1272,8 +1273,8 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { CurrentFnBegin = nullptr; CurExceptionSym = nullptr; bool NeedsLocalForSize = MAI->needsLocalForSize(); - if (!MF.getLandingPads().empty() || MMI->hasDebugInfo() || - MF.hasEHFunclets() || NeedsLocalForSize) { + if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() || + MMI->hasEHFunclets() || NeedsLocalForSize) { CurrentFnBegin = createTempSymbol("func_begin"); if (NeedsLocalForSize) CurrentFnSymForSize = CurrentFnBegin; diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp index efe7059a3a0..b334263a823 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp @@ -44,11 +44,11 @@ DwarfCFIExceptionBase::DwarfCFIExceptionBase(AsmPrinter *A) void DwarfCFIExceptionBase::markFunctionEnd() { endFragment(); + if (MMI->getLandingPads().empty()) + return; + // Map all labels and get rid of any dead landing pads. - if (!Asm->MF->getLandingPads().empty()) { - MachineFunction *NonConstMF = const_cast<MachineFunction*>(Asm->MF); - NonConstMF->tidyLandingPads(); - } + MMI->TidyLandingPads(); } void DwarfCFIExceptionBase::endFragment() { @@ -98,7 +98,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) { const Function *F = MF->getFunction(); // If any landing pads survive, we need an EH table. - bool hasLandingPads = !MF->getLandingPads().empty(); + bool hasLandingPads = !MMI->getLandingPads().empty(); // See if we need frame move info. AsmPrinter::CFIMoveType MoveType = Asm->needsCFIMoves(); @@ -170,7 +170,7 @@ void DwarfCFIException::beginFragment(const MachineBasicBlock *MBB, /// endFunction - Gather and emit post-function exception information. /// -void DwarfCFIException::endFunction(const MachineFunction *MF) { +void DwarfCFIException::endFunction(const MachineFunction *) { if (!shouldEmitPersonality) return; diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp index 0a4a7a06cb2..e24dcb1bffd 100644 --- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -74,7 +74,7 @@ computeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads, // output using a fixed width encoding. FilterOffsets[i] holds the byte // offset corresponding to FilterIds[i]. - const std::vector<unsigned> &FilterIds = Asm->MF->getFilterIds(); + const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); SmallVector<int, 16> FilterOffsets; FilterOffsets.reserve(FilterIds.size()); int Offset = -1; @@ -296,7 +296,7 @@ computeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites, else { // SjLj EH must maintain the call sites in the order assigned // to them by the SjLjPrepare pass. - unsigned SiteNo = Asm->MF->getCallSiteBeginLabel(BeginLabel); + unsigned SiteNo = MMI->getCallSiteBeginLabel(BeginLabel); if (CallSites.size() < SiteNo) CallSites.resize(SiteNo); CallSites[SiteNo - 1] = Site; @@ -336,10 +336,9 @@ computeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites, /// 3. Type ID table contains references to all the C++ typeinfo for all /// catches in the function. This tables is reverse indexed base 1. void EHStreamer::emitExceptionTable() { - const MachineFunction *MF = Asm->MF; - const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos(); - const std::vector<unsigned> &FilterIds = MF->getFilterIds(); - const std::vector<LandingPadInfo> &PadInfos = MF->getLandingPads(); + const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos(); + const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); + const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads(); // Sort the landing pads in order of their type ids. This is used to fold // duplicate actions. @@ -650,9 +649,8 @@ void EHStreamer::emitExceptionTable() { } void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) { - const MachineFunction *MF = Asm->MF; - const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos(); - const std::vector<unsigned> &FilterIds = MF->getFilterIds(); + const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos(); + const std::vector<unsigned> &FilterIds = MMI->getFilterIds(); bool VerboseAsm = Asm->OutStreamer->isVerboseAsm(); diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index 75cb43d8555..f249210be82 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -63,8 +63,8 @@ void WinException::beginFunction(const MachineFunction *MF) { shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false; // If any landing pads survive, we need an EH table. - bool hasLandingPads = !MF->getLandingPads().empty(); - bool hasEHFunclets = MF->hasEHFunclets(); + bool hasLandingPads = !MMI->getLandingPads().empty(); + bool hasEHFunclets = MMI->hasEHFunclets(); const Function *F = MF->getFunction(); @@ -126,15 +126,13 @@ void WinException::endFunction(const MachineFunction *MF) { // Get rid of any dead landing pads if we're not using funclets. In funclet // schemes, the landing pad is not actually reachable. It only exists so // that we can emit the right table data. - if (!isFuncletEHPersonality(Per)) { - MachineFunction *NonConstMF = const_cast<MachineFunction*>(MF); - NonConstMF->tidyLandingPads(); - } + if (!isFuncletEHPersonality(Per)) + MMI->TidyLandingPads(); endFunclet(); // endFunclet will emit the necessary .xdata tables for x64 SEH. - if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets()) + if (Per == EHPersonality::MSVC_Win64SEH && MMI->hasEHFunclets()) return; if (shouldEmitPersonality || shouldEmitLSDA) { @@ -236,9 +234,8 @@ void WinException::endFunclet() { if (!CurrentFuncletEntry) return; - const MachineFunction *MF = Asm->MF; if (shouldEmitMoves || shouldEmitPersonality) { - const Function *F = MF->getFunction(); + const Function *F = Asm->MF->getFunction(); EHPersonality Per = EHPersonality::Unknown; if (F->hasPersonalityFn()) Per = classifyEHPersonality(F->getPersonalityFn()->stripPointerCasts()); @@ -258,11 +255,11 @@ void WinException::endFunclet() { MCSymbol *FuncInfoXData = Asm->OutContext.getOrCreateSymbol( Twine("$cppxdata$", FuncLinkageName)); Asm->OutStreamer->EmitValue(create32bitRef(FuncInfoXData), 4); - } else if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets() && + } else if (Per == EHPersonality::MSVC_Win64SEH && MMI->hasEHFunclets() && !CurrentFuncletEntry->isEHFuncletEntry()) { // If this is the parent function in Win64 SEH, emit the LSDA immediately // following .seh_handlerdata. - emitCSpecificHandlerTable(MF); + emitCSpecificHandlerTable(Asm->MF); } // Switch back to the previous section now that we are done writing to |