summaryrefslogtreecommitdiffstats
path: root/content/zettel/3a8a.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/zettel/3a8a.md')
-rw-r--r--content/zettel/3a8a.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/content/zettel/3a8a.md b/content/zettel/3a8a.md
new file mode 100644
index 0000000..4a51e13
--- /dev/null
+++ b/content/zettel/3a8a.md
@@ -0,0 +1,25 @@
++++
+title = "Phi instructions"
+author = "Yann Herklotz"
+tags = []
+categories = []
+backlinks = ["3a8"]
+forwardlinks = ["3a8b", "3a8a1"]
+zettelid = "3a8a"
++++
+
+One main difference between normal intermediate languages and SSA forms
+are phi nodes, which are needed to transform branching statements. By
+default, the translation from a non-SSA form to an SSA form can just be
+done by labelling each variable with an index, and then each new
+assignment to that variable increments the index by one. The last index
+is then used by each instruction that uses that variable, which means
+that the transformation is semantics preserving.
+
+However, this is not the case when one can have multiple branches from
+multiple locations to a block. In this case, one needs to add phi
+instructions to assign the right value to the register. The phi
+instructions is defined as a function which returns the argument
+according to which predecessor executed the instruction.
+
+This means that branching instructions can be executed correctly.