llvm-project/llvm/tools
Stepan Dyatkovskiy 513aaa5691 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.
llvm-svn: 149481
2012-02-01 07:49:51 +00:00
..
bugpoint Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
bugpoint-passes build: Tidy up a bunch of tool Makefiles, and simplify where possible using the 2011-10-18 19:27:24 +00:00
gold drop unneeded config.h includes 2011-12-22 23:04:07 +00:00
llc Add a TargetOption for disabling tail calls. 2012-01-19 00:34:10 +00:00
lli Adding a basic ELF dynamic loader and MC-JIT for ELF. Functionality is currently basic and will be enhanced with future patches. 2012-01-16 08:56:09 +00:00
llvm-ar LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-as LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-bcanalyzer Add bitcode reader and writer support for ConstantDataAggregate, which 2012-01-30 00:51:16 +00:00
llvm-config llvm-config: Add support for CMake build trees in which the build 2012-01-26 01:31:38 +00:00
llvm-cov LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-diff SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
llvm-dis LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-dwarfdump LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-extract Remove extraneous ".get()->" which is just "->". No functionality change. 2011-12-30 19:17:23 +00:00
llvm-ld Add a basic-block autovectorization pass. 2012-02-01 03:51:43 +00:00
llvm-link LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-mc llvm-mc pass through SourceMgr to MCContext. 2012-01-26 23:20:07 +00:00
llvm-nm Remove unused variables. 2011-12-25 01:20:19 +00:00
llvm-objdump Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
llvm-prof LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-ranlib LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-rtdyld Remove unreachable code. (replace with llvm_unreachable to help GCC where necessary) 2012-01-17 04:43:56 +00:00
llvm-shlib build: Tidy up a bunch of tool Makefiles, and simplify where possible using the 2011-10-18 19:27:24 +00:00
llvm-size LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-stub LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
lto Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
macho-dump LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
opt Add a basic-block autovectorization pass. 2012-02-01 03:51:43 +00:00
CMakeLists.txt Have cmake build llvm-cov. Patch by arrowdodger. 2011-12-07 20:54:41 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile llvm-config: Replace with C++ version (was llvm-config-2). 2011-12-01 20:18:09 +00:00