which pass of SSA will transform a ssa.Value(op=OpPhi) phi operations to a normal(not phi operations)?

61 views
Skip to first unread message

xie cui

unread,
Aug 15, 2020, 10:07:23 AM8/15/20
to golang-nuts
as we know, SSA has phi function, but the output of go tool compile -S xxx.go which do not contains a phi instruction. so i am trying to find out which SSA pass will transform a phi Op ssa.Value to normal ops?

Keith Randall

unread,
Aug 15, 2020, 8:05:45 PM8/15/20
to golang-nuts
The regalloc pass does that. It ensures that all the inputs and the output of a phi are all in the same register (or memory location), so the phi becomes a no-op.
The regalloc pass doesn't actually remove the phi, though. Removal is actually in genssa in cmd/compile/internal/gc/ssa.go. Look for CheckLoweredPhi, which makes sure that the above statement is actually correct for all phis.

Reply all
Reply to author
Forward
0 new messages