Pass an ISA argument to legalization functions.

This lets them look at the ISA flags.
This commit is contained in:
Jakob Stoklund Olesen
2018-02-12 14:21:41 -08:00
parent 60e70da0e6
commit a73fcb2691
6 changed files with 74 additions and 15 deletions

View File

@@ -360,6 +360,7 @@ def gen_xform_group(xgrp, fmt, type_sets):
fmt.line('inst: ir::Inst,')
fmt.line('func: &mut ir::Function,')
fmt.line('cfg: &mut ::flowgraph::ControlFlowGraph,')
fmt.line('isa: &::isa::TargetIsa,')
with fmt.indented(') -> bool {', '}'):
fmt.line('use ir::InstBuilder;')
fmt.line('use cursor::{Cursor, FuncCursor};')
@@ -387,7 +388,7 @@ def gen_xform_group(xgrp, fmt, type_sets):
with fmt.indented(
'ir::Opcode::{} => {{'
.format(inst.camel_name), '}'):
fmt.format('{}(inst, pos.func, cfg);', funcname)
fmt.format('{}(inst, pos.func, cfg, isa);', funcname)
fmt.line('return true;')
# We'll assume there are uncovered opcodes.
@@ -395,7 +396,7 @@ def gen_xform_group(xgrp, fmt, type_sets):
# If we fall through, nothing was expanded. Call the chain if any.
if xgrp.chain:
fmt.format('{}(inst, pos.func, cfg)', xgrp.chain.rust_name())
fmt.format('{}(inst, pos.func, cfg, isa)', xgrp.chain.rust_name())
else:
fmt.line('false')