mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +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:
@ -2491,7 +2491,10 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
case bitc::FUNC_CODE_INST_SWITCH: { // SWITCH: [opty, op0, op1, ...]
|
||||
// Check magic
|
||||
if ((Record[0] >> 16) == SWITCH_INST_MAGIC) {
|
||||
// New SwitchInst format with case ranges.
|
||||
// "New" SwitchInst format with case ranges. The changes to write this
|
||||
// format were reverted but we still recognize bitcode that uses it.
|
||||
// Hopefully someday we will have support for case ranges and can use
|
||||
// this format again.
|
||||
|
||||
Type *OpTy = getTypeByID(Record[1]);
|
||||
unsigned ValueBitWidth = cast<IntegerType>(OpTy)->getBitWidth();
|
||||
@ -2508,7 +2511,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
|
||||
unsigned CurIdx = 5;
|
||||
for (unsigned i = 0; i != NumCases; ++i) {
|
||||
IntegersSubsetToBB CaseBuilder;
|
||||
SmallVector<ConstantInt*, 1> CaseVals;
|
||||
unsigned NumItems = Record[CurIdx++];
|
||||
for (unsigned ci = 0; ci != NumItems; ++ci) {
|
||||
bool isSingleNumber = Record[CurIdx++];
|
||||
@ -2528,20 +2531,22 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
APInt High =
|
||||
ReadWideAPInt(makeArrayRef(&Record[CurIdx], ActiveWords),
|
||||
ValueBitWidth);
|
||||
|
||||
CaseBuilder.add(IntItem::fromType(OpTy, Low),
|
||||
IntItem::fromType(OpTy, High));
|
||||
CurIdx += ActiveWords;
|
||||
|
||||
// FIXME: It is not clear whether values in the range should be
|
||||
// compared as signed or unsigned values. The partially
|
||||
// implemented changes that used this format in the past used
|
||||
// unsigned comparisons.
|
||||
for ( ; Low.ule(High); ++Low)
|
||||
CaseVals.push_back(ConstantInt::get(Context, Low));
|
||||
} else
|
||||
CaseBuilder.add(IntItem::fromType(OpTy, Low));
|
||||
CaseVals.push_back(ConstantInt::get(Context, Low));
|
||||
}
|
||||
BasicBlock *DestBB = getBasicBlock(Record[CurIdx++]);
|
||||
IntegersSubset Case = CaseBuilder.getCase();
|
||||
SI->addCase(Case, DestBB);
|
||||
for (SmallVector<ConstantInt*, 1>::iterator cvi = CaseVals.begin(),
|
||||
cve = CaseVals.end(); cvi != cve; ++cvi)
|
||||
SI->addCase(*cvi, DestBB);
|
||||
}
|
||||
uint16_t Hash = SI->hash();
|
||||
if (Hash != (Record[0] & 0xFFFF))
|
||||
return Error("Invalid SWITCH record");
|
||||
I = SI;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user