llvm.org GIT mirror llvm / 60ad781
rename use_const_iterator to const_use_iterator for consistency's sake git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99564 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 10 years ago
16 changed file(s) with 22 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
6666
6767 typedef PredIterator pred_iterator;
6868 typedef PredIterator
69 Value::use_const_iterator> pred_const_iterator;
69 Value::const_use_iterator> pred_const_iterator;
7070
7171 inline pred_iterator pred_begin(BasicBlock *BB) { return pred_iterator(BB); }
7272 inline pred_const_iterator pred_begin(const BasicBlock *BB) {
195195 bool isCallee(Value::use_iterator UI) const {
196196 return getCallee() == &UI.getUse();
197197 }
198 bool isCallee(Value::use_const_iterator UI) const {
198 bool isCallee(Value::const_use_iterator UI) const {
199199 return getCallee() == &UI.getUse();
200200 }
201201 private:
156156 // Methods for handling the chain of uses of this Value.
157157 //
158158 typedef value_use_iterator use_iterator;
159 typedef value_use_iterator use_const_iterator;
159 typedef value_use_iterator const_use_iterator;
160160
161161 bool use_empty() const { return UseList == 0; }
162162 use_iterator use_begin() { return use_iterator(UseList); }
163 use_const_iterator use_begin() const { return use_const_iterator(UseList); }
163 const_use_iterator use_begin() const { return const_use_iterator(UseList); }
164164 use_iterator use_end() { return use_iterator(0); }
165 use_const_iterator use_end() const { return use_const_iterator(0); }
165 const_use_iterator use_end() const { return const_use_iterator(0); }
166166 User *use_back() { return *use_begin(); }
167167 const User *use_back() const { return *use_begin(); }
168168
171171 /// traversing the whole use list.
172172 ///
173173 bool hasOneUse() const {
174 use_const_iterator I = use_begin(), E = use_end();
174 const_use_iterator I = use_begin(), E = use_end();
175175 if (I == E) return false;
176176 return ++I == E;
177177 }
4848 SmallSet Visited;
4949 int Count = 0;
5050
51 for (Value::use_const_iterator UI = V->use_begin(), UE = V->use_end();
51 for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
5252 UI != UE; ++UI) {
5353 // If there are lots of uses, conservatively say that the value
5454 // is captured to avoid taking too much compile time.
124124 bool LiveOutOfDefBB = false;
125125
126126 // Examine each use of the value.
127 for (Value::use_const_iterator I = V->use_begin(), E = V->use_end();
127 for (Value::const_use_iterator I = V->use_begin(), E = V->use_end();
128128 I != E; ++I) {
129129 const User *U = *I;
130130 const BasicBlock *UseBB = cast(U)->getParent();
138138 unsigned NumOfBitCastUses = 0;
139139
140140 // Determine if CallInst has a bitcast use.
141 for (Value::use_const_iterator UI = CI->use_begin(), E = CI->use_end();
141 for (Value::const_use_iterator UI = CI->use_begin(), E = CI->use_end();
142142 UI != E; )
143143 if (const BitCastInst *BCI = dyn_cast(*UI++)) {
144144 MallocType = cast(BCI->getDestTy());
173173 // don't mess around with them.
174174 BasicBlock::const_iterator BBI = BB->begin();
175175 while (const PHINode *PN = dyn_cast(BBI++)) {
176 for (Value::use_const_iterator UI = PN->use_begin(), E = PN->use_end();
176 for (Value::const_use_iterator UI = PN->use_begin(), E = PN->use_end();
177177 UI != E; ++UI) {
178178 const Instruction *User = cast(*UI);
179179 if (User->getParent() != DestBB || !isa(User))
18981898 const Value *V = U->getValue();
18991899 if (const Instruction *Inst = dyn_cast(V))
19001900 if (L->contains(Inst)) continue;
1901 for (Value::use_const_iterator UI = V->use_begin(), UE = V->use_end();
1901 for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
19021902 UI != UE; ++UI) {
19031903 const Instruction *UserInst = dyn_cast(*UI);
19041904 // Ignore non-instructions.
4444
4545 bool valueEscapes(const Instruction *Inst) const {
4646 const BasicBlock *BB = Inst->getParent();
47 for (Value::use_const_iterator UI = Inst->use_begin(),E = Inst->use_end();
47 for (Value::const_use_iterator UI = Inst->use_begin(),E = Inst->use_end();
4848 UI != E; ++UI)
4949 if (cast(*UI)->getParent() != BB ||
5050 isa(*UI))
17081708 // Delete any dead constantexpr klingons.
17091709 GV->removeDeadConstantUsers();
17101710
1711 for (Value::use_const_iterator UI = GV->use_begin(), E = GV->use_end();
1711 for (Value::const_use_iterator UI = GV->use_begin(), E = GV->use_end();
17121712 UI != E; ++UI) {
17131713 const User *U = *UI;
17141714 if (const StoreInst *SI = dyn_cast(U)) {
6767 // assignments to subsections of the memory unit.
6868
6969 // Only allow direct and non-volatile loads and stores...
70 for (Value::use_const_iterator UI = AI->use_begin(), UE = AI->use_end();
70 for (Value::const_use_iterator UI = AI->use_begin(), UE = AI->use_end();
7171 UI != UE; ++UI) // Loop over all of the uses of the alloca
7272 if (const LoadInst *LI = dyn_cast(*UI)) {
7373 if (LI->isVolatile())
159159 /// isConstantUsed - Return true if the constant has users other than constant
160160 /// exprs and other dangling things.
161161 bool Constant::isConstantUsed() const {
162 for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
162 for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
163163 const Constant *UC = dyn_cast(*UI);
164164 if (UC == 0 || isa(UC))
165165 return true;
403403 /// hasAddressTaken - returns true if there are any uses of this function
404404 /// other than direct calls or invokes to it.
405405 bool Function::hasAddressTaken(const User* *PutOffender) const {
406 for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
406 for (Value::const_use_iterator I = use_begin(), E = use_end(); I != E; ++I) {
407407 const User *U = *I;
408408 if (!isa(U) && !isa(U))
409409 return PutOffender ? (*PutOffender = U, true) : true;
6060 /// that want to check to see if a global is unused, but don't want to deal
6161 /// with potentially dead constants hanging off of the globals.
6262 void GlobalValue::removeDeadConstantUsers() const {
63 Value::use_const_iterator I = use_begin(), E = use_end();
64 Value::use_const_iterator LastNonDeadUser = E;
63 Value::const_use_iterator I = use_begin(), E = use_end();
64 Value::const_use_iterator LastNonDeadUser = E;
6565 while (I != E) {
6666 if (const Constant *User = dyn_cast(*I)) {
6767 if (!removeDeadUsersOfConstant(User)) {
282282 /// specified block. Note that PHI nodes are considered to evaluate their
283283 /// operands in the corresponding predecessor block.
284284 bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
285 for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
285 for (const_use_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
286286 // PHI nodes uses values in the corresponding predecessor block. For other
287287 // instructions, just check to see whether the parent of the use matches up.
288288 const PHINode *PN = dyn_cast(*UI);
8585 /// hasNUses - Return true if this Value has exactly N users.
8686 ///
8787 bool Value::hasNUses(unsigned N) const {
88 use_const_iterator UI = use_begin(), E = use_end();
88 const_use_iterator UI = use_begin(), E = use_end();
8989
9090 for (; N; --N, ++UI)
9191 if (UI == E) return false; // Too few.
9696 /// logically equivalent to getNumUses() >= N.
9797 ///
9898 bool Value::hasNUsesOrMore(unsigned N) const {
99 use_const_iterator UI = use_begin(), E = use_end();
99 const_use_iterator UI = use_begin(), E = use_end();
100100
101101 for (; N; --N, ++UI)
102102 if (UI == E) return false; // Too few.
107107 /// isUsedInBasicBlock - Return true if this value is used in the specified
108108 /// basic block.
109109 bool Value::isUsedInBasicBlock(const BasicBlock *BB) const {
110 for (use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
110 for (const_use_iterator I = use_begin(), E = use_end(); I != E; ++I) {
111111 const Instruction *User = dyn_cast(*I);
112112 if (User && User->getParent() == BB)
113113 return true;