Next:RTL SSA Access Lists, Previous:RTL SSA Register and Memory Accesses, Up:On-the-Side SSA Form for RTL [Contents][Index]
If a resource is live on entry to an extended basic block and if theresource’s value can come from multiple sources, the extended basic blockhas a “phi node” that collects together these multiple sources.The phi node conceptually has one input for each incoming edge ofthe extended basic block, with the input specifying the value ofthe resource on that edge. For example, suppose a function containsthe following RTL:
;; Basic block bb3…(set (reg:SI R1) (const_int 0)) ;; A(set (pc) (label_ref bb5));; Basic block bb4…(set (reg:SI R1) (const_int 1)) ;; B;; Fall through;; Basic block bb5;; preds: bb3, bb4;; live in: R1 …(code_label bb5)…(set (reg:SIR2) (plus:SI (reg:SI R1) …)) ;; C
The value of R1 on entry to block 5 can come from either A or B.The extended basic block that contains block 5 would therefore have aphi node with two inputs: the first input would have the value ofR1 defined by A and the second input would have the value ofR1 defined by B. This phi node would then provide the value ofR1 for C (assuming that R1 does not change again betweenthe start of block 5 and C).
Since RTL is not a “native” SSA representation, these phi nodessimply collect together definitions that already exist. Each inputto a phi node for a resourceR is itself a definition ofresourceR (or is null if the resource is completelyundefined for a particular incoming edge). This is in contrastto a native SSA representation like GIMPLE, where the phi inputscan be arbitrary expressions. As a result, RTL SSA phi nodesnever involve “hidden” moves: all moves are instead explicit.
Phi nodes are represented as artl_ssa::phi_node.Each input to a phi node is represented as anrtl_ssa::use_info.
Next:RTL SSA Access Lists, Previous:RTL SSA Register and Memory Accesses, Up:On-the-Side SSA Form for RTL [Contents][Index]