The closed rewrite rules of a backend's isel plugin as C++; its gen writes them to the backend's isel_rules.h. More...
Classes | |
| struct | RefInfo |
| A ref of a matcher: its cover and how the lhs refers to it. More... | |
| struct | Use |
An operand position of a matcher in preorder: meta variable or Value ref index of the node owner. More... | |
| struct | Matcher |
| A matcher and the shape of its lhs; a cover's operands follow it in preorder. More... | |
| struct | Rewrite |
| A closed rule lhs ↦ rhs, whose metas want num_metas consecutive entries of wants. More... | |
| struct | Root |
The rewrites rewrites[first, first + num) with the root axiom flags; roots is sorted by it. More... | |
| struct | Conversion |
| A conversion rule x ↦ rhs, whose lhs is all of its meta variables: a value of non-terminal from as one of to. More... | |
| struct | Chains |
| The cheapest chains of conversions between two non-terminals: their costs and each one's first conversion. More... | |
| struct | Table |
| The generated tables of one backend, as its isel_rules.h defines them. More... | |
Typedefs | |
| using | MatchFn = bool (*)(const Def* def, u32 swap, const Def** metas, const Def** refs) |
Matches the root def with the commuting nodes in swap swapped and binds metas and refs. | |
| using | BuildFn = const Def* (*)(World&, const Def* const* holes) |
Builds the rhs from holes, one per meta variable, already in the new world. | |
Enumerations | |
| enum class | Want : u8 |
| What a rule wants of the term a meta variable matches; a Param is bound but no operand. More... | |
| enum class | Ty : u8 |
| The non-terminal a rule yields by the type of its rhs: a register of either class, an address without/with an index, [I64, I2], or a register that holds its value zero-extended. More... | |
| enum class | Ref : u8 { Value , Mem } |
| How the lhs refers to one of its inner nodes. More... | |
Costs | |
Shared by an isel plugin's gen, which checks the rule set with them, and isel. | |
| constexpr u32 | Inf = u32(-1) |
| constexpr size_t | Num_Tys = 0 MIM_MACH_RULE_TYS(X) |
| constexpr u32 | Copy = 1 |
| A register-to-register copy, which move elimination makes free of latency. | |
| constexpr u32 | add (u32 a, u32 b) |
| constexpr bool | is_param (Want w) |
Is a meta variable that w wants bound to its rewrite rather than an operand? | |
| constexpr bool | is_literal (Want want) |
Does a hole of type want take a literal rather than a replacement? | |
| constexpr Want | literal_of (Want want) |
The literal form of a hole of type want, or want itself. | |
| constexpr bool | fills (Ty ty, Want want) |
Does a value of non-terminal ty fill a hole of type want as it is? | |
| constexpr Want | reg_want (Ty ty) |
The register hole that a value of non-terminal ty fills. | |
| constexpr bool | same_class (Ty ty, Want want) |
Is a value of non-terminal ty in the same register class as a hole of type want? | |
The closed rewrite rules of a backend's isel plugin as C++; its gen writes them to the backend's isel_rules.h.
| struct mim::plug::mach::rules::RefInfo |
A ref of a matcher: its cover and how the lhs refers to it.
Definition at line 56 of file rule_table.h.
| Class Members | ||
|---|---|---|
| u8 | cover | |
| Ref | kind | |
| struct mim::plug::mach::rules::Use |
An operand position of a matcher in preorder: meta variable or Value ref index of the node owner.
Definition at line 62 of file rule_table.h.
| Class Members | ||
|---|---|---|
| u8 | index | |
| u8 | owner | |
| bool | ref | |
| struct mim::plug::mach::rules::Matcher |
| struct mim::plug::mach::rules::Rewrite |
A closed rule lhs ↦ rhs, whose metas want num_metas consecutive entries of wants.
Definition at line 79 of file rule_table.h.
| Class Members | ||
|---|---|---|
| BuildFn | build | |
| u32 | copy_swaps | Those of swaps whose operands differ only as a RegImm or RegSh, which a literal never fills. |
| u32 | cost | The summed instruction costs of its rhs. |
| u8 | maps | k + 1 if the rhs replaces cover k as a whole, or 0. |
| const Matcher * | match | |
| string_view | name | |
| u8 | num_metas | |
| flags_t | root | The axiom at the head of its lhs, or 0 for an Extract. |
| u32 | swaps | The swaps of match that may yield another match. |
| u32 | tied | The meta variables that a two-address instruction of the rhs overwrites. |
| Ty | type | The non-terminal its rhs yields. |
| u32 | wants | |
| struct mim::plug::mach::rules::Root |
| struct mim::plug::mach::rules::Conversion |
| struct mim::plug::mach::rules::Table |
The generated tables of one backend, as its isel_rules.h defines them.
Definition at line 220 of file rule_table.h.
| Class Members | ||
|---|---|---|
| const Chains & | chains | |
| span< const Conversion > | conversions | |
| span< const Matcher > | matchers | |
| size_t | max_covers | |
| size_t | max_metas | |
| size_t | max_refs | |
| span< const RefInfo > | refs | |
| span< const Rewrite > | rewrites | |
| span< const Root > | roots | |
| span< const Use > | uses | |
| span< const Want > | wants | |
| using mim::plug::mach::rules::BuildFn = const Def* (*)(World&, const Def* const* holes) |
Builds the rhs from holes, one per meta variable, already in the new world.
Definition at line 47 of file rule_table.h.
| using mim::plug::mach::rules::MatchFn = bool (*)(const Def* def, u32 swap, const Def** metas, const Def** refs) |
Matches the root def with the commuting nodes in swap swapped and binds metas and refs.
Definition at line 45 of file rule_table.h.
|
strong |
How the lhs refers to one of its inner nodes.
| Enumerator | |
|---|---|
| Value | As an operand of its owner, which nothing outside the match uses. |
| Mem | By its memory, which only the match uses. |
Definition at line 50 of file rule_table.h.
|
strong |
The non-terminal a rule yields by the type of its rhs: a register of either class, an address without/with an index, [I64, I2], or a register that holds its value zero-extended.
Lit is no rule's type but that of a literal operand.
Definition at line 38 of file rule_table.h.
|
strong |
What a rule wants of the term a meta variable matches; a Param is bound but no operand.
A Lit is a Param that must be a literal. Reg is a general-purpose register, FReg a floating-point one, and Base/Index an address without/with an index. Addr is either address form, and Scaled an index with its scale. Zx is a general-purpose register that holds its value zero-extended, which mach.zext reads without an instruction. Imm is a literal that fits the backend's immediates, Sh a literal shift count, which the machine masks. RegImm and RegSh are a Reg, or an Imm and a Sh for a literal that is one.
Definition at line 28 of file rule_table.h.
Definition at line 123 of file rule_table.h.
Referenced by add(), and mim::plug::mach::rules::Chains::Chains().
Does a value of non-terminal ty fill a hole of type want as it is?
Definition at line 137 of file rule_table.h.
References fills().
Referenced by fills(), and mim::plug::mach::rules::Chains::target().
|
constexpr |
Does a hole of type want take a literal rather than a replacement?
Definition at line 129 of file rule_table.h.
References is_literal().
Referenced by mim::plug::mach::rules::Chains::conv(), and is_literal().
|
constexpr |
Is a meta variable that w wants bound to its rewrite rather than an operand?
Definition at line 126 of file rule_table.h.
References is_param().
Referenced by is_param().
The literal form of a hole of type want, or want itself.
Definition at line 132 of file rule_table.h.
References literal_of().
Referenced by literal_of().
The register hole that a value of non-terminal ty fills.
Definition at line 153 of file rule_table.h.
References reg_want().
Referenced by reg_want().
Is a value of non-terminal ty in the same register class as a hole of type want?
Conversions never cross between general-purpose and floating-point registers.
Definition at line 157 of file rule_table.h.
References same_class().
Referenced by mim::plug::mach::rules::Chains::reachable(), same_class(), and mim::plug::mach::rules::Chains::total().
|
inlineconstexpr |
A register-to-register copy, which move elimination makes free of latency.
Definition at line 121 of file rule_table.h.
Referenced by mim::plug::mach::ISel::analyze().
Definition at line 114 of file rule_table.h.
Referenced by add(), mim::plug::mach::rules::Chains::Chains(), mim::plug::mach::rules::Chains::conv(), mim::plug::mach::rules::Chains::reachable(), mim::plug::mach::rules::Chains::target(), and mim::plug::mach::rules::Chains::total().
|
inlineconstexpr |
Definition at line 117 of file rule_table.h.
Referenced by mim::plug::mach::rules::Chains::Chains(), mim::plug::mach::rules::Chains::reachable(), mim::plug::mach::rules::Chains::target(), and mim::plug::mach::rules::Chains::total().