Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===-- GuardUtils.h - Utils for work with guards ---------------*- C++ -*-===// |
2 | // |
||
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
||
4 | // See https://llvm.org/LICENSE.txt for license information. |
||
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
||
6 | // |
||
7 | //===----------------------------------------------------------------------===// |
||
8 | // Utils that are used to perform transformations related to guards and their |
||
9 | // conditions. |
||
10 | //===----------------------------------------------------------------------===// |
||
11 | |||
12 | #ifndef LLVM_TRANSFORMS_UTILS_GUARDUTILS_H |
||
13 | #define LLVM_TRANSFORMS_UTILS_GUARDUTILS_H |
||
14 | |||
15 | namespace llvm { |
||
16 | |||
17 | class BranchInst; |
||
18 | class CallInst; |
||
19 | class Function; |
||
20 | class Value; |
||
21 | |||
22 | /// Splits control flow at point of \p Guard, replacing it with explicit branch |
||
23 | /// by the condition of guard's first argument. The taken branch then goes to |
||
24 | /// the block that contains \p Guard's successors, and the non-taken branch |
||
25 | /// goes to a newly-created deopt block that contains a sole call of the |
||
26 | /// deoptimize function \p DeoptIntrinsic. If 'UseWC' is set, preserve the |
||
27 | /// widenable nature of the guard by lowering to equivelent form. If not set, |
||
28 | /// lower to a form without widenable semantics. |
||
29 | void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard, |
||
30 | bool UseWC); |
||
31 | |||
32 | /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h), |
||
33 | /// widen it such that condition 'NewCond' is also known to hold on the taken |
||
34 | /// path. Branch remains widenable after transform. |
||
35 | void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond); |
||
36 | |||
37 | /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h), |
||
38 | /// *set* it's condition such that (only) 'Cond' is known to hold on the taken |
||
39 | /// path and that the branch remains widenable after transform. |
||
40 | void setWidenableBranchCond(BranchInst *WidenableBR, Value *Cond); |
||
41 | |||
42 | } // llvm |
||
43 | |||
44 | #endif // LLVM_TRANSFORMS_UTILS_GUARDUTILS_H |