llvm-6502/lib
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
..
Analysis SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
Archive Avoid using an invalidated iterator. 2012-01-23 05:07:16 +00:00
AsmParser Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
Bitcode SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
CodeGen SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
DebugInfo More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
ExecutionEngine SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
Linker use Constant::getAggregateElement to simplify a bunch of code. 2012-01-25 06:48:06 +00:00
MC Fixed a crash in llvm-mc for Mach-O when a symbol difference expression uses a 2012-01-31 23:02:57 +00:00
Object Sink assert-only variables into the asserts 2012-01-24 19:43:30 +00:00
Support Add Triple::getMacOSXVersion to replace crufty code in the clang driver. 2012-01-31 22:32:29 +00:00
TableGen Implement String Cast from Integer 2012-01-30 20:47:04 +00:00
Target SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
Transforms SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
VMCore SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
CMakeLists.txt
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile