llvm-6502/lib/Transforms/InstCombine
Stepan Dyatkovskiy c10fa6c801 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 07:06:20 +00:00
..
CMakeLists.txt build/CMake: Finish removal of add_llvm_library_dependencies. 2011-11-29 19:25:30 +00:00
InstCombine.h Fix a few more places where TargetData/TargetLibraryInfo is not being passed. 2011-12-02 01:26:24 +00:00
InstCombineAddSub.cpp InstCombine: Make OptimizePointerDifference more aggressive. 2012-02-20 14:34:57 +00:00
InstCombineAndOrXor.cpp Restrict this transformation to equality conditions. 2012-02-29 01:46:50 +00:00
InstCombineCalls.cpp [unwind removal] We no longer have 'unwind' instructions being generated, so 2012-02-06 21:16:41 +00:00
InstCombineCasts.cpp Remove some dead code and tidy things up now that vectors use ConstantDataVector 2012-02-06 21:56:39 +00:00
InstCombineCompares.cpp Fix unsigned off-by-one in comment. 2012-02-21 13:40:06 +00:00
InstCombineLoadStoreAlloca.cpp Use the getFirstInsertionPt() method instead of getFirstNonPHI + an 'isa<>' 2011-08-16 20:45:24 +00:00
InstCombineMulDivRem.cpp Remove some dead code and tidy things up now that vectors use ConstantDataVector 2012-02-06 21:56:39 +00:00
InstCombinePHI.cpp Update instcombine for atomic load/store. 2011-08-15 22:09:40 +00:00
InstCombineSelect.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
InstCombineShifts.cpp Convert assert(0) to llvm_unreachable 2012-02-07 05:05:23 +00:00
InstCombineSimplifyDemanded.cpp continue making the world safe for ConstantDataVector. At this point, 2012-01-27 03:08:05 +00:00
InstCombineVectorOps.cpp continue making the world safe for ConstantDataVector. At this point, 2012-01-27 03:08:05 +00:00
InstCombineWorklist.h InstCombine: We know the number of items initially added to the worklist map, reserve space early to avoid rehashing. 2011-03-05 16:43:46 +00:00
InstructionCombining.cpp Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00