basic_block: Use a range-based for loop for iteration
This commit is contained in:
parent
897b776250
commit
2180a4be7a
1 changed files with 4 additions and 4 deletions
|
@ -57,8 +57,8 @@ std::string DumpBlock(const IR::Block& block) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto inst = block.begin(); inst != block.end(); ++inst) {
|
for (const auto& inst : block) {
|
||||||
const Opcode op = inst->GetOpcode();
|
const Opcode op = inst.GetOpcode();
|
||||||
|
|
||||||
if (GetTypeOf(op) != Type::Void) {
|
if (GetTypeOf(op) != Type::Void) {
|
||||||
ret += Common::StringFromFormat("%%%-5zu = ", index);
|
ret += Common::StringFromFormat("%%%-5zu = ", index);
|
||||||
|
@ -70,7 +70,7 @@ std::string DumpBlock(const IR::Block& block) {
|
||||||
|
|
||||||
const size_t arg_count = GetNumArgsOf(op);
|
const size_t arg_count = GetNumArgsOf(op);
|
||||||
for (size_t arg_index = 0; arg_index < arg_count; arg_index++) {
|
for (size_t arg_index = 0; arg_index < arg_count; arg_index++) {
|
||||||
const Value arg = inst->GetArg(arg_index);
|
const Value arg = inst.GetArg(arg_index);
|
||||||
|
|
||||||
ret += arg_index != 0 ? ", " : " ";
|
ret += arg_index != 0 ? ", " : " ";
|
||||||
ret += arg_to_string(arg);
|
ret += arg_to_string(arg);
|
||||||
|
@ -83,7 +83,7 @@ std::string DumpBlock(const IR::Block& block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += "\n";
|
ret += "\n";
|
||||||
inst_to_index[&*inst] = index++;
|
inst_to_index[&inst] = index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue