14std::optional<const Def*>
15internal_function_of_axm(World& world,
const Axm* axm,
const Def* meta_args,
const Def* args) {
17 static const absl::flat_hash_map<flags_t, flags_t> axm_to_impl = {
23 if (
auto it = axm_to_impl.find(axm->flags()); it != axm_to_impl.end()) {
24 auto spec_fun = world.implicit_app(world.annexes().flags2entry().at(it->second).def, meta_args);
37 auto [m, k, l, width] = mat_ax->decurry()->args<4>();
41 if (ext_fun && (w_lit && *w_lit == 64)) {
42 auto [
mem, M, N] = mat_ax->args<3>([
this](
const Def* def) {
return rewrite(def); });
48 if (
auto inner_app = app->
callee()->isa<
App>()) {
49 if (
auto axm = inner_app->callee()->isa<
Axm>()) {
50 auto new_meta_args =
rewrite(inner_app->arg());
52 if (
auto internal_function = internal_function_of_axm(w, axm, new_meta_args, new_args))
53 return *internal_function;
57 return RWPhase::rewrite_imm_App(app);
const Def * callee() const
static auto isa(const Def *def)
static std::optional< T > isa(const Def *def)
World & new_world()
Create new Defs into this.
bool is_bootstrapping() const
Returns whether we are currently bootstrapping (rewriting annexes).
World & old_world()
Get old Defs from here.
virtual const Def * rewrite(const Def *)
Sym sym(std::string_view)
const Externals & externals() const
const Def * rewrite_imm_App(const App *) final
const Def * op_cps2ds_dep(const Def *k)
static constexpr flags_t Base