Commit Graph

11 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
ac830e0446 Remove the number field from the PredNode union type.
Predicate numbers are available in the maps
isa.settings.predicate_number and isa.instp_number instead.

Like the name field, predicate numbers don't interact well with
unique_pred().
2017-07-26 11:06:43 -07:00
Jakob Stoklund Olesen
84fffa79f6 Remove the name field from the PredNode union type.
The name of a predicate was only ever used for named settings that are
computed as a boolean expression of other settings.

- Record the names of these settings in named_predicates instead.
- Remove the name field from all predicates.

Named predicates does not interact well with the interning of predicates
through isa.unique_pred().
2017-07-26 10:14:26 -07:00
Jakob Stoklund Olesen
136cfe00dd Add a predicate_key() method to all predicates.
This enables interning of predicates to avoid duplicates.

Add a predicate registry to TargetIsa for interning predicates per ISA.
2017-07-26 09:58:16 -07:00
Jakob Stoklund Olesen
6da734221a Generate type check predicates for secondary type variables.
The encoding tables are keyed by the controlling type variable only. We
need to distinguish different encodings for instructions with multiple
type variables.

Add a TypePredicate instruction predicate which can check the type of an
instruction value operand. Combine type checks into the instruction
predicate for instructions with more than one type variable.

Add Intel encodings for fcvt_from_sint.f32.i64 which can now be
distinguished from fcvt_from_sint.f32.i32.
2017-07-26 08:19:44 -07:00
Jakob Stoklund Olesen
3c3d068379 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.
2017-03-31 13:46:39 -07:00
Jakob Stoklund Olesen
89ff979d75 Add InstructionFormat.imm_fields.
Consolidate the imm_members and imm_kinds into this list so the
FormatField is the single definition of these properties.

This makes it easier to access the precomputed FormatFields
parametrically, avoiding going through getattr().

This is better for type checking too.
2017-03-31 13:46:39 -07:00
Jakob Stoklund Olesen
b31ca83b91 Add an IsEqual FieldPredicate.
Compare an immediate operand to a constant value.
2017-03-31 13:46:38 -07:00
Jakob Stoklund Olesen
a9ec28ab7c Add mypy types for gen_settings.py. 2017-03-30 18:42:06 -07:00
Jakob Stoklund Olesen
a82e521291 Add more mypy annotations. 2017-03-30 15:16:44 -07:00
Jakob Stoklund Olesen
ae12c94d04 Add mypy annotations to cdsl.predicates, settings.
Wherein we learned that only BoolSettings can be used as predicates.
2017-03-30 14:11:19 -07:00
Jakob Stoklund Olesen
2fe61e83f6 Split out predicates and settings.
- cdsl.predicates defines classes for describing predicates.
- cdsl.settings defines classes for describing settings.
- base.settings defines shared settings.
2016-11-08 10:37:17 -08:00