/src/hermes/include/hermes/BCGen/HBC/Passes/InsertProfilePoint.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | | * |
4 | | * This source code is licensed under the MIT license found in the |
5 | | * LICENSE file in the root directory of this source tree. |
6 | | */ |
7 | | |
8 | | #ifndef HERMES_BCGEN_HBC_PASSES_INSERTPROFILEPOINT_H |
9 | | #define HERMES_BCGEN_HBC_PASSES_INSERTPROFILEPOINT_H |
10 | | |
11 | | #include "hermes/IR/Instrs.h" |
12 | | #include "hermes/Optimizer/PassManager/Pass.h" |
13 | | #include "llvh/Support/Casting.h" |
14 | | |
15 | | namespace hermes { |
16 | | class Instruction; |
17 | | class BasicBlock; |
18 | | |
19 | | namespace hbc { |
20 | | |
21 | | /// Insert profile point at the beginning of each basic block. |
22 | | class InsertProfilePoint : public FunctionPass { |
23 | | private: |
24 | | /// \returns the instruction in basic block \p BB which profile instruction |
25 | | /// will insert before. It needs to skip over certain instructions which |
26 | | /// are expected to be at the beginning of a block. |
27 | | Instruction *findInsertionPoint(BasicBlock &BB) const; |
28 | | |
29 | | public: |
30 | 0 | explicit InsertProfilePoint() : FunctionPass("InsertProfilePoint") {} |
31 | | ~InsertProfilePoint() override = default; |
32 | | bool runOnFunction(Function *F) override; |
33 | | }; |
34 | | |
35 | | } // namespace hbc |
36 | | } // namespace hermes |
37 | | |
38 | | #endif // HERMES_BCGEN_HBC_PASSES_INSERTPROFILEPOINT_H |