llvm-6502/lib/Transforms/IPO
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
..
ArgumentPromotion.cpp Update inter-procedural optimizations for atomic load/store. 2011-08-15 22:16:46 +00:00
CMakeLists.txt build/CMake: Finish removal of add_llvm_library_dependencies. 2011-11-29 19:25:30 +00:00
ConstantMerge.cpp Re-fix the issue Bill fixed in r147899 in a slightly different way, which doesn't abuse the semantics of linker_private. We don't really want to merge any string constant with a weak_odr global. 2012-01-11 22:06:46 +00:00
DeadArgumentElimination.cpp Remove all remaining uses of Value::getNameStr(). 2011-11-15 16:27:03 +00:00
ExtractGV.cpp Improve the handling of available_externally and llvm.global_ctors. 2011-06-09 14:38:09 +00:00
FunctionAttrs.cpp SCCCaptured is trivially false on entry to this loop and not modified inside it. 2012-01-05 22:21:45 +00:00
GlobalDCE.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
GlobalOpt.cpp Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012: 2012-03-08 07:06:20 +00:00
InlineAlways.cpp Add comment. 2012-02-25 03:07:57 +00:00
Inliner.cpp Add support for disabling llvm.lifetime intrinsics in the AlwaysInliner. These 2012-02-25 02:56:01 +00:00
InlineSimple.cpp Add comment. 2012-02-25 03:07:57 +00:00
Internalize.cpp These llvm.dbg.* constants are not used anymore. 2011-03-09 19:41:33 +00:00
IPConstantPropagation.cpp land David Blaikie's patch to de-constify Type, with a few tweaks. 2011-07-18 04:54:35 +00:00
IPO.cpp C API functions must be able to see their extern "C" definitions, or it will be impossible to call them from C. 2011-08-19 01:36:54 +00:00
LLVMBuild.txt Add a basic-block autovectorization pass. 2012-02-01 03:51:43 +00:00
LoopExtractor.cpp Place the check for an exit landing pad where it will be run on both code paths through the if-then-else. 2011-09-20 22:27:16 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
MergeFunctions.cpp Update inter-procedural optimizations for atomic load/store. 2011-08-15 22:16:46 +00:00
PartialInlining.cpp Remove PHINode::reserveOperandSpace(). Instead, add a parameter to 2011-03-30 11:28:46 +00:00
PassManagerBuilder.cpp Add a basic-block autovectorization pass. 2012-02-01 03:51:43 +00:00
PruneEH.cpp [unwind removal] We no longer have 'unwind' instructions being generated, so 2012-02-06 21:16:41 +00:00
StripDeadPrototypes.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
StripSymbols.cpp switch to use the new api for structtypes. 2011-08-12 18:06:37 +00:00