|
@@ -108,7 +108,7 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
|
|
|
|
|
|
// Nuke the last value.
|
|
|
Op<-1>().set(nullptr);
|
|
|
- --NumOperands;
|
|
|
+ setNumHungOffUseOperands(getNumOperands() - 1);
|
|
|
|
|
|
// If the PHI node is dead, because it has zero entries, nuke it now.
|
|
|
if (getNumOperands() == 0 && DeletePHIIfEmpty) {
|
|
@@ -199,7 +199,7 @@ LandingPadInst *LandingPadInst::Create(Type *RetTy, Value *PersonalityFn,
|
|
|
void LandingPadInst::init(Value *PersFn, unsigned NumReservedValues,
|
|
|
const Twine &NameStr) {
|
|
|
ReservedSpace = NumReservedValues;
|
|
|
- NumOperands = 1;
|
|
|
+ setNumHungOffUseOperands(1);
|
|
|
allocHungoffUses(ReservedSpace);
|
|
|
Op<0>() = PersFn;
|
|
|
setName(NameStr);
|
|
@@ -219,7 +219,7 @@ void LandingPadInst::addClause(Constant *Val) {
|
|
|
unsigned OpNo = getNumOperands();
|
|
|
growOperands(1);
|
|
|
assert(OpNo < ReservedSpace && "Growing didn't work!");
|
|
|
- ++NumOperands;
|
|
|
+ setNumHungOffUseOperands(getNumOperands() + 1);
|
|
|
getOperandList()[OpNo] = Val;
|
|
|
}
|
|
|
|
|
@@ -233,7 +233,7 @@ CallInst::~CallInst() {
|
|
|
void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
|
|
|
const Twine &NameStr) {
|
|
|
this->FTy = FTy;
|
|
|
- assert(NumOperands == Args.size() + 1 && "NumOperands not set up?");
|
|
|
+ assert(getNumOperands() == Args.size() + 1 && "NumOperands not set up?");
|
|
|
Op<-1>() = Func;
|
|
|
|
|
|
#ifndef NDEBUG
|
|
@@ -254,7 +254,7 @@ void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
|
|
|
void CallInst::init(Value *Func, const Twine &NameStr) {
|
|
|
FTy =
|
|
|
cast<FunctionType>(cast<PointerType>(Func->getType())->getElementType());
|
|
|
- assert(NumOperands == 1 && "NumOperands not set up?");
|
|
|
+ assert(getNumOperands() == 1 && "NumOperands not set up?");
|
|
|
Op<-1>() = Func;
|
|
|
|
|
|
assert(FTy->getNumParams() == 0 && "Calling a function with bad signature");
|
|
@@ -509,7 +509,7 @@ void InvokeInst::init(FunctionType *FTy, Value *Fn, BasicBlock *IfNormal,
|
|
|
const Twine &NameStr) {
|
|
|
this->FTy = FTy;
|
|
|
|
|
|
- assert(NumOperands == 3 + Args.size() && "NumOperands not set up?");
|
|
|
+ assert(getNumOperands() == 3 + Args.size() && "NumOperands not set up?");
|
|
|
Op<-3>() = Fn;
|
|
|
Op<-2>() = IfNormal;
|
|
|
Op<-1>() = IfException;
|
|
@@ -1205,7 +1205,8 @@ FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
|
|
|
|
|
|
void GetElementPtrInst::init(Value *Ptr, ArrayRef<Value *> IdxList,
|
|
|
const Twine &Name) {
|
|
|
- assert(NumOperands == 1 + IdxList.size() && "NumOperands not initialized?");
|
|
|
+ assert(getNumOperands() == 1 + IdxList.size() &&
|
|
|
+ "NumOperands not initialized?");
|
|
|
Op<0>() = Ptr;
|
|
|
std::copy(IdxList.begin(), IdxList.end(), op_begin() + 1);
|
|
|
setName(Name);
|
|
@@ -1518,7 +1519,7 @@ void ShuffleVectorInst::getShuffleMask(Constant *Mask,
|
|
|
|
|
|
void InsertValueInst::init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
|
|
|
const Twine &Name) {
|
|
|
- assert(NumOperands == 2 && "NumOperands not initialized?");
|
|
|
+ assert(getNumOperands() == 2 && "NumOperands not initialized?");
|
|
|
|
|
|
// There's no fundamental reason why we require at least one index
|
|
|
// (other than weirdness with &*IdxBegin being invalid; see
|
|
@@ -1549,7 +1550,7 @@ InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
void ExtractValueInst::init(ArrayRef<unsigned> Idxs, const Twine &Name) {
|
|
|
- assert(NumOperands == 1 && "NumOperands not initialized?");
|
|
|
+ assert(getNumOperands() == 1 && "NumOperands not initialized?");
|
|
|
|
|
|
// There's no fundamental reason why we require at least one index.
|
|
|
// But there's no present need to support it.
|
|
@@ -3263,7 +3264,7 @@ bool CmpInst::isFalseWhenEqual(unsigned short predicate) {
|
|
|
void SwitchInst::init(Value *Value, BasicBlock *Default, unsigned NumReserved) {
|
|
|
assert(Value && Default && NumReserved);
|
|
|
ReservedSpace = NumReserved;
|
|
|
- NumOperands = 2;
|
|
|
+ setNumHungOffUseOperands(2);
|
|
|
allocHungoffUses(ReservedSpace);
|
|
|
|
|
|
Op<0>() = Value;
|
|
@@ -3295,7 +3296,7 @@ SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
|
|
|
SwitchInst::SwitchInst(const SwitchInst &SI)
|
|
|
: TerminatorInst(SI.getType(), Instruction::Switch, nullptr, 0) {
|
|
|
init(SI.getCondition(), SI.getDefaultDest(), SI.getNumOperands());
|
|
|
- NumOperands = SI.getNumOperands();
|
|
|
+ setNumHungOffUseOperands(SI.getNumOperands());
|
|
|
Use *OL = getOperandList();
|
|
|
const Use *InOL = SI.getOperandList();
|
|
|
for (unsigned i = 2, E = SI.getNumOperands(); i != E; i += 2) {
|
|
@@ -3309,13 +3310,13 @@ SwitchInst::SwitchInst(const SwitchInst &SI)
|
|
|
/// addCase - Add an entry to the switch instruction...
|
|
|
///
|
|
|
void SwitchInst::addCase(ConstantInt *OnVal, BasicBlock *Dest) {
|
|
|
- unsigned NewCaseIdx = getNumCases();
|
|
|
- unsigned OpNo = NumOperands;
|
|
|
+ unsigned NewCaseIdx = getNumCases();
|
|
|
+ unsigned OpNo = getNumOperands();
|
|
|
if (OpNo+2 > ReservedSpace)
|
|
|
growOperands(); // Get more space!
|
|
|
// Initialize some new operands.
|
|
|
assert(OpNo+1 < ReservedSpace && "Growing didn't work!");
|
|
|
- NumOperands = OpNo+2;
|
|
|
+ setNumHungOffUseOperands(OpNo+2);
|
|
|
CaseIt Case(this, NewCaseIdx);
|
|
|
Case.setValue(OnVal);
|
|
|
Case.setSuccessor(Dest);
|
|
@@ -3340,7 +3341,7 @@ void SwitchInst::removeCase(CaseIt i) {
|
|
|
// Nuke the last value.
|
|
|
OL[NumOps-2].set(nullptr);
|
|
|
OL[NumOps-2+1].set(nullptr);
|
|
|
- NumOperands = NumOps-2;
|
|
|
+ setNumHungOffUseOperands(NumOps-2);
|
|
|
}
|
|
|
|
|
|
/// growOperands - grow operands - This grows the operand list in response
|
|
@@ -3373,7 +3374,7 @@ void IndirectBrInst::init(Value *Address, unsigned NumDests) {
|
|
|
assert(Address && Address->getType()->isPointerTy() &&
|
|
|
"Address of indirectbr must be a pointer");
|
|
|
ReservedSpace = 1+NumDests;
|
|
|
- NumOperands = 1;
|
|
|
+ setNumHungOffUseOperands(1);
|
|
|
allocHungoffUses(ReservedSpace);
|
|
|
|
|
|
Op<0>() = Address;
|
|
@@ -3419,12 +3420,12 @@ IndirectBrInst::IndirectBrInst(const IndirectBrInst &IBI)
|
|
|
/// addDestination - Add a destination.
|
|
|
///
|
|
|
void IndirectBrInst::addDestination(BasicBlock *DestBB) {
|
|
|
- unsigned OpNo = NumOperands;
|
|
|
+ unsigned OpNo = getNumOperands();
|
|
|
if (OpNo+1 > ReservedSpace)
|
|
|
growOperands(); // Get more space!
|
|
|
// Initialize some new operands.
|
|
|
assert(OpNo < ReservedSpace && "Growing didn't work!");
|
|
|
- NumOperands = OpNo+1;
|
|
|
+ setNumHungOffUseOperands(OpNo+1);
|
|
|
getOperandList()[OpNo] = DestBB;
|
|
|
}
|
|
|
|
|
@@ -3441,7 +3442,7 @@ void IndirectBrInst::removeDestination(unsigned idx) {
|
|
|
|
|
|
// Nuke the last value.
|
|
|
OL[NumOps-1].set(nullptr);
|
|
|
- NumOperands = NumOps-1;
|
|
|
+ setNumHungOffUseOperands(NumOps-1);
|
|
|
}
|
|
|
|
|
|
BasicBlock *IndirectBrInst::getSuccessorV(unsigned idx) const {
|