llvm-6502/lib/VMCore
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
..
AsmWriter.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
Attributes.cpp Extend Attributes to 64 bits 2012-01-20 17:56:17 +00:00
AutoUpgrade.cpp
BasicBlock.cpp Add a constified getLandingPad() method. 2012-01-31 00:26:24 +00:00
CMakeLists.txt
ConstantFold.cpp Fix ConstantFoldShuffleVectorInstruction to properly handle the case 2012-01-30 05:34:13 +00:00
ConstantFold.h
Constants.cpp Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
ConstantsContext.h smallvectorize and ArrayRef'ize some stuff. 2012-01-26 20:40:56 +00:00
Core.cpp Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
DebugInfoProbe.cpp
DebugLoc.cpp
Dominators.cpp
Function.cpp
GCOV.cpp
Globals.cpp
GVMaterializer.cpp
InlineAsm.cpp
Instruction.cpp Remove unreachable code. (replace with llvm_unreachable to help GCC where necessary) 2012-01-17 04:43:56 +00:00
Instructions.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00
IntrinsicInst.cpp
IRBuilder.cpp Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail. 2012-02-01 04:51:17 +00:00
LeakDetector.cpp
LeaksContext.h
LLVMBuild.txt
LLVMContext.cpp
LLVMContextImpl.cpp start the implementation of a new ConstantDataVector and ConstantDataArray 2012-01-23 22:57:10 +00:00
LLVMContextImpl.h start the implementation of a new ConstantDataVector and ConstantDataArray 2012-01-23 22:57:10 +00:00
Makefile
Metadata.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
Module.cpp
Pass.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
PassManager.cpp Add pass printer passes in the right place. 2012-02-01 07:16:20 +00:00
PassRegistry.cpp
PrintModulePass.cpp
SymbolTableListTraitsImpl.h
Type.cpp add StructType helpers too. 2012-01-26 00:06:44 +00:00
Use.cpp
User.cpp
Value.cpp Make Value::isDereferenceablePointer() handle unreachable code blocks. (This 2012-01-23 00:05:17 +00:00
ValueSymbolTable.cpp
ValueTypes.cpp More dead code removal (using -Wunreachable-code) 2012-01-20 21:51:11 +00:00
Verifier.cpp SwitchInst refactoring. 2012-02-01 07:49:51 +00:00