9static_assert(
sizeof(
void*) <=
sizeof(
u64),
"pointer doesn't fit into Lit");
14Ref do_reify(
const Def* def) {
15 auto& world = def->world();
16 return world.lit(world.call<
Code>(def->type()),
reinterpret_cast<u64>(def));
20const Def* do_reflect(
const Def* def) {
return reinterpret_cast<const Def*
>(def->as<
Lit>()->get()); }
22void debug_print(Ref lvl, Ref def) {
23 auto& world = def->world();
27 world.log().log(level, __FILE__, __LINE__,
"{}debug_print: {}{}", rang::fg::yellow, def, rang::fg::reset);
28 world.log().log(level, def->loc(),
"def : {}", def);
29 world.log().log(level, def->loc(),
"id : {}", def->unique_name());
30 world.log().log(level, def->type()->loc(),
"type: {}", def->type());
31 world.log().log(level, def->loc(),
"node: {}", def->node_name());
32 world.log().log(level, def->loc(),
"ops : {}", def->num_ops());
33 world.log().log(level, def->loc(),
"proj: {}", def->num_projs());
34 world.log().log(level, def->loc(),
"eops: {}", def->num_extended_ops());
40 auto& world = arg->
world();
41 auto [lvl, x] = arg->
projs<2>();
43 return id ==
dbg::perm ? world.raw_app(type, callee, arg) :
Ref(x);
51 auto& world = arg->
world();
52 auto [code, i, x] = arg->
projs<3>();
54 auto def = do_reflect(code);
55 return do_reify(def->refine(*l, do_reflect(x)));
58 return world.raw_app(type, callee, arg);
auto projs(F f) const
Splits this Def via Def::projections into an Array (if A == -1_n) or std::array (otherwise).
static std::optional< T > isa(Ref def)
Helper class to retrieve Infer::arg if present.
const Lit * lit_nat(nat_t a)
Ref normalize_gid(Ref, Ref, Ref arg)
Ref normalize_refine(Ref type, Ref callee, Ref arg)
Ref normalize_dbg(Ref type, Ref callee, Ref arg)
Ref normalize_reflect(Ref, Ref, Ref arg)
Ref normalize_reify(Ref, Ref, Ref arg)
#define MIM_refly_NORMALIZER_IMPL