+++ 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.