summary refs log tree commit diff
path: root/all.h
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2019-04-11 19:36:13 +0200
committerQuentin Carbonneaux <quentin@c9x.me>2019-04-11 20:18:20 +0200
commit81da1cdebb213077a1ce2c1aaed051de0751e13c (patch)
tree0d4022e2db324543bf9e0caf802043a5b11495d7 /all.h
parentd84f5fcbb75dcf8f6ff1f12e7509d05598a4b561 (diff)
downloadroux-81da1cdebb213077a1ce2c1aaed051de0751e13c.tar.gz
properly detect ssa form
Previously, we would skip ssa construction when
a temporary has a single definition.  This is
only part of the ssa invariant: we must also
check that all uses are dominated by the single
definition.  The new code does this.

In fact, qbe does not store all the dominators
for a block, so instead of walking the idom
linked list we use a rough heuristic and declare
conservatively that B0 dominates B1 when one of
the two conditions is true:

  a. B0 is the start block
  b. B0 is B1

Some measurements on a big file from Michael
Forney show that the code is still as fast as
before this patch.
Diffstat (limited to 'all.h')
-rw-r--r--all.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/all.h b/all.h
index ae39145..fc26a61 100644
--- a/all.h
+++ b/all.h
@@ -248,7 +248,7 @@ struct Use {
 		UIns,
 		UJmp,
 	} type;
-	int bid;
+	uint bid;
 	union {
 		Ins *ins;
 		Phi *phi;
@@ -279,6 +279,7 @@ struct Alias {
 
 struct Tmp {
 	char name[NString];
+	uint bid; /* id of a defining block */
 	Use *use;
 	uint ndef, nuse;
 	uint cost;