This commit is contained in:
Michael McLoughlin
2018-11-20 11:44:44 -06:00
parent 33ef56f40e
commit 7c2990754f
7 changed files with 2519 additions and 4 deletions

View File

@@ -70,7 +70,7 @@ func (p *GoPrinter) function(f *Function) {
p.printf("TEXT %s%s(SB),0,$%d-%d\n", dot, f.Name(), f.FrameBytes(), f.ArgumentBytes())
for _, i := range f.inst {
p.printf("\t%s\t%s\n", i.Mnemonic, strings.Join(i.Operands, ", "))
p.printf("\t%s\t%s\n", i.Mnemonic, joinOperands(i.Operands))
}
}
@@ -83,3 +83,11 @@ func (p *GoPrinter) printf(format string, args ...interface{}) {
p.err = err
}
}
func joinOperands(operands []Operand) string {
asm := make([]string, len(operands))
for i, op := range operands {
asm[i] = op.Asm()
}
return strings.Join(asm, ", ")
}