Check for unsupported value transformations.

Add an assertion for the value placements that we don't support yet.

1. A primary result in the source pattern becomes a secondary result in
   the destination.
2. A secondary result becomes a secondary result, and the destination
   instruction is not exactly matching the source.
This commit is contained in:
Jakob Stoklund Olesen
2016-11-04 17:39:20 -07:00
parent 7bbbe97d2f
commit 1e2f3c0ed4

View File

@@ -138,9 +138,6 @@ def emit_dst_inst(node, fmt):
.format(replaced_inst), '}'): .format(replaced_inst), '}'):
fmt.line('pos.next_inst();') fmt.line('pos.next_inst();')
if exact_replace:
fmt.comment('exactreplacement')
# Fix up any output vars. # Fix up any output vars.
if fixup_first_result: if fixup_first_result:
# The first result of the instruction just inserted is an output var, # The first result of the instruction just inserted is an output var,
@@ -149,6 +146,15 @@ def emit_dst_inst(node, fmt):
# we just inserted. # we just inserted.
fmt.line('dfg.change_to_alias(src_{0}, {0});'.format(node.defs[0])) fmt.line('dfg.change_to_alias(src_{0}, {0});'.format(node.defs[0]))
if not exact_replace:
# We don't support secondary values as outputs yet. Depending on the
# source value, we would need to :
# 1. For a primary source value, replace with a copy instruction.
# 2. For a secondary source value, request that the builder reuses the
# value when making secondary result nodes.
for d in node.defs[1:]:
assert not d.is_output()
def gen_xform(xform, fmt): def gen_xform(xform, fmt):
# type: (XForm, Formatter) -> None # type: (XForm, Formatter) -> None