mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Convert a few loops to use ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211089 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -73,37 +73,34 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
|
|||||||
SmallVector<std::pair<unsigned, MDNode*>, 8> MDs;
|
SmallVector<std::pair<unsigned, MDNode*>, 8> MDs;
|
||||||
|
|
||||||
// Enumerate types used by function bodies and argument lists.
|
// Enumerate types used by function bodies and argument lists.
|
||||||
for (Module::const_iterator F = M->begin(), E = M->end(); F != E; ++F) {
|
for (const Function &F : *M) {
|
||||||
|
for (const Argument &A : F.args())
|
||||||
|
EnumerateType(A.getType());
|
||||||
|
|
||||||
for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
|
for (const BasicBlock &BB : F)
|
||||||
I != E; ++I)
|
for (const Instruction &I : BB) {
|
||||||
EnumerateType(I->getType());
|
for (const Use &Op : I.operands()) {
|
||||||
|
if (MDNode *MD = dyn_cast<MDNode>(&Op))
|
||||||
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
|
|
||||||
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
|
|
||||||
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
|
|
||||||
OI != E; ++OI) {
|
|
||||||
if (MDNode *MD = dyn_cast<MDNode>(*OI))
|
|
||||||
if (MD->isFunctionLocal() && MD->getFunction())
|
if (MD->isFunctionLocal() && MD->getFunction())
|
||||||
// These will get enumerated during function-incorporation.
|
// These will get enumerated during function-incorporation.
|
||||||
continue;
|
continue;
|
||||||
EnumerateOperandType(*OI);
|
EnumerateOperandType(Op);
|
||||||
}
|
}
|
||||||
EnumerateType(I->getType());
|
EnumerateType(I.getType());
|
||||||
if (const CallInst *CI = dyn_cast<CallInst>(I))
|
if (const CallInst *CI = dyn_cast<CallInst>(&I))
|
||||||
EnumerateAttributes(CI->getAttributes());
|
EnumerateAttributes(CI->getAttributes());
|
||||||
else if (const InvokeInst *II = dyn_cast<InvokeInst>(I))
|
else if (const InvokeInst *II = dyn_cast<InvokeInst>(&I))
|
||||||
EnumerateAttributes(II->getAttributes());
|
EnumerateAttributes(II->getAttributes());
|
||||||
|
|
||||||
// Enumerate metadata attached with this instruction.
|
// Enumerate metadata attached with this instruction.
|
||||||
MDs.clear();
|
MDs.clear();
|
||||||
I->getAllMetadataOtherThanDebugLoc(MDs);
|
I.getAllMetadataOtherThanDebugLoc(MDs);
|
||||||
for (unsigned i = 0, e = MDs.size(); i != e; ++i)
|
for (unsigned i = 0, e = MDs.size(); i != e; ++i)
|
||||||
EnumerateMetadata(MDs[i].second);
|
EnumerateMetadata(MDs[i].second);
|
||||||
|
|
||||||
if (!I->getDebugLoc().isUnknown()) {
|
if (!I.getDebugLoc().isUnknown()) {
|
||||||
MDNode *Scope, *IA;
|
MDNode *Scope, *IA;
|
||||||
I->getDebugLoc().getScopeAndInlinedAt(Scope, IA, I->getContext());
|
I.getDebugLoc().getScopeAndInlinedAt(Scope, IA, I.getContext());
|
||||||
if (Scope) EnumerateMetadata(Scope);
|
if (Scope) EnumerateMetadata(Scope);
|
||||||
if (IA) EnumerateMetadata(IA);
|
if (IA) EnumerateMetadata(IA);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user