Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
tail_rec_elim.h
Go to the documentation of this file.
1#pragma once
2
3#include "thorin/pass/pass.h"
4
5namespace thorin {
6
7class EtaRed;
8
9class TailRecElim : public FPPass<TailRecElim, Lam> {
10public:
11 TailRecElim(PassMan& man, EtaRed* eta_red = nullptr)
12 : FPPass(man, "tail_rec_elim")
13 , eta_red_(eta_red) {}
14
15private:
16 /// @name PassMan hooks
17 ///@{
18 Ref rewrite(Ref) override;
19 undo_t analyze(Ref) override;
20 ///@}
21
22 EtaRed* eta_red_;
23 LamMap<std::pair<Lam*, Lam*>> old2rec_loop_;
24 Lam2Lam rec2loop_;
25};
26
27} // namespace thorin
Performs η-reduction.
Definition eta_red.h:9
Inherit from this class using CRTP, if you do need a Pass with a state and a fixed-point.
Definition pass.h:242
An optimizer that combines several optimizations in an optimal way.
Definition pass.h:107
PassMan & man()
Definition pass.h:30
Helper class to retrieve Infer::arg if present.
Definition def.h:85
undo_t analyze(Ref) override
Ref rewrite(Ref) override
TailRecElim(PassMan &man, EtaRed *eta_red=nullptr)
Definition cfg.h:11
LamMap< Lam * > Lam2Lam
Definition lam.h:191
size_t undo_t
Definition pass.h:14
GIDMap< Lam *, To > LamMap
Definition lam.h:189