mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +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:
@@ -948,6 +948,7 @@ void SwitchInst::addCase(Constant *OnVal, BasicBlock *Dest) {
|
|||||||
if (OpNo+2 > ReservedSpace)
|
if (OpNo+2 > ReservedSpace)
|
||||||
resizeOperands(0); // Get more space!
|
resizeOperands(0); // Get more space!
|
||||||
// Initialize some new operands.
|
// Initialize some new operands.
|
||||||
|
assert(OpNo+1 < ReservedSpace && "Growing didn't work!");
|
||||||
NumOperands = OpNo+2;
|
NumOperands = OpNo+2;
|
||||||
OperandList[OpNo].init(OnVal, this);
|
OperandList[OpNo].init(OnVal, this);
|
||||||
OperandList[OpNo+1].init(Dest, this);
|
OperandList[OpNo+1].init(Dest, this);
|
||||||
@@ -989,14 +990,14 @@ void SwitchInst::removeCase(unsigned idx) {
|
|||||||
///
|
///
|
||||||
void SwitchInst::resizeOperands(unsigned NumOps) {
|
void SwitchInst::resizeOperands(unsigned NumOps) {
|
||||||
if (NumOps == 0) {
|
if (NumOps == 0) {
|
||||||
NumOps = (getNumOperands())*3/2;
|
NumOps = getNumOperands()/2*6;
|
||||||
} else if (NumOps*2 > NumOperands) {
|
} else if (NumOps*2 > NumOperands) {
|
||||||
// No resize needed.
|
// No resize needed.
|
||||||
if (ReservedSpace >= NumOps) return;
|
if (ReservedSpace >= NumOps) return;
|
||||||
} else if (NumOps == NumOperands) {
|
} else if (NumOps == NumOperands) {
|
||||||
if (ReservedSpace == NumOps) return;
|
if (ReservedSpace == NumOps) return;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReservedSpace = NumOps;
|
ReservedSpace = NumOps;
|
||||||
|
Reference in New Issue
Block a user