mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Make sure that we always grow a multiple of 2 operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19902 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
204fcaea41
commit
1f377fcaad
@ -948,6 +948,7 @@ void SwitchInst::addCase(Constant *OnVal, BasicBlock *Dest) {
|
||||
if (OpNo+2 > ReservedSpace)
|
||||
resizeOperands(0); // Get more space!
|
||||
// Initialize some new operands.
|
||||
assert(OpNo+1 < ReservedSpace && "Growing didn't work!");
|
||||
NumOperands = OpNo+2;
|
||||
OperandList[OpNo].init(OnVal, this);
|
||||
OperandList[OpNo+1].init(Dest, this);
|
||||
@ -989,14 +990,14 @@ void SwitchInst::removeCase(unsigned idx) {
|
||||
///
|
||||
void SwitchInst::resizeOperands(unsigned NumOps) {
|
||||
if (NumOps == 0) {
|
||||
NumOps = (getNumOperands())*3/2;
|
||||
NumOps = getNumOperands()/2*6;
|
||||
} else if (NumOps*2 > NumOperands) {
|
||||
// No resize needed.
|
||||
if (ReservedSpace >= NumOps) return;
|
||||
} else if (NumOps == NumOperands) {
|
||||
if (ReservedSpace == NumOps) return;
|
||||
} else {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
ReservedSpace = NumOps;
|
||||
|
Loading…
Reference in New Issue
Block a user