aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4jsir_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-08-05 14:11:16 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2014-08-13 12:53:19 +0200
commit2fea3d1899eb8cc81920b631ea73a1f130674950 (patch)
tree5e115b5fa3597b96b21176578aa1f741c76163f2 /src/qml/compiler/qv4jsir_p.h
parentd6a79aa6b06726d19d231d1da3ecb5b6509f0f1a (diff)
V4 IR: change IR printing to be more readable.
New structure: - "comments" now start with a semi-colon, and have a list of key: values. ; predecessors: L17 L26 L36, loop_header: yes ; line: 30, column: 3 - when a temporary has a known type, it is written in front of the teporary when it is being assigned, and not repeated. var %109 = this double %42 = 42 - an expression starts with the operation, followed by the operands that are separated by commas. The type of the operands is the type mentioned when they are assigned. int32 %115 = sub %184, %185 if gt %27, 0 goto L40 else goto L41 - conversions do mention the operand type in order to make them easier to read. double %178 = convert var to double %60 - phi node operands are prefixed by the from-label to make it easy to match those operands with the from-block. double %62 = phi L35: %58, L34: %61 - all names except for "this" and built-ins are prefixed by a dot in order to make it clear that a lookup will occur, just like member accesses. $6 = call .int2char($0) %7 = this %8 = %7.toString() Change-Id: I9f626a91f97ca7c3f27e01a5539f3c4fc10a46b4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4jsir_p.h')
-rw-r--r--src/qml/compiler/qv4jsir_p.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index fcdcdf9038..6f42a50a72 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -1043,13 +1043,17 @@ struct Function {
void setScheduledBlocks(const QVector<BasicBlock *> &scheduled);
void renumberBasicBlocks();
- unsigned getNewStatementId() { return _statementCount++; }
- unsigned statementCount() const { return _statementCount; }
+ int getNewStatementId() { return _statementCount++; }
+ int statementCount() const { return _statementCount; }
+
+private:
+ BasicBlock *getOrCreateBasicBlock(int index);
+ void setStatementCount(int cnt);
private:
QVector<BasicBlock *> _basicBlocks;
QVector<BasicBlock *> *_allBasicBlocks;
- unsigned _statementCount;
+ int _statementCount;
};
class CloneExpr: protected IR::ExprVisitor
@@ -1136,7 +1140,7 @@ private:
IR::Expr *cloned;
};
-class IRPrinter: public StmtVisitor, public ExprVisitor
+class Q_AUTOTEST_EXPORT IRPrinter: public StmtVisitor, public ExprVisitor
{
public:
IRPrinter(QTextStream *out);
@@ -1175,13 +1179,13 @@ public:
protected:
virtual void addStmtNr(Stmt *s);
- QString dumpStart(const Expr *e);
- const char *dumpEnd(const Expr *e);
- void printBlockStart(BasicBlock *bb);
+ void addJustifiedNr(int pos);
+ void printBlockStart();
protected:
QTextStream *out;
- bool printElse;
+ int positionSize;
+ BasicBlock *currentBB;
};
} // end of namespace IR