summaryrefslogtreecommitdiff
path: root/parse-opcodes
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2016-04-14 15:19:46 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2016-04-14 15:19:46 -0400
commitdf568413b5c1e4eeeb289798e7450c6f1cee7482 (patch)
tree880d1c64713cb5646cf818203536720aa3f54ca2 /parse-opcodes
parent7df34219bfd75086415583689e6230d3791b6187 (diff)
Go: Return errors out of band
Diffstat (limited to 'parse-opcodes')
-rwxr-xr-xparse-opcodes6
1 files changed, 3 insertions, 3 deletions
diff --git a/parse-opcodes b/parse-opcodes
index 79a1f0f..75351c5 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -780,7 +780,7 @@ 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}' % (opcode, funct3, signed(csr, 12), funct7)
+ print '\t\treturn &inst{0x%x, 0x%x, %d, 0x%x}, false' % (opcode, funct3, signed(csr, 12), funct7)
def make_go():
print '// Automatically generated by parse-opcodes'
@@ -800,13 +800,13 @@ def make_go():
print '\tfunct7 uint32'
print '}'
print
- print 'func encode(a obj.As) *inst {'
+ print 'func encode(a obj.As) (i *inst, err 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'
+ print '\treturn nil, true'
print '}'
for line in sys.stdin: