V4: use range-based for-loops in the IR.
Change-Id: I488a8700c1fc070c1cbdfd8b6d1b1e5614be8702 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
eea8fa64ab
commit
d19acb0cbb
|
@ -164,12 +164,12 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
|
||||||
subexpressions.clear();
|
subexpressions.clear();
|
||||||
subexpressions.reserve(function->basicBlockCount() * 8);
|
subexpressions.reserve(function->basicBlockCount() * 8);
|
||||||
|
|
||||||
foreach (BasicBlock *block, function->basicBlocks()) {
|
for (BasicBlock *block : function->basicBlocks()) {
|
||||||
if (block->isRemoved())
|
if (block->isRemoved())
|
||||||
continue;
|
continue;
|
||||||
clone.setBasicBlock(block);
|
clone.setBasicBlock(block);
|
||||||
|
|
||||||
foreach (Stmt *s, block->statements()) {
|
for (Stmt *s : block->statements()) {
|
||||||
s->accept(this);
|
s->accept(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ void Function::removeBasicBlock(BasicBlock *block)
|
||||||
int Function::liveBasicBlocksCount() const
|
int Function::liveBasicBlocksCount() const
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (BasicBlock *bb, basicBlocks())
|
for (BasicBlock *bb : basicBlocks())
|
||||||
if (!bb->isRemoved())
|
if (!bb->isRemoved())
|
||||||
++count;
|
++count;
|
||||||
return count;
|
return count;
|
||||||
|
@ -507,7 +507,7 @@ void Function::setStatementCount(int cnt)
|
||||||
|
|
||||||
BasicBlock::~BasicBlock()
|
BasicBlock::~BasicBlock()
|
||||||
{
|
{
|
||||||
foreach (Stmt *s, _statements) {
|
for (Stmt *s : qAsConst(_statements)) {
|
||||||
Phi *p = s->asPhi();
|
Phi *p = s->asPhi();
|
||||||
if (p)
|
if (p)
|
||||||
p->destroyData();
|
p->destroyData();
|
||||||
|
@ -764,7 +764,7 @@ void BasicBlock::setStatements(const QVector<Stmt *> &newStatements)
|
||||||
Q_ASSERT(!isRemoved());
|
Q_ASSERT(!isRemoved());
|
||||||
Q_ASSERT(newStatements.size() >= _statements.size());
|
Q_ASSERT(newStatements.size() >= _statements.size());
|
||||||
// FIXME: this gets quite inefficient for large basic-blocks, so this function/case should be re-worked.
|
// FIXME: this gets quite inefficient for large basic-blocks, so this function/case should be re-worked.
|
||||||
foreach (Stmt *s, _statements) {
|
for (Stmt *s : qAsConst(_statements)) {
|
||||||
Phi *p = s->asPhi();
|
Phi *p = s->asPhi();
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
@ -978,11 +978,11 @@ void IRPrinter::print(Function *f)
|
||||||
*out << ')' << endl
|
*out << ')' << endl
|
||||||
<< '{' << endl;
|
<< '{' << endl;
|
||||||
|
|
||||||
foreach (const QString *local, f->locals)
|
for (const QString *local : qAsConst(f->locals))
|
||||||
*out << " local var " << *local << endl;
|
*out << " local var " << *local << endl;
|
||||||
|
|
||||||
bool needsSeperator = !f->locals.isEmpty();
|
bool needsSeperator = !f->locals.isEmpty();
|
||||||
foreach (BasicBlock *bb, f->basicBlocks()) {
|
for (BasicBlock *bb : f->basicBlocks()) {
|
||||||
if (bb->isRemoved())
|
if (bb->isRemoved())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1000,7 +1000,7 @@ void IRPrinter::print(BasicBlock *bb)
|
||||||
std::swap(currentBB, bb);
|
std::swap(currentBB, bb);
|
||||||
printBlockStart();
|
printBlockStart();
|
||||||
|
|
||||||
foreach (Stmt *s, currentBB->statements()) {
|
for (Stmt *s : currentBB->statements()) {
|
||||||
if (!s)
|
if (!s)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1315,7 +1315,7 @@ void IRPrinter::printBlockStart()
|
||||||
*out << str;
|
*out << str;
|
||||||
|
|
||||||
*out << "; predecessors:";
|
*out << "; predecessors:";
|
||||||
foreach (BasicBlock *in, currentBB->in)
|
for (BasicBlock *in : qAsConst(currentBB->in))
|
||||||
*out << " L" << in->index();
|
*out << " L" << in->index();
|
||||||
if (currentBB->in.isEmpty())
|
if (currentBB->in.isEmpty())
|
||||||
*out << " none";
|
*out << " none";
|
||||||
|
|
Loading…
Reference in New Issue