llir-opt  0.0.1
Low-Level Post-Link Optimiser for OCaml and C
bypass_phi.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/ref.h"
9 
10 class Block;
11 class Func;
12 class JumpCondInst;
13 class CmpInst;
14 
15 
16 
20 class BypassPhiPass final : public Pass {
21 public:
23  static const char *kPassID;
24 
26  BypassPhiPass(PassManager *passManager) : Pass(passManager) {}
27 
29  bool Run(Prog &prog) override;
30 
32  const char *GetPassName() const override;
33 
34 private:
36  bool BypassPhiCmp(Block &block);
38  bool Bypass(
39  JumpCondInst &jcc,
40  CmpInst &cmp,
41  Ref<Inst> phiCandidate,
42  Ref<Inst> reference,
43  Block &block
44  );
45 };
Func
Definition: func.h:30
PassManager
Definition: pass_manager.h:74
Pass
Definition: pass.h:17
BypassPhiPass::BypassPhiPass
BypassPhiPass(PassManager *passManager)
Initialises the pass.
Definition: bypass_phi.h:26
BypassPhiPass
Definition: bypass_phi.h:20
BypassPhiPass::Run
bool Run(Prog &prog) override
Runs the pass.
Definition: bypass_phi.cpp:30
BypassPhiPass::kPassID
static const char * kPassID
Pass identifier.
Definition: bypass_phi.h:23
Prog
Definition: prog.h:33
Ref
Definition: ref.h:63
Block
Definition: block.h:29
BypassPhiPass::GetPassName
const char * GetPassName() const override
Returns the name of the pass.
Definition: bypass_phi.cpp:53