Legalization pattern emission WIP.

Begin emitting legalization patterns in the form of two functions,
'expand' and 'narrow' that are included in legalizer.rs.

The generated code compiles, but it is not fully working yet. We need to
deal with the special cases of instructions producing multiple results.
This commit is contained in:
Jakob Stoklund Olesen
2016-11-02 12:56:34 -07:00
parent 814d1728aa
commit 9c02fe3553
7 changed files with 113 additions and 41 deletions

View File

@@ -446,16 +446,12 @@ def gen_inst_builder(inst, fmt):
rvals = ', '.join(len(inst.value_results) * ['Value'])
rtype = '({})'.format(rvals)
method = inst.name
if method == 'return':
# Avoid Rust keywords by appending '_'.
method += '_'
if len(tmpl_types) > 0:
tmpl = '<{}>'.format(', '.join(tmpl_types))
else:
tmpl = ''
proto = '{}{}({}) -> {}'.format(method, tmpl, ', '.join(args), rtype)
proto = '{}{}({}) -> {}'.format(
inst.snake_name(), tmpl, ', '.join(args), rtype)
fmt.doc_comment('`{}`\n\n{}'.format(inst, inst.blurb()))
fmt.line('#[allow(non_snake_case)]')