Make legalization actions configurable.
When an instruction doesn't have a valid encoding for the target ISA, it needs to be legalized. Different legalization strategies can be expressed as separate XFormGroup objects. Make the choice of XFormGroup configurable per CPU mode, rather than depending on a hard-coded default. Add a CPUMode.legalize_type() method which assigns an XFormGroup to controlling type variables and lets you set a default. Add a `legalize` field to Level1Entry so the first-level hash table lookup gives us the configured default legalization action for the instruction's controlling type variable.
This commit is contained in:
@@ -11,6 +11,20 @@ from .recipes import R, Rshamt, Ricmp, I, Iz, Iicmp, Iret, Icall, Icopy
|
||||
from .recipes import U, UJ, UJcall, SB, SBzero, GPsp, GPfi, Irmov
|
||||
from .settings import use_m
|
||||
from cdsl.ast import Var
|
||||
from base.legalize import narrow, expand
|
||||
|
||||
RV32.legalize_type(
|
||||
default=narrow,
|
||||
i32=expand,
|
||||
f32=expand,
|
||||
f64=expand)
|
||||
|
||||
RV64.legalize_type(
|
||||
default=narrow,
|
||||
i32=expand,
|
||||
i64=expand,
|
||||
f32=expand,
|
||||
f64=expand)
|
||||
|
||||
# Dummies for instruction predicates.
|
||||
x = Var('x')
|
||||
|
||||
Reference in New Issue
Block a user