From 9aa1807084a11c1571954428c0b5c8707d6c689f Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 23 Jun 2019 16:05:29 +0000 Subject: [PATCH] SlotIndexes: delete unused functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364154 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/SlotIndexes.h | 56 ------------------------------ lib/CodeGen/SlotIndexes.cpp | 15 -------- 2 files changed, 71 deletions(-) diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h index 76d5ff34d84..2c86930405b 100644 --- a/include/llvm/CodeGen/SlotIndexes.h +++ b/include/llvm/CodeGen/SlotIndexes.h @@ -319,10 +319,6 @@ class raw_ostream; using IndexList = ilist; IndexList indexList; -#ifdef EXPENSIVE_CHECKS - IndexList graveyardList; -#endif // EXPENSIVE_CHECKS - MachineFunction *mf; using Mi2IndexMap = DenseMap; @@ -368,9 +364,6 @@ class raw_ostream; /// Dump the indexes. void dump() const; - /// Renumber the index list, providing space for new instructions. - void renumberIndexes(); - /// Repair indexes after adding and removing instructions. void repairIndexesInRange(MachineBasicBlock *MBB, MachineBasicBlock::iterator Begin, @@ -536,29 +529,6 @@ class raw_ostream; return J->second; } - /// Returns the MBB covering the given range, or null if the range covers - /// more than one basic block. - MachineBasicBlock* getMBBCoveringRange(SlotIndex start, SlotIndex end) const { - - assert(start < end && "Backwards ranges not allowed."); - MBBIndexIterator itr = findMBBIndex(start); - if (itr == MBBIndexEnd()) { - itr = std::prev(itr); - return itr->second; - } - - // Check that we don't cross the boundary into this block. - if (itr->first < end) - return nullptr; - - itr = std::prev(itr); - - if (itr->first <= start) - return itr->second; - - return nullptr; - } - /// Insert the given machine instruction into the mapping. Returns the /// assigned index. /// If Late is set and there are null indexes between mi's neighboring @@ -666,32 +636,6 @@ class raw_ostream; renumberIndexes(newItr); llvm::sort(idx2MBBMap, less_first()); } - - /// Free the resources that were required to maintain a SlotIndex. - /// - /// Once an index is no longer needed (for instance because the instruction - /// at that index has been moved), the resources required to maintain the - /// index can be relinquished to reduce memory use and improve renumbering - /// performance. Any remaining SlotIndex objects that point to the same - /// index are left 'dangling' (much the same as a dangling pointer to a - /// freed object) and should not be accessed, except to destruct them. - /// - /// Like dangling pointers, access to dangling SlotIndexes can cause - /// painful-to-track-down bugs, especially if the memory for the index - /// previously pointed to has been re-used. To detect dangling SlotIndex - /// bugs, build with EXPENSIVE_CHECKS=1. This will cause "erased" indexes to - /// be retained in a graveyard instead of being freed. Operations on indexes - /// in the graveyard will trigger an assertion. - void eraseIndex(SlotIndex index) { - IndexListEntry *entry = index.listEntry(); -#ifdef EXPENSIVE_CHECKS - indexList.remove(entry); - graveyardList.push_back(entry); - entry->setPoison(); -#else - indexList.erase(entry); -#endif - } }; // Specialize IntervalMapInfo for half-open slot index intervals. diff --git a/lib/CodeGen/SlotIndexes.cpp b/lib/CodeGen/SlotIndexes.cpp index ce00fa9a136..9fff873324d 100644 --- a/lib/CodeGen/SlotIndexes.cpp +++ b/lib/CodeGen/SlotIndexes.cpp @@ -22,7 +22,6 @@ INITIALIZE_PASS(SlotIndexes, DEBUG_TYPE, "Slot index numbering", false, false) STATISTIC(NumLocalRenum, "Number of local renumberings"); -STATISTIC(NumGlobalRenum, "Number of global renumberings"); void SlotIndexes::getAnalysisUsage(AnalysisUsage &au) const { au.setPreservesAll(); @@ -144,20 +143,6 @@ void SlotIndexes::removeSingleMachineInstrFromMaps(MachineInstr &MI) { } } -void SlotIndexes::renumberIndexes() { - // Renumber updates the index of every element of the index list. - LLVM_DEBUG(dbgs() << "\n*** Renumbering SlotIndexes ***\n"); - ++NumGlobalRenum; - - unsigned index = 0; - - for (IndexList::iterator I = indexList.begin(), E = indexList.end(); - I != E; ++I) { - I->setIndex(index); - index += SlotIndex::InstrDist; - } -} - // Renumber indexes locally after curItr was inserted, but failed to get a new // index. void SlotIndexes::renumberIndexes(IndexList::iterator curItr) { -- 2.40.0