llvm-project/llvm/lib/CodeGen/AsmPrinter
Duncan P. N. Exon Smith 1872096f1e CodeGen: Give MachineBasicBlock::reverse_iterator a handle to the current MI
Now that MachineBasicBlock::reverse_instr_iterator knows when it's at
the end (since r281168 and r281170), implement
MachineBasicBlock::reverse_iterator directly on top of an
ilist::reverse_iterator by adding an IsReverse template parameter to
MachineInstrBundleIterator.  This replaces another hard-to-reason-about
use of std::reverse_iterator on list iterators, matching the changes for
ilist::reverse_iterator from r280032 (see the "out of scope" section at
the end of that commit message).  MachineBasicBlock::reverse_iterator
now has a handle to the current node and has obvious invalidation
semantics.

r280032 has a more detailed explanation of how list-style reverse
iterators (invalidated when the pointed-at node is deleted) are
different from vector-style reverse iterators like std::reverse_iterator
(invalidated on every operation).  A great motivating example is this
commit's changes to lib/CodeGen/DeadMachineInstructionElim.cpp.

Note: If your out-of-tree backend deletes instructions while iterating
on a MachineBasicBlock::reverse_iterator or converts between
MachineBasicBlock::iterator and MachineBasicBlock::reverse_iterator,
you'll need to update your code in similar ways to r280032.  The
following table might help:

                  [Old]              ==>             [New]
        delete &*RI, RE = end()                   delete &*RI++
        RI->erase(), RE = end()                   RI++->erase()
      reverse_iterator(I)                 std::prev(I).getReverse()
      reverse_iterator(I)                          ++I.getReverse()
    --reverse_iterator(I)                            I.getReverse()
      reverse_iterator(std::next(I))                 I.getReverse()
                RI.base()                std::prev(RI).getReverse()
                RI.base()                         ++RI.getReverse()
              --RI.base()                           RI.getReverse()
     std::next(RI).base()                           RI.getReverse()

(For more details, have a look at r280032.)

llvm-svn: 281172
2016-09-11 18:51:28 +00:00
..
ARMException.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
AddressPool.cpp Move helpers into anonymous namespaces. NFC. 2016-08-06 11:13:10 +00:00
AddressPool.h One more batch of self-containing headers. 2016-01-27 19:29:56 +00:00
AsmPrinter.cpp Revert "[XRay] ARM 32-bit no-Thumb support in LLVM" 2016-09-08 17:10:39 +00:00
AsmPrinterDwarf.cpp CodeGen: Do not require a MachineFunction just to create a DIEDwarfExpression. 2016-05-20 19:35:17 +00:00
AsmPrinterHandler.h Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC 2016-02-26 20:30:37 +00:00
AsmPrinterInlineAsm.cpp Enable the %s modifier in inline asm template string 2016-02-04 16:18:08 +00:00
ByteStreamer.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
CMakeLists.txt [codeview] Describe int local variables using .cv_def_range 2016-02-10 20:55:49 +00:00
CodeViewDebug.cpp [pdb] Write PDB TPI Stream from Yaml. 2016-09-09 17:46:17 +00:00
CodeViewDebug.h [pdb] Write PDB TPI Stream from Yaml. 2016-09-09 17:46:17 +00:00
DIE.cpp Replace a few more "fall through" comments with LLVM_FALLTHROUGH 2016-08-17 20:30:52 +00:00
DIEHash.cpp Apply another batch of fixes from clang-tidy's performance-unnecessary-value-param. 2016-06-17 20:41:14 +00:00
DIEHash.h Apply another batch of fixes from clang-tidy's performance-unnecessary-value-param. 2016-06-17 20:41:14 +00:00
DbgValueHistoryCalculator.cpp CodeGen: Give MachineBasicBlock::reverse_iterator a handle to the current MI 2016-09-11 18:51:28 +00:00
DbgValueHistoryCalculator.h One more batch of self-containing headers. 2016-01-27 19:29:56 +00:00
DebugHandlerBase.cpp [MC] Move .cv_loc management logic out of MCContext 2016-08-26 17:58:37 +00:00
DebugHandlerBase.h [codeview] Improved array type support. 2016-07-12 12:06:34 +00:00
DebugLocEntry.h Use range algorithms instead of unpacking begin/end 2016-08-11 21:15:00 +00:00
DebugLocStream.cpp AsmPrinter: Don't emit empty .debug_loc entries 2015-06-21 16:54:56 +00:00
DebugLocStream.h AsmPrinter: Don't emit empty .debug_loc entries 2015-06-21 16:54:56 +00:00
DwarfAccelTable.cpp Fix some Clang-tidy modernize warnings, other minor fixes. 2015-11-04 22:32:32 +00:00
DwarfAccelTable.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
DwarfCFIException.cpp CodeGen: avoid emitting unnecessary CFI 2016-07-15 21:10:29 +00:00
DwarfCompileUnit.cpp [COFF, Dwarf] Don't emit DW_AT_location for dllimported entities 2016-07-09 20:47:48 +00:00
DwarfCompileUnit.h Reverting 268054 & 268063 as they caused PR27579. 2016-04-30 01:44:07 +00:00
DwarfDebug.cpp Make some LLVM_CONSTEXPR variables const. NFC. 2016-08-25 01:05:08 +00:00
DwarfDebug.h Use range algorithms instead of unpacking begin/end 2016-08-11 21:15:00 +00:00
DwarfException.h Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC 2016-02-26 20:30:37 +00:00
DwarfExpression.cpp Fix the type signature of DwarfExpression::Add.*Constant to support values >32 bits. 2016-06-24 21:35:09 +00:00
DwarfExpression.h Fix the type signature of DwarfExpression::Add.*Constant to support values >32 bits. 2016-06-24 21:35:09 +00:00
DwarfFile.cpp DwarfDebug: emit type units immediately. 2016-02-11 19:57:46 +00:00
DwarfFile.h [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
DwarfStringPool.cpp
DwarfStringPool.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
DwarfUnit.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-25 00:45:04 +00:00
DwarfUnit.h Reverting 268054 & 268063 as they caused PR27579. 2016-04-30 01:44:07 +00:00
EHStreamer.cpp Use make_range(rbegin(), rend()) to allow foreach loops. NFC. 2015-07-24 21:13:43 +00:00
EHStreamer.h Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC 2016-02-26 20:30:37 +00:00
ErlangGCPrinter.cpp Move most user of TargetMachine::getDataLayout to the Module one 2015-07-16 06:11:10 +00:00
LLVMBuild.txt [msf] Resubmit "Rename Msf -> MSF". 2016-07-29 20:56:36 +00:00
OcamlGCPrinter.cpp Use the range variant of find instead of unpacking begin/end 2016-08-11 22:21:41 +00:00
WinException.cpp MachineFunction: Return reference for getFrameInfo(); NFC 2016-07-28 18:40:00 +00:00
WinException.h [WinEH] Move WinEHFuncInfo from MachineModuleInfo to MachineFunction 2015-11-17 21:10:25 +00:00