forked from OSchip/llvm-project
rename use_const_iterator to const_use_iterator for consistency's sake
llvm-svn: 99564
This commit is contained in:
parent
d821f4ac60
commit
c78d720f02
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
typedef PredIterator<BasicBlock, Value::use_iterator> pred_iterator;
|
typedef PredIterator<BasicBlock, Value::use_iterator> pred_iterator;
|
||||||
typedef PredIterator<const BasicBlock,
|
typedef PredIterator<const BasicBlock,
|
||||||
Value::use_const_iterator> pred_const_iterator;
|
Value::const_use_iterator> pred_const_iterator;
|
||||||
|
|
||||||
inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
|
inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
|
||||||
inline pred_const_iterator pred_begin(const BasicBlock *BB) {
|
inline pred_const_iterator pred_begin(const BasicBlock *BB) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ public:
|
||||||
bool isCallee(Value::use_iterator UI) const {
|
bool isCallee(Value::use_iterator UI) const {
|
||||||
return getCallee() == &UI.getUse();
|
return getCallee() == &UI.getUse();
|
||||||
}
|
}
|
||||||
bool isCallee(Value::use_const_iterator UI) const {
|
bool isCallee(Value::const_use_iterator UI) const {
|
||||||
return getCallee() == &UI.getUse();
|
return getCallee() == &UI.getUse();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -157,13 +157,13 @@ public:
|
||||||
// Methods for handling the chain of uses of this Value.
|
// Methods for handling the chain of uses of this Value.
|
||||||
//
|
//
|
||||||
typedef value_use_iterator<User> use_iterator;
|
typedef value_use_iterator<User> use_iterator;
|
||||||
typedef value_use_iterator<const User> use_const_iterator;
|
typedef value_use_iterator<const User> const_use_iterator;
|
||||||
|
|
||||||
bool use_empty() const { return UseList == 0; }
|
bool use_empty() const { return UseList == 0; }
|
||||||
use_iterator use_begin() { return use_iterator(UseList); }
|
use_iterator use_begin() { return use_iterator(UseList); }
|
||||||
use_const_iterator use_begin() const { return use_const_iterator(UseList); }
|
const_use_iterator use_begin() const { return const_use_iterator(UseList); }
|
||||||
use_iterator use_end() { return use_iterator(0); }
|
use_iterator use_end() { return use_iterator(0); }
|
||||||
use_const_iterator use_end() const { return use_const_iterator(0); }
|
const_use_iterator use_end() const { return const_use_iterator(0); }
|
||||||
User *use_back() { return *use_begin(); }
|
User *use_back() { return *use_begin(); }
|
||||||
const User *use_back() const { return *use_begin(); }
|
const User *use_back() const { return *use_begin(); }
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
/// traversing the whole use list.
|
/// traversing the whole use list.
|
||||||
///
|
///
|
||||||
bool hasOneUse() const {
|
bool hasOneUse() const {
|
||||||
use_const_iterator I = use_begin(), E = use_end();
|
const_use_iterator I = use_begin(), E = use_end();
|
||||||
if (I == E) return false;
|
if (I == E) return false;
|
||||||
return ++I == E;
|
return ++I == E;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool llvm::PointerMayBeCaptured(const Value *V,
|
||||||
SmallSet<Use*, Threshold> Visited;
|
SmallSet<Use*, Threshold> Visited;
|
||||||
int Count = 0;
|
int Count = 0;
|
||||||
|
|
||||||
for (Value::use_const_iterator UI = V->use_begin(), UE = V->use_end();
|
for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
|
||||||
UI != UE; ++UI) {
|
UI != UE; ++UI) {
|
||||||
// If there are lots of uses, conservatively say that the value
|
// If there are lots of uses, conservatively say that the value
|
||||||
// is captured to avoid taking too much compile time.
|
// is captured to avoid taking too much compile time.
|
||||||
|
|
|
@ -125,7 +125,7 @@ LiveValues::Memo &LiveValues::compute(const Value *V) {
|
||||||
bool LiveOutOfDefBB = false;
|
bool LiveOutOfDefBB = false;
|
||||||
|
|
||||||
// Examine each use of the value.
|
// Examine each use of the value.
|
||||||
for (Value::use_const_iterator I = V->use_begin(), E = V->use_end();
|
for (Value::const_use_iterator I = V->use_begin(), E = V->use_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
const User *U = *I;
|
const User *U = *I;
|
||||||
const BasicBlock *UseBB = cast<Instruction>(U)->getParent();
|
const BasicBlock *UseBB = cast<Instruction>(U)->getParent();
|
||||||
|
|
|
@ -139,7 +139,7 @@ const PointerType *llvm::getMallocType(const CallInst *CI) {
|
||||||
unsigned NumOfBitCastUses = 0;
|
unsigned NumOfBitCastUses = 0;
|
||||||
|
|
||||||
// Determine if CallInst has a bitcast use.
|
// Determine if CallInst has a bitcast use.
|
||||||
for (Value::use_const_iterator UI = CI->use_begin(), E = CI->use_end();
|
for (Value::const_use_iterator UI = CI->use_begin(), E = CI->use_end();
|
||||||
UI != E; )
|
UI != E; )
|
||||||
if (const BitCastInst *BCI = dyn_cast<BitCastInst>(*UI++)) {
|
if (const BitCastInst *BCI = dyn_cast<BitCastInst>(*UI++)) {
|
||||||
MallocType = cast<PointerType>(BCI->getDestTy());
|
MallocType = cast<PointerType>(BCI->getDestTy());
|
||||||
|
|
|
@ -174,7 +174,7 @@ bool CodeGenPrepare::CanMergeBlocks(const BasicBlock *BB,
|
||||||
// don't mess around with them.
|
// don't mess around with them.
|
||||||
BasicBlock::const_iterator BBI = BB->begin();
|
BasicBlock::const_iterator BBI = BB->begin();
|
||||||
while (const PHINode *PN = dyn_cast<PHINode>(BBI++)) {
|
while (const PHINode *PN = dyn_cast<PHINode>(BBI++)) {
|
||||||
for (Value::use_const_iterator UI = PN->use_begin(), E = PN->use_end();
|
for (Value::const_use_iterator UI = PN->use_begin(), E = PN->use_end();
|
||||||
UI != E; ++UI) {
|
UI != E; ++UI) {
|
||||||
const Instruction *User = cast<Instruction>(*UI);
|
const Instruction *User = cast<Instruction>(*UI);
|
||||||
if (User->getParent() != DestBB || !isa<PHINode>(User))
|
if (User->getParent() != DestBB || !isa<PHINode>(User))
|
||||||
|
|
|
@ -1899,7 +1899,7 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
|
||||||
const Value *V = U->getValue();
|
const Value *V = U->getValue();
|
||||||
if (const Instruction *Inst = dyn_cast<Instruction>(V))
|
if (const Instruction *Inst = dyn_cast<Instruction>(V))
|
||||||
if (L->contains(Inst)) continue;
|
if (L->contains(Inst)) continue;
|
||||||
for (Value::use_const_iterator UI = V->use_begin(), UE = V->use_end();
|
for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
|
||||||
UI != UE; ++UI) {
|
UI != UE; ++UI) {
|
||||||
const Instruction *UserInst = dyn_cast<Instruction>(*UI);
|
const Instruction *UserInst = dyn_cast<Instruction>(*UI);
|
||||||
// Ignore non-instructions.
|
// Ignore non-instructions.
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace {
|
||||||
|
|
||||||
bool valueEscapes(const Instruction *Inst) const {
|
bool valueEscapes(const Instruction *Inst) const {
|
||||||
const BasicBlock *BB = Inst->getParent();
|
const BasicBlock *BB = Inst->getParent();
|
||||||
for (Value::use_const_iterator UI = Inst->use_begin(),E = Inst->use_end();
|
for (Value::const_use_iterator UI = Inst->use_begin(),E = Inst->use_end();
|
||||||
UI != E; ++UI)
|
UI != E; ++UI)
|
||||||
if (cast<Instruction>(*UI)->getParent() != BB ||
|
if (cast<Instruction>(*UI)->getParent() != BB ||
|
||||||
isa<PHINode>(*UI))
|
isa<PHINode>(*UI))
|
||||||
|
|
|
@ -1709,7 +1709,7 @@ static bool AddressIsTaken(const GlobalValue *GV) {
|
||||||
// Delete any dead constantexpr klingons.
|
// Delete any dead constantexpr klingons.
|
||||||
GV->removeDeadConstantUsers();
|
GV->removeDeadConstantUsers();
|
||||||
|
|
||||||
for (Value::use_const_iterator UI = GV->use_begin(), E = GV->use_end();
|
for (Value::const_use_iterator UI = GV->use_begin(), E = GV->use_end();
|
||||||
UI != E; ++UI) {
|
UI != E; ++UI) {
|
||||||
const User *U = *UI;
|
const User *U = *UI;
|
||||||
if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
|
if (const StoreInst *SI = dyn_cast<StoreInst>(U)) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) {
|
||||||
// assignments to subsections of the memory unit.
|
// assignments to subsections of the memory unit.
|
||||||
|
|
||||||
// Only allow direct and non-volatile loads and stores...
|
// Only allow direct and non-volatile loads and stores...
|
||||||
for (Value::use_const_iterator UI = AI->use_begin(), UE = AI->use_end();
|
for (Value::const_use_iterator UI = AI->use_begin(), UE = AI->use_end();
|
||||||
UI != UE; ++UI) // Loop over all of the uses of the alloca
|
UI != UE; ++UI) // Loop over all of the uses of the alloca
|
||||||
if (const LoadInst *LI = dyn_cast<LoadInst>(*UI)) {
|
if (const LoadInst *LI = dyn_cast<LoadInst>(*UI)) {
|
||||||
if (LI->isVolatile())
|
if (LI->isVolatile())
|
||||||
|
|
|
@ -160,7 +160,7 @@ bool Constant::canTrap() const {
|
||||||
/// isConstantUsed - Return true if the constant has users other than constant
|
/// isConstantUsed - Return true if the constant has users other than constant
|
||||||
/// exprs and other dangling things.
|
/// exprs and other dangling things.
|
||||||
bool Constant::isConstantUsed() const {
|
bool Constant::isConstantUsed() const {
|
||||||
for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
||||||
const Constant *UC = dyn_cast<Constant>(*UI);
|
const Constant *UC = dyn_cast<Constant>(*UI);
|
||||||
if (UC == 0 || isa<GlobalValue>(UC))
|
if (UC == 0 || isa<GlobalValue>(UC))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -404,7 +404,7 @@ Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys,
|
||||||
/// hasAddressTaken - returns true if there are any uses of this function
|
/// hasAddressTaken - returns true if there are any uses of this function
|
||||||
/// other than direct calls or invokes to it.
|
/// other than direct calls or invokes to it.
|
||||||
bool Function::hasAddressTaken(const User* *PutOffender) const {
|
bool Function::hasAddressTaken(const User* *PutOffender) const {
|
||||||
for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
|
for (Value::const_use_iterator I = use_begin(), E = use_end(); I != E; ++I) {
|
||||||
const User *U = *I;
|
const User *U = *I;
|
||||||
if (!isa<CallInst>(U) && !isa<InvokeInst>(U))
|
if (!isa<CallInst>(U) && !isa<InvokeInst>(U))
|
||||||
return PutOffender ? (*PutOffender = U, true) : true;
|
return PutOffender ? (*PutOffender = U, true) : true;
|
||||||
|
|
|
@ -61,8 +61,8 @@ void GlobalValue::Dematerialize() {
|
||||||
/// that want to check to see if a global is unused, but don't want to deal
|
/// that want to check to see if a global is unused, but don't want to deal
|
||||||
/// with potentially dead constants hanging off of the globals.
|
/// with potentially dead constants hanging off of the globals.
|
||||||
void GlobalValue::removeDeadConstantUsers() const {
|
void GlobalValue::removeDeadConstantUsers() const {
|
||||||
Value::use_const_iterator I = use_begin(), E = use_end();
|
Value::const_use_iterator I = use_begin(), E = use_end();
|
||||||
Value::use_const_iterator LastNonDeadUser = E;
|
Value::const_use_iterator LastNonDeadUser = E;
|
||||||
while (I != E) {
|
while (I != E) {
|
||||||
if (const Constant *User = dyn_cast<Constant>(*I)) {
|
if (const Constant *User = dyn_cast<Constant>(*I)) {
|
||||||
if (!removeDeadUsersOfConstant(User)) {
|
if (!removeDeadUsersOfConstant(User)) {
|
||||||
|
|
|
@ -283,7 +283,7 @@ bool Instruction::isSameOperationAs(const Instruction *I) const {
|
||||||
/// specified block. Note that PHI nodes are considered to evaluate their
|
/// specified block. Note that PHI nodes are considered to evaluate their
|
||||||
/// operands in the corresponding predecessor block.
|
/// operands in the corresponding predecessor block.
|
||||||
bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
|
bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
|
||||||
for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
|
||||||
// PHI nodes uses values in the corresponding predecessor block. For other
|
// PHI nodes uses values in the corresponding predecessor block. For other
|
||||||
// instructions, just check to see whether the parent of the use matches up.
|
// instructions, just check to see whether the parent of the use matches up.
|
||||||
const PHINode *PN = dyn_cast<PHINode>(*UI);
|
const PHINode *PN = dyn_cast<PHINode>(*UI);
|
||||||
|
|
|
@ -86,7 +86,7 @@ Value::~Value() {
|
||||||
/// hasNUses - Return true if this Value has exactly N users.
|
/// hasNUses - Return true if this Value has exactly N users.
|
||||||
///
|
///
|
||||||
bool Value::hasNUses(unsigned N) const {
|
bool Value::hasNUses(unsigned N) const {
|
||||||
use_const_iterator UI = use_begin(), E = use_end();
|
const_use_iterator UI = use_begin(), E = use_end();
|
||||||
|
|
||||||
for (; N; --N, ++UI)
|
for (; N; --N, ++UI)
|
||||||
if (UI == E) return false; // Too few.
|
if (UI == E) return false; // Too few.
|
||||||
|
@ -97,7 +97,7 @@ bool Value::hasNUses(unsigned N) const {
|
||||||
/// logically equivalent to getNumUses() >= N.
|
/// logically equivalent to getNumUses() >= N.
|
||||||
///
|
///
|
||||||
bool Value::hasNUsesOrMore(unsigned N) const {
|
bool Value::hasNUsesOrMore(unsigned N) const {
|
||||||
use_const_iterator UI = use_begin(), E = use_end();
|
const_use_iterator UI = use_begin(), E = use_end();
|
||||||
|
|
||||||
for (; N; --N, ++UI)
|
for (; N; --N, ++UI)
|
||||||
if (UI == E) return false; // Too few.
|
if (UI == E) return false; // Too few.
|
||||||
|
@ -108,7 +108,7 @@ bool Value::hasNUsesOrMore(unsigned N) const {
|
||||||
/// isUsedInBasicBlock - Return true if this value is used in the specified
|
/// isUsedInBasicBlock - Return true if this value is used in the specified
|
||||||
/// basic block.
|
/// basic block.
|
||||||
bool Value::isUsedInBasicBlock(const BasicBlock *BB) const {
|
bool Value::isUsedInBasicBlock(const BasicBlock *BB) const {
|
||||||
for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
|
for (const_use_iterator I = use_begin(), E = use_end(); I != E; ++I) {
|
||||||
const Instruction *User = dyn_cast<Instruction>(*I);
|
const Instruction *User = dyn_cast<Instruction>(*I);
|
||||||
if (User && User->getParent() == BB)
|
if (User && User->getParent() == BB)
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue