llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
undef_elim.h
1 // This file if part of the llir-opt project.
2 // Licensing information can be found in the LICENSE file.
3 // (C) 2018 Nandor Licker. All rights reserved.
4 
5 #pragma once
6 
7 #include "core/pass.h"
8 #include "core/insts.h"
9 #include "core/inst_visitor.h"
10 
11 class Func;
12 
13 
14 
22 class UndefElimPass final : public Pass, InstVisitor<bool> {
23 public:
25  static const char *kPassID;
26 
28  UndefElimPass(PassManager *passManager) : Pass(passManager) {}
29 
31  bool Run(Prog &prog) override;
32 
34  const char *GetPassName() const override;
35 
36 private:
38  bool VisitJumpCondInst(JumpCondInst &i) override;
40  bool VisitSwitchInst(SwitchInst &i) override;
42  bool VisitSelectInst(SelectInst &i) override;
44  bool VisitStoreInst(StoreInst &i) override;
46  bool VisitInst(Inst &i) override { return false; }
47 };
Inst
Definition: inst.h:53
Func
Definition: func.h:30
PassManager
Definition: pass_manager.h:74
Pass
Definition: pass.h:17
UndefElimPass
Definition: undef_elim.h:22
UndefElimPass::UndefElimPass
UndefElimPass(PassManager *passManager)
Initialises the pass.
Definition: undef_elim.h:28
UndefElimPass::Run
bool Run(Prog &prog) override
Runs the pass.
Definition: undef_elim.cpp:26
UndefElimPass::kPassID
static const char * kPassID
Pass identifier.
Definition: undef_elim.h:25
UndefElimPass::GetPassName
const char * GetPassName() const override
Returns the name of the pass.
Definition: undef_elim.cpp:20
Prog
Definition: prog.h:33
InstVisitor
Definition: inst_visitor.h:15