[SIL] NFC: Repack misc SwitchValueInst bits

This commit is contained in:
David Zarzycki
2017-12-17 20:49:02 -05:00
parent 5443923a0c
commit 315cf677dd
3 changed files with 22 additions and 14 deletions

View File

@@ -6821,8 +6821,6 @@ class SwitchValueInst
TermInst> {
friend SILBuilder;
unsigned NumCases : 31;
unsigned HasDefault : 1;
TailAllocatedOperandList<1> Operands;
SwitchValueInst(SILDebugLocation DebugLoc, SILValue Operand,
@@ -6864,20 +6862,24 @@ public:
SuccessorListTy getSuccessors() {
return MutableArrayRef<SILSuccessor>{getSuccessorBuf(),
static_cast<size_t>(NumCases + HasDefault)};
static_cast<size_t>(getNumCases() + hasDefault())};
}
unsigned getNumCases() const { return NumCases; }
unsigned getNumCases() const {
return SILInstruction::Bits.SwitchValueInst.NumCases;
}
std::pair<SILValue, SILBasicBlock*>
getCase(unsigned i) const {
assert(i < NumCases && "case out of bounds");
assert(i < getNumCases() && "case out of bounds");
return {getCaseBuf()[i], getSuccessorBuf()[i]};
}
bool hasDefault() const { return HasDefault; }
bool hasDefault() const {
return SILInstruction::Bits.SwitchValueInst.HasDefault;
}
SILBasicBlock *getDefaultBB() const {
assert(HasDefault && "doesn't have a default");
return getSuccessorBuf()[NumCases];
assert(hasDefault() && "doesn't have a default");
return getSuccessorBuf()[getNumCases()];
}
};