Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:43

0001 //===-- GuardUtils.h - Utils for work with guards ---------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 // Utils that are used to perform transformations related to guards and their
0009 // conditions.
0010 //===----------------------------------------------------------------------===//
0011 
0012 #ifndef LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
0013 #define LLVM_TRANSFORMS_UTILS_GUARDUTILS_H
0014 
0015 namespace llvm {
0016 
0017 class BranchInst;
0018 class CallInst;
0019 class Function;
0020 class Value;
0021 
0022 /// Splits control flow at point of \p Guard, replacing it with explicit branch
0023 /// by the condition of guard's first argument. The taken branch then goes to
0024 /// the block that contains  \p Guard's successors, and the non-taken branch
0025 /// goes to a newly-created deopt block that contains a sole call of the
0026 /// deoptimize function \p DeoptIntrinsic.  If 'UseWC' is set, preserve the
0027 /// widenable nature of the guard by lowering to equivelent form.  If not set,
0028 /// lower to a form without widenable semantics.
0029 void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard,
0030                                   bool UseWC);
0031 
0032 /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
0033 /// widen it such that condition 'NewCond' is also known to hold on the taken
0034 /// path.  Branch remains widenable after transform.
0035 void widenWidenableBranch(BranchInst *WidenableBR, Value *NewCond);
0036 
0037 /// Given a branch we know is widenable (defined per Analysis/GuardUtils.h),
0038 /// *set* it's condition such that (only) 'Cond' is known to hold on the taken
0039 /// path and that the branch remains widenable after transform.
0040 void setWidenableBranchCond(BranchInst *WidenableBR, Value *Cond);
0041 
0042 } // llvm
0043 
0044 #endif // LLVM_TRANSFORMS_UTILS_GUARDUTILS_H