diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-02-22 07:19:30 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2019-02-22 07:19:30 +0000 |
commit | 85631d8b509a18be718353aefd969d45ca4efb27 (patch) | |
tree | bc947126c9b7c907b968f92be83d7eb7634b193e /llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | |
parent | 90d2e3a16d817e23cac97f538fceb1248e4731bd (diff) | |
download | llvm-85631d8b509a18be718353aefd969d45ca4efb27.zip llvm-85631d8b509a18be718353aefd969d45ca4efb27.tar.gz llvm-85631d8b509a18be718353aefd969d45ca4efb27.tar.bz2 |
[WebAssembly] Remove getBottom function from CFGStackify (NFC)
Summary:
This removes `getBottom` function and the bookeeping map of <begin
marker instruction, bottom BB>.
Reviewers: dschuff
Subscribers: sunfish, sbc100, jgravelle-google, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58319
llvm-svn: 354657
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp index 49057de..02cb48d 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp @@ -75,8 +75,6 @@ class WebAssemblyCFGStackify final : public MachineFunctionPass { DenseMap<const MachineInstr *, MachineBasicBlock *> TryToEHPad; // <EH pad, TRY marker> map DenseMap<const MachineBasicBlock *, MachineInstr *> EHPadToTry; - // <LOOP|TRY marker, Loop/exception bottom BB> map - DenseMap<const MachineInstr *, MachineBasicBlock *> BeginToBottom; // Helper functions to register scope information created by marker // instructions. @@ -84,8 +82,6 @@ class WebAssemblyCFGStackify final : public MachineFunctionPass { void registerTryScope(MachineInstr *Begin, MachineInstr *End, MachineBasicBlock *EHPad); - MachineBasicBlock *getBottom(const MachineInstr *Begin); - public: static char ID; // Pass identification, replacement for typeid WebAssemblyCFGStackify() : MachineFunctionPass(ID) {} @@ -179,27 +175,6 @@ void WebAssemblyCFGStackify::registerTryScope(MachineInstr *Begin, EHPadToTry[EHPad] = Begin; } -// Given a LOOP/TRY marker, returns its bottom BB. Use cached information if any -// to prevent recomputation. -MachineBasicBlock * -WebAssemblyCFGStackify::getBottom(const MachineInstr *Begin) { - const auto &MLI = getAnalysis<MachineLoopInfo>(); - const auto &WEI = getAnalysis<WebAssemblyExceptionInfo>(); - if (BeginToBottom.count(Begin)) - return BeginToBottom[Begin]; - if (Begin->getOpcode() == WebAssembly::LOOP) { - MachineLoop *L = MLI.getLoopFor(Begin->getParent()); - assert(L); - BeginToBottom[Begin] = WebAssembly::getBottom(L); - } else if (Begin->getOpcode() == WebAssembly::TRY) { - WebAssemblyException *WE = WEI.getExceptionFor(TryToEHPad[Begin]); - assert(WE); - BeginToBottom[Begin] = WebAssembly::getBottom(WE); - } else - assert(false); - return BeginToBottom[Begin]; -} - /// Insert a BLOCK marker for branches to MBB (if needed). void WebAssemblyCFGStackify::placeBlockMarker(MachineBasicBlock &MBB) { // This should have been handled in placeTryMarker. @@ -268,7 +243,9 @@ void WebAssemblyCFGStackify::placeBlockMarker(MachineBasicBlock &MBB) { // the BLOCK. if (MI.getOpcode() == WebAssembly::LOOP || MI.getOpcode() == WebAssembly::TRY) { - if (MBB.getNumber() > getBottom(&MI)->getNumber()) + auto *BottomBB = + &*std::prev(MachineFunction::iterator(BeginToEnd[&MI]->getParent())); + if (MBB.getNumber() > BottomBB->getNumber()) AfterSet.insert(&MI); #ifndef NDEBUG else @@ -770,10 +747,10 @@ void WebAssemblyCFGStackify::releaseMemory() { EndToBegin.clear(); TryToEHPad.clear(); EHPadToTry.clear(); - BeginToBottom.clear(); } bool WebAssemblyCFGStackify::runOnMachineFunction(MachineFunction &MF) { + errs() << "Function: " << MF.getName() << "\n"; LLVM_DEBUG(dbgs() << "********** CFG Stackifying **********\n" "********** Function: " << MF.getName() << '\n'); |