18absl::flat_hash_map<flags_t, flags_t> axm_to_impl_map = {
25std::optional<const Def*> internal_function_of_axm(
const Axm* axm,
const Def* meta_args,
const Def* args) {
26 auto& world = axm->world();
27 if (
auto it = axm_to_impl_map.find(axm->flags()); it != axm_to_impl_map.end()) {
28 const Def* spec_fun = world.implicit_app(world.flags2annex().at(it->second), meta_args);
30 return world.app(ds_fun, args);
38 if (
auto i = rewritten.find(def); i != rewritten.end())
return i->second;
40 rewritten[def] = new_def;
41 return rewritten[def];
46 auto [
mem,
M, N] = mat_ax->args<3>();
47 auto [m, k, l, w] = mat_ax->decurry()->args<4>();
51 if (ext_fun && (w_lit && *w_lit == 64)) {
53 auto fun_app =
world().
app(ds_fun, {
mem, m, k, l,
M, N});
58 if (
auto outer_app = def->isa<
App>()) {
59 if (
auto inner_app = outer_app->callee()->isa<
App>()) {
60 if (
auto axm = inner_app->callee()->isa<
Axm>()) {
61 if (
auto internal_function = internal_function_of_axm(axm, inner_app->arg(), outer_app->arg())) {
62 DLOG(
"lower matrix axm {} in {} : {}", *axm->sym(), def, def->
type());
63 DLOG(
"lower matrix axm using: {} : {}", *internal_function, (*internal_function)->type());
64 return *internal_function;
static auto isa(const Def *def)
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
static std::optional< T > isa(const Def *def)
const Def * app(const Def *callee, const Def *arg)
Sym sym(std::string_view)
const Externals & externals() const
const Def * rewrite(const Def *) override
custom rewrite function memoized version of rewrite_
const Def * rewrite_(const Def *)
#define DLOG(...)
Vaporizes to nothingness in Debug build.
const Def * op_cps2ds_dep(const Def *k)
static constexpr flags_t Base