MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::mach::rules::Chains Struct Reference

The cheapest chains of conversions between two non-terminals: their costs and each one's first conversion. More...

#include <mim/plug/mach/rule_table.h>

Public Member Functions

constexpr Chains (const auto &conversions)
 The closure of conversions, a range of Conversion-like rules with from, to, and cost.
constexpr std::pair< Ty, u32 > target (Ty from, Want want) const
 The non-terminal that from converts to most cheaply for a hole of type want, and the cost.
constexpr u32 conv (Ty from, Want want) const
 Cost of converting a replacement or operand of non-terminal from into a hole of type want.
constexpr bool total (Want w) const
 Does every non-terminal of w's register class convert into a hole of type w, as an atomic rule's holes must?
constexpr bool reachable (Want w) const
 Does some non-terminal of the register class of a rule convert into a hole of type w?

Public Attributes

std::array< std::array< u32, Num_Tys >, Num_Tys > cost {}
std::array< std::array< u32, Num_Tys >, Num_Tys > first {}
std::array< bool, Num_Tys > used {}
 The non-terminals of the backend: Reg, Lit, and those its conversions mention.

Detailed Description

The cheapest chains of conversions between two non-terminals: their costs and each one's first conversion.

Definition at line 163 of file rule_table.h.

Constructor & Destructor Documentation

◆ Chains()

mim::plug::mach::rules::Chains::Chains ( const auto & conversions)
inlineconstexpr

The closure of conversions, a range of Conversion-like rules with from, to, and cost.

Definition at line 170 of file rule_table.h.

References mim::plug::mach::rules::add(), cost, first, mim::plug::mach::rules::Inf, mim::plug::mach::rules::Num_Tys, and used.

Member Function Documentation

◆ conv()

u32 mim::plug::mach::rules::Chains::conv ( Ty from,
Want want ) const
inlineconstexpr

Cost of converting a replacement or operand of non-terminal from into a hole of type want.

Definition at line 197 of file rule_table.h.

References mim::plug::mach::rules::Inf, mim::plug::mach::rules::is_literal(), and target().

Referenced by reachable(), and total().

◆ reachable()

bool mim::plug::mach::rules::Chains::reachable ( Want w) const
inlineconstexpr

Does some non-terminal of the register class of a rule convert into a hole of type w?

Definition at line 211 of file rule_table.h.

References conv(), mim::plug::mach::rules::Inf, mim::plug::mach::rules::Num_Tys, and mim::plug::mach::rules::same_class().

◆ target()

std::pair< Ty, u32 > mim::plug::mach::rules::Chains::target ( Ty from,
Want want ) const
inlineconstexpr

The non-terminal that from converts to most cheaply for a hole of type want, and the cost.

Definition at line 189 of file rule_table.h.

References cost, mim::plug::mach::rules::fills(), mim::plug::mach::rules::Inf, and mim::plug::mach::rules::Num_Tys.

Referenced by conv().

◆ total()

bool mim::plug::mach::rules::Chains::total ( Want w) const
inlineconstexpr

Does every non-terminal of w's register class convert into a hole of type w, as an atomic rule's holes must?

Definition at line 204 of file rule_table.h.

References conv(), mim::plug::mach::rules::Inf, mim::plug::mach::rules::Num_Tys, mim::plug::mach::rules::same_class(), and used.

Member Data Documentation

◆ cost

std::array<std::array<u32, Num_Tys>, Num_Tys> mim::plug::mach::rules::Chains::cost {}

Definition at line 164 of file rule_table.h.

Referenced by Chains(), and target().

◆ first

std::array<std::array<u32, Num_Tys>, Num_Tys> mim::plug::mach::rules::Chains::first {}

Definition at line 165 of file rule_table.h.

Referenced by Chains().

◆ used

std::array<bool, Num_Tys> mim::plug::mach::rules::Chains::used {}

The non-terminals of the backend: Reg, Lit, and those its conversions mention.

Definition at line 167 of file rule_table.h.

Referenced by Chains(), and total().


The documentation for this struct was generated from the following file: