21using VMode = std::variant<Mode, nat_t, const Def*>;
25 if (
auto def = std::get_if<const Def*>(&m))
return *def;
26 if (
auto nat = std::get_if<nat_t>(&m))
return w.lit_nat(*
nat);
27 return w.lit_nat((
nat_t)std::get<Mode>(m));
35 return w.app(w.annex(o), type);
43 return w.app(w.app(w.annex(o), def->
type()), def);
61 World& w = d->world();
62 return w.extract(d, w.call(
conv::u, d->unfold_type()->arity(), i));
65 World& w = d->world();
73 World& w = d->world();
74 return w.insert(d, w.call(
conv::u, d->unfold_type()->arity(), i), val);
77 World& w = d->world();
103 auto tab = make_truth_table(
id);
104 return tab[0][1] == tab[1][0];
117 default:
return false;
132template<>
struct 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)
@ nuw
No Unsigned Wrap around.
@ nsw
No Signed Wrap around.
constexpr bool is_commutative(Id)
constexpr bool is_associative(Id id)