diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 22:58:35 +0000 | 
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 22:58:35 +0000 | 
| commit | dc0848c0293d798fecd4d02273cf98e84dc95866 (patch) | |
| tree | dc64f6a8e3754c45b452e5972576f429d84dd23d /llvm/include | |
| parent | e1fd99c197ede469c25d2c25e24397130a0a48f3 (diff) | |
| download | bcm5719-llvm-dc0848c0293d798fecd4d02273cf98e84dc95866.tar.gz bcm5719-llvm-dc0848c0293d798fecd4d02273cf98e84dc95866.zip  | |
CodeGen: MachineInstr::getIterator() => getInstrIterator(), NFC
Delete MachineInstr::getIterator(), since the term "iterator" is
overloaded when talking about MachineInstr.
- Downcast to ilist_node in iplist::getNextNode() and getPrevNode() so
  that ilist_node::getIterator() is still available.
- Add it back as MachineInstr::getInstrIterator().  This matches the
  naming in MachineBasicBlock.
- Add MachineInstr::getBundleIterator().  This is explicitly called
  "bundle" (not matching MachineBasicBlock) to disintinguish it clearly
  from ilist_node::getIterator().
- Update all calls.  Some of these I switched to `auto` to remove
  boiler-plate, since the new name is clear about the type.
There was one call I updated that looked fishy, but it wasn't clear what
the right answer was.  This was in X86FrameLowering::inlineStackProbe(),
added in r252578 in lib/Target/X86/X86FrameLowering.cpp.  I opted to
leave the behaviour unchanged, but I'll reply to the original commit on
the list in a moment.
llvm-svn: 261504
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/ADT/ilist.h | 4 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstr.h | 16 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstrBuilder.h | 2 | ||||
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstrBundle.h | 4 | 
4 files changed, 21 insertions, 5 deletions
diff --git a/llvm/include/llvm/ADT/ilist.h b/llvm/include/llvm/ADT/ilist.h index f4dde441bf8..fe3d6791553 100644 --- a/llvm/include/llvm/ADT/ilist.h +++ b/llvm/include/llvm/ADT/ilist.h @@ -638,7 +638,7 @@ public:    /// \brief Get the previous node, or \c nullptr for the list head.    NodeTy *getPrevNode(NodeTy &N) const { -    auto I = N.getIterator(); +    auto I = static_cast<ilist_node<NodeTy> &>(N).getIterator();      if (I == begin())        return nullptr;      return &*std::prev(I); @@ -650,7 +650,7 @@ public:    /// \brief Get the next node, or \c nullptr for the list tail.    NodeTy *getNextNode(NodeTy &N) const { -    auto Next = std::next(N.getIterator()); +    auto Next = std::next(static_cast<ilist_node<NodeTy> &>(N).getIterator());      if (Next == end())        return nullptr;      return &*Next; diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index adb560970dd..911cd2b5c5c 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -25,6 +25,7 @@  #include "llvm/ADT/iterator_range.h"  #include "llvm/Analysis/AliasAnalysis.h"  #include "llvm/CodeGen/MachineOperand.h" +#include "llvm/CodeGen/MachineInstrBundleIterator.h"  #include "llvm/IR/DebugInfo.h"  #include "llvm/IR/DebugLoc.h"  #include "llvm/IR/InlineAsm.h" @@ -139,6 +140,21 @@ public:    const MachineBasicBlock* getParent() const { return Parent; }    MachineBasicBlock* getParent() { return Parent; } +  // Disallow getIterator(), since it's ambiguous. +  void getIterator() = delete; +  typedef ilist_iterator<MachineInstr> instr_iterator; +  typedef ilist_iterator<const MachineInstr> const_instr_iterator; +  instr_iterator getInstrIterator() { return instr_iterator(this); } +  const_instr_iterator getInstrIterator() const { +    return const_instr_iterator(this); +  } +  typedef MachineInstrBundleIterator<MachineInstr> bundle_iterator; +  typedef MachineInstrBundleIterator<const MachineInstr> const_bundle_iterator; +  bundle_iterator getBundleIterator() { return bundle_iterator(this); } +  const_bundle_iterator getBundleIterator() const { +    return const_bundle_iterator(this); +  } +    /// Return the asm printer flags bitvector.    uint8_t getAsmPrinterFlags() const { return AsmPrinterFlags; } diff --git a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h index aea7f8e329a..d7b39e68dc4 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBuilder.h @@ -472,7 +472,7 @@ public:      if (I == Begin) {        if (!empty())          MI->bundleWithSucc(); -      Begin = MI->getIterator(); +      Begin = MI->getInstrIterator();        return *this;      }      if (I == End) { diff --git a/llvm/include/llvm/CodeGen/MachineInstrBundle.h b/llvm/include/llvm/CodeGen/MachineInstrBundle.h index 4e88606c05a..d3655471b32 100644 --- a/llvm/include/llvm/CodeGen/MachineInstrBundle.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBundle.h @@ -116,10 +116,10 @@ protected:    ///    explicit MachineOperandIteratorBase(MachineInstr *MI, bool WholeBundle) {      if (WholeBundle) { -      InstrI = getBundleStart(MI)->getIterator(); +      InstrI = getBundleStart(MI)->getInstrIterator();        InstrE = MI->getParent()->instr_end();      } else { -      InstrI = InstrE = MI->getIterator(); +      InstrI = InstrE = MI->getInstrIterator();        ++InstrE;      }      OpI = InstrI->operands_begin();  | 

