llvm-6502/lib/Transforms/Scalar
Stepan Dyatkovskiy 24473120a2 SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-01 07:49:51 +00:00
..
ADCE.cpp The landingpad instruction isn't dead simply because it's value isn't used. 2011-08-19 21:52:06 +00:00
BasicBlockPlacement.cpp Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
CMakeLists.txt build/CMake: Finish removal of add_llvm_library_dependencies. 2011-11-29 19:25:30 +00:00
CodeGenPrepare.cpp Extend Attributes to 64 bits 2012-01-20 17:56:17 +00:00
ConstantProp.cpp Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetData 2011-12-01 21:29:16 +00:00
CorrelatedValuePropagation.cpp Don't include Operator.h from InstrTypes.h. 2011-04-11 09:35:34 +00:00
DCE.cpp Remove unused STL header includes. 2011-04-23 19:53:52 +00:00
DeadStoreElimination.cpp Fix infinite loop in DSE when deleting a free in a reachable loop that's also 2011-12-08 22:36:35 +00:00
EarlyCSE.cpp bz11794 : EarlyCSE stack overflow on long functions. 2012-01-31 23:14:41 +00:00
GlobalMerge.cpp Make GlobalMerge honor the preferred alignment on globals without an explicitly specified alignment. 2011-11-30 21:54:15 +00:00
GVN.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
IndVarSimplify.cpp Fix typo. 2012-01-28 23:33:44 +00:00
JumpThreading.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
LICM.cpp Move Instruction::isSafeToSpeculativelyExecute out of VMCore and 2011-12-14 23:49:11 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
LoopDeletion.cpp Don't use PN->replaceUsesOfWith() to change a PHINode's incoming blocks, 2011-06-21 10:02:43 +00:00
LoopIdiomRecognize.cpp Correct grammar. 2011-09-13 00:44:16 +00:00
LoopInstSimplify.cpp Propagate TargetLibraryInfo throughout ConstantFolding.cpp and 2011-12-01 03:08:23 +00:00
LoopRotation.cpp Make better use of the PHINode API. 2011-06-20 14:18:48 +00:00
LoopStrengthReduce.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
LoopUnrollPass.cpp Add -unroll-runtime for unrolling loops with run-time trip counts. 2011-12-09 06:19:40 +00:00
LoopUnswitch.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
LowerAtomic.cpp Remove the old atomic instrinsics. autoupgrade functionality is included with this patch. 2011-10-06 23:20:49 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
MemCpyOptimizer.cpp Update comment. 2011-12-05 22:53:09 +00:00
ObjCARC.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
Reassociate.cpp Silence a bunch (but not all) "variable written but not read" warnings 2011-08-12 14:54:45 +00:00
Reg2Mem.cpp Fix a ton of comment typos found by codespell. Patch by 2011-04-15 05:18:47 +00:00
Scalar.cpp Add a new ObjC ARC optimization pass to eliminate unneeded 2012-01-17 20:52:24 +00:00
ScalarReplAggregates.cpp use ConstantVector::getSplat in a few places. 2012-01-25 06:02:56 +00:00
SCCP.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
SimplifyCFGPass.cpp Convert CallInst and InvokeInst APIs to use ArrayRef. 2011-07-15 08:37:34 +00:00
SimplifyLibCalls.cpp Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
Sink.cpp Move Instruction::isSafeToSpeculativelyExecute out of VMCore and 2011-12-14 23:49:11 +00:00
TailRecursionElimination.cpp Correct over-zealous removal of hack. 2011-10-17 18:43:40 +00:00