mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Revert patches to add case-range support for PR1255.
The work on this project was left in an unfinished and inconsistent state. Hopefully someone will eventually get a chance to implement this feature, but in the meantime, it is better to put things back the way the were. I have left support in the bitcode reader to handle the case-range bitcode format, so that we do not lose bitcode compatibility with the llvm 3.3 release. This reverts the following commits: 155464, 156374, 156377, 156613, 156704, 156757, 156804 156808, 156985, 157046, 157112, 157183, 157315, 157384, 157575, 157576, 157586, 157612, 157810, 157814, 157815, 157880, 157881, 157882, 157884, 157887, 157901, 158979, 157987, 157989, 158986, 158997, 159076, 159101, 159100, 159200, 159201, 159207, 159527, 159532, 159540, 159583, 159618, 159658, 159659, 159660, 159661, 159703, 159704, 160076, 167356, 172025, 186736 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -898,40 +898,11 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
|
||||
// Check to see if any of the cases match...
|
||||
BasicBlock *Dest = 0;
|
||||
for (SwitchInst::CaseIt i = I.case_begin(), e = I.case_end(); i != e; ++i) {
|
||||
IntegersSubset& Case = i.getCaseValueEx();
|
||||
if (Case.isSingleNumber()) {
|
||||
// FIXME: Currently work with ConstantInt based numbers.
|
||||
const ConstantInt *CI = Case.getSingleNumber(0).toConstantInt();
|
||||
GenericValue Val = getOperandValue(const_cast<ConstantInt*>(CI), SF);
|
||||
if (executeICMP_EQ(Val, CondVal, ElTy).IntVal != 0) {
|
||||
Dest = cast<BasicBlock>(i.getCaseSuccessor());
|
||||
break;
|
||||
}
|
||||
GenericValue CaseVal = getOperandValue(i.getCaseValue(), SF);
|
||||
if (executeICMP_EQ(CondVal, CaseVal, ElTy).IntVal != 0) {
|
||||
Dest = cast<BasicBlock>(i.getCaseSuccessor());
|
||||
break;
|
||||
}
|
||||
if (Case.isSingleNumbersOnly()) {
|
||||
for (unsigned n = 0, en = Case.getNumItems(); n != en; ++n) {
|
||||
// FIXME: Currently work with ConstantInt based numbers.
|
||||
const ConstantInt *CI = Case.getSingleNumber(n).toConstantInt();
|
||||
GenericValue Val = getOperandValue(const_cast<ConstantInt*>(CI), SF);
|
||||
if (executeICMP_EQ(Val, CondVal, ElTy).IntVal != 0) {
|
||||
Dest = cast<BasicBlock>(i.getCaseSuccessor());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
for (unsigned n = 0, en = Case.getNumItems(); n != en; ++n) {
|
||||
IntegersSubset::Range r = Case.getItem(n);
|
||||
// FIXME: Currently work with ConstantInt based numbers.
|
||||
const ConstantInt *LowCI = r.getLow().toConstantInt();
|
||||
const ConstantInt *HighCI = r.getHigh().toConstantInt();
|
||||
GenericValue Low = getOperandValue(const_cast<ConstantInt*>(LowCI), SF);
|
||||
GenericValue High = getOperandValue(const_cast<ConstantInt*>(HighCI), SF);
|
||||
if (executeICMP_ULE(Low, CondVal, ElTy).IntVal != 0 &&
|
||||
executeICMP_ULE(CondVal, High, ElTy).IntVal != 0) {
|
||||
Dest = cast<BasicBlock>(i.getCaseSuccessor());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Dest) Dest = I.getDefaultDest(); // No cases matched: use default
|
||||
SwitchToNewBasicBlock(Dest, SF);
|
||||
|
Reference in New Issue
Block a user