Go to the documentation of this file.
46 struct MakeGuardsExplicitLegacyPass :
public FunctionPass {
69 auto *GuardDecl =
F.getParent()->getFunction(
71 if (!GuardDecl || GuardDecl->use_empty())
77 GuardIntrinsics.push_back(cast<CallInst>(&
I));
79 if (GuardIntrinsics.empty())
83 F.getParent(), Intrinsic::experimental_deoptimize, {F.getReturnType()});
84 DeoptIntrinsic->setCallingConv(GuardDecl->getCallingConv());
86 for (
auto *Guard : GuardIntrinsics)
98 "Lower the guard intrinsic to explicit control flow form",
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
void makeGuardControlFlowExplicit(Function *DeoptIntrinsic, CallInst *Guard, bool UseWC)
Splits control flow at point of Guard, replacing it with explicit branch by the condition of guard's ...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static bool explicifyGuards(Function &F)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
LLVM Basic Block Representation.
bool isGuard(const User *U)
Returns true iff U has semantics of a guard expressed in a form of call of llvm.experimental....
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static void turnToExplicitForm(CallInst *Guard, Function *DeoptIntrinsic)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
inst_range instructions(Function *F)
INITIALIZE_PASS(MakeGuardsExplicitLegacyPass, "make-guards-explicit", "Lower the guard intrinsic to explicit control flow form", false, false) PreservedAnalyses MakeGuardsExplicitPass
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isWidenableBranch(const User *U)
Returns true iff U is a widenable branch (that is, parseWidenableBranch returns true).
static bool runOnFunction(Function &F, bool PostInlining)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void initializeMakeGuardsExplicitLegacyPassPass(PassRegistry &)
const BasicBlock * getParent() const
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
This class represents a function call, abstracting a target machine's calling convention.