23using VMode = std::variant<Mode, nat_t, const Def*>;
27 if (
auto def = std::get_if<const Def*>(&m))
return *def;
28 if (
auto nat = std::get_if<nat_t>(&m))
return w.lit_nat(*
nat);
29 return w.lit_nat(std::to_underlying(std::get<Mode>(m)));
36 World& w = type->world();
37 return w.app(w.annex(o), type);
45 return w.app(w.app(w.annex(o), def->
type()), def);
63 World& w = d->world();
64 return w.extract(d, w.call(
conv::u, d->unfold_type()->arity(), i));
67 World& w = d->world();
75 World& w = d->world();
76 return w.insert(d, w.call(
conv::u, d->unfold_type()->arity(), i), val);
79 World& w = d->world();
106 auto tab = make_truth_table(
id);
107 return tab[0][1] == tab[1][0];
120 default:
return false;
136struct fe::is_bit_enum<
mim::plug::core::Mode> : std::true_type {};
World & world() const noexcept
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
Specific Bound depending on Up.
The World represents the whole program and manages creation of MimIR nodes (Defs).
const Def * extract_unsafe(const Def *d, const Def *i)
const Sigma * convert(const TBound< up > *b)
std::variant< Mode, nat_t, const Def * > VMode
Give Mode as mim::plug::math::Mode, mim::nat_t or const Def*.
const Def * op(trait o, const Def *type)
constexpr std::array< std::array< u64, 2 >, 2 > make_truth_table(bit2 id)
const Def * insert_unsafe(const Def *d, const Def *i, const Def *val)
constexpr flags_t icmp_mask
@ nuw
No Unsigned Wrap around.
@ nsw
No Signed Wrap around.
TBound< true > Join
AKA union.
constexpr bool is_commutative(Id)
constexpr bool is_associative(Id id)
TBound< false > Meet
AKA intersection.