how golang choose instructions?

130 views
Skip to first unread message

xie cui

unread,
Aug 23, 2020, 1:31:14 AM8/23/20
to golang-nuts
we can find same dynamic programming algorithm(like BURS bottom rewriting system), to choose instructions in book about compiler technique. but as far as i know, it seems that golang just transform ast to ssa IR, then lower to machine instruction. how i find the min cost of instructions?

Ian Lance Taylor

unread,
Aug 23, 2020, 2:03:02 PM8/23/20
to xie cui, golang-nuts
On Sat, Aug 22, 2020 at 10:31 PM xie cui <cuiw...@gmail.com> wrote:
>
> we can find same dynamic programming algorithm(like BURS bottom rewriting system), to choose instructions in book about compiler technique. but as far as i know, it seems that golang just transform ast to ssa IR, then lower to machine instruction. how i find the min cost of instructions?

I believe that instruction cost is implicitly encoded in the rules
that appear in the cmd/compile/internal/ssa/gen directory. The rules
only list the instruction choices that seem best. As far as I know
the gc compiler does not trade off between register allocation and
instruction selection, but I don't know everything that it does.

Ian
Reply all
Reply to author
Forward
0 new messages