Skip to content

Commit

Permalink
ADT: Remove external uses of ilist_iterator, NFC
Browse files Browse the repository at this point in the history
Delete the dead code for Write(ilist_iterator) in the IR Verifier,
inline report(ilist_iterator) at its call sites in the MachineVerifier,
and use simple_ilist<>::iterator in SymbolTableListTraits.

The only remaining reference to ilist_iterator outside of the ilist
implementation is from MachineInstrBundleIterator.  I'll get rid of that
in a follow-up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280565 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dexonsmith committed Sep 3, 2016
1 parent 4ee00f7 commit 31a5b87
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/llvm/IR/SymbolTableListTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ template <typename NodeTy> class SymbolTableList;
template <typename ValueSubClass>
class SymbolTableListTraits : public ilist_alloc_traits<ValueSubClass> {
typedef SymbolTableList<ValueSubClass> ListTy;
typedef ilist_iterator<ValueSubClass, false> iterator;
typedef typename simple_ilist<ValueSubClass>::iterator iterator;
typedef
typename SymbolTableListParentType<ValueSubClass>::type ItemParentClass;

Expand Down
7 changes: 2 additions & 5 deletions lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ namespace {
void visitMachineBasicBlockAfter(const MachineBasicBlock *MBB);
void visitMachineFunctionAfter();

template <typename T> void report(const char *msg, ilist_iterator<T> I) {
report(msg, &*I);
}
void report(const char *msg, const MachineFunction *MF);
void report(const char *msg, const MachineBasicBlock *MBB);
void report(const char *msg, const MachineInstr *MI);
Expand Down Expand Up @@ -365,7 +362,7 @@ unsigned MachineVerifier::verify(MachineFunction &MF) {
for (MachineBasicBlock::const_instr_iterator MBBI = MFI->instr_begin(),
MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) {
if (MBBI->getParent() != &*MFI) {
report("Bad instruction parent pointer", MFI);
report("Bad instruction parent pointer", &*MFI);
errs() << "Instruction: " << *MBBI;
continue;
}
Expand All @@ -387,7 +384,7 @@ unsigned MachineVerifier::verify(MachineFunction &MF) {
CurBundle = &*MBBI;
visitMachineBundleBefore(CurBundle);
} else if (!CurBundle)
report("No bundle header", MBBI);
report("No bundle header", &*MBBI);
visitMachineInstrBefore(&*MBBI);
for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I) {
const MachineInstr &MI = *MBBI;
Expand Down
3 changes: 1 addition & 2 deletions lib/IR/SymbolTableListTraitsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ void SymbolTableListTraits<ValueSubClass>::removeNodeFromList(

template <typename ValueSubClass>
void SymbolTableListTraits<ValueSubClass>::transferNodesFromList(
SymbolTableListTraits &L2, ilist_iterator<ValueSubClass> first,
ilist_iterator<ValueSubClass> last) {
SymbolTableListTraits &L2, iterator first, iterator last) {
// We only have to do work here if transferring instructions between BBs
ItemParentClass *NewIP = getListOwner(), *OldIP = L2.getListOwner();
assert(NewIP != OldIP && "Expected different list owners");
Expand Down
4 changes: 0 additions & 4 deletions lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ struct VerifierSupport {
: OS(OS), M(M), MST(&M), DL(M.getDataLayout()), Context(M.getContext()) {}

private:
template <class NodeTy> void Write(const ilist_iterator<NodeTy> &I) {
Write(&*I);
}

void Write(const Module *M) {
*OS << "; ModuleID = '" << M->getModuleIdentifier() << "'\n";
}
Expand Down

0 comments on commit 31a5b87

Please sign in to comment.