Generate encoding tables. (WIP).

Amend build script to generate an encodings-<isa>.rs file for each target ISA.

Emit a function that can evaluate instruction predicates.

Describe the 3-level tables used for representing insrruction encoding tables.
Add Python classes representing the tables.

The generated code is incomplete and not used anywhere yet.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-18 11:47:01 -07:00
parent 5f6859f0d9
commit 4f14d1ea32
3 changed files with 224 additions and 1 deletions

View File

@@ -51,12 +51,21 @@ class Formatter(object):
self.indent = self.indent[0:-self.shiftwidth]
def line(self, s=None):
"""And an indented line."""
"""Add an indented line."""
if s:
self.lines.append('{}{}\n'.format(self.indent, s))
else:
self.lines.append('\n')
def outdented_line(self, s):
"""
Emit a line outdented one level.
This is used for '} else {' and similar things inside a single indented
block.
"""
self.lines.append('{}{}\n'.format(self.indent[0:-self.shiftwidth], s))
def writelines(self, f=None):
"""Write all lines to `f`."""
if not f: