Add Apply.inst_predicate().

Compute an instruction predicate from any constant values given as
arguments for the immediate operands in an instruction pattern.

Allows for patterns like icmp.i32(intcc.ugt, x, y) or iadd_imm.i32(x, 1)

Trap these predicates in the legalizer code generator since we can't
actually handle them yet.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-31 10:12:23 -07:00
parent 63a6ade0a5
commit 0403845c40
3 changed files with 36 additions and 1 deletions

View File

@@ -211,6 +211,12 @@ def gen_xform(xform, fmt):
# variables.
unwrap_inst('inst', xform.src.rtl[0], fmt)
# We could support instruction predicates, but not yet. Should we just
# return false if it fails? What about multiple patterns with different
# predicates for the same opcode?
instp = xform.src.rtl[0].expr.inst_predicate()
assert instp is None, "Instruction predicates not supported in legalizer"
# Emit the destination pattern.
for dst in xform.dst.rtl:
emit_dst_inst(dst, fmt)