From 5f761575188a34373ea74389fdd5e1aa0e59fe08 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Thu, 14 Apr 2016 15:39:29 -0400 Subject: Go: Return 'ok' status instead of 'err' status Also clean up imports. --- parse-opcodes | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/parse-opcodes b/parse-opcodes index 75351c5..3330646 100755 --- a/parse-opcodes +++ b/parse-opcodes @@ -780,18 +780,14 @@ def print_go_insn(name): funct3 = yank(m, 12, 3) csr = yank(m, 20, 12) funct7 = yank(m, 25, 7) - print '\t\treturn &inst{0x%x, 0x%x, %d, 0x%x}, false' % (opcode, funct3, signed(csr, 12), funct7) + print '\t\treturn &inst{0x%x, 0x%x, %d, 0x%x}, true' % (opcode, funct3, signed(csr, 12), funct7) def make_go(): print '// Automatically generated by parse-opcodes' print print 'package riscv' print - print 'import (' - print '\t"log"' - print - print '\t"cmd/internal/obj"' - print ')' + print 'import "cmd/internal/obj"' print print 'type inst struct {' print '\topcode uint32' @@ -800,13 +796,12 @@ def make_go(): print '\tfunct7 uint32' print '}' print - print 'func encode(a obj.As) (i *inst, err bool) {' + print 'func encode(a obj.As) (i *inst, ok bool) {' print '\tswitch a {' for name in namelist: print_go_insn(name) print '\t}' - print '\tlog.Fatalf("opcode: missing %v (bug in parse-opcodes)", a)' - print '\treturn nil, true' + print '\treturn nil, false' print '}' for line in sys.stdin: -- cgit v1.2.3