summaryrefslogtreecommitdiffstats
path: root/content/zettel/3a8a1.md
blob: aafc6779baf3d8a429dd283ebc2d537d00b63f76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
+++
title = "Representations of phi functions in CompCertSSA"
author = "Yann Herklotz"
tags = []
categories = []
backlinks = ["3a8a"]
forwardlinks = ["3a8a2"]
zettelid = "3a8a1"
+++

**Question**: How are phi functions represented, as they have their own
program tree?

They are represented using their own tree so that these are separate to
the standard RTL instructions, which alleviates the equivalence checking
between SSA and RTL.

The way that the phi instructions are then executed, is that after a
`Inop` branch, if it is a branching instruction, then the phi
instructions for that block are all executed in parallel, which means
the correct variables are chosen for each destination variable in the
phi instruction.

The way we know which value to take from the phi node, is that we know
which predecessor we are coming from. So if it's the \$k\$th
predecessor, then we take the \$k\$th index of the phi instruction
arguments.