ddc-core-llvm-0.4.1.3: Disciplined Disciple Compiler LLVM code generator.

Safe HaskellSafe-Inferred

DDC.Llvm.Transform.LinkPhi

Synopsis

Documentation

linkPhi :: Module -> ModuleSource

Link Phi instructions in a module.

For Phi instructions, the Salt->Llvm converter just fills in the source block label of each variable to be merged with undef. We need to add the real block label of the in-edge that defines each variable.

We build a graph of each block, work out the in-edges due to branches, and fill in the real block labels by back tracing the in-edges until we find the node that defines each variable.