mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
[C++11] Add two range adaptor views to User: operands and
operand_values. The first provides a range view over operand Use objects, and the second provides a range view over the Value*s being used by those operands. The naming is "STL-style" rather than "LLVM-style" because we have historically named iterator methods STL-style, and range methods seem to have far more in common with their iterator counterparts than with "normal" APIs. Feel free to bikeshed on this one if you want, I'm happy to change these around if people feel strongly. I've switched code in SROA and LCG to exercise these mostly to ensure they work correctly -- we don't really have an easy way to unittest this and they're trivial. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202687 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,11 +40,9 @@ static void findCallees(
|
||||
continue;
|
||||
}
|
||||
|
||||
for (User::value_op_iterator OI = C->value_op_begin(),
|
||||
OE = C->value_op_end();
|
||||
OI != OE; ++OI)
|
||||
if (Visited.insert(cast<Constant>(*OI)))
|
||||
Worklist.push_back(cast<Constant>(*OI));
|
||||
for (Value *Op : C->operand_values())
|
||||
if (Visited.insert(cast<Constant>(Op)))
|
||||
Worklist.push_back(cast<Constant>(Op));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +54,8 @@ LazyCallGraph::Node::Node(LazyCallGraph &G, Function &F) : G(G), F(F) {
|
||||
for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI)
|
||||
for (BasicBlock::iterator II = BBI->begin(), IE = BBI->end(); II != IE;
|
||||
++II)
|
||||
for (User::value_op_iterator OI = II->value_op_begin(),
|
||||
OE = II->value_op_end();
|
||||
OI != OE; ++OI)
|
||||
if (Constant *C = dyn_cast<Constant>(*OI))
|
||||
for (Value *Op : II->operand_values())
|
||||
if (Constant *C = dyn_cast<Constant>(Op))
|
||||
if (Visited.insert(C))
|
||||
Worklist.push_back(C);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user