summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2016-04-14 15:39:29 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2016-07-22 16:20:00 -0400
commit5f761575188a34373ea74389fdd5e1aa0e59fe08 (patch)
treef1b81cf7546d0d2cd37a57f29fd7b7136e2686fd
parentdf568413b5c1e4eeeb289798e7450c6f1cee7482 (diff)
Go: Return 'ok' status instead of 'err' status
Also clean up imports.
-rwxr-xr-xparse-opcodes13
1 files 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: