LLVM 23.0.0git
CFGuard.h
Go to the documentation of this file.
1//===-- CFGuard.h - CFGuard Transformations ---------------------*- 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// Windows Control Flow Guard passes (/guard:cf).
9//===---------------------------------------------------------------------===//
10
11#ifndef LLVM_TRANSFORMS_CFGUARD_H
12#define LLVM_TRANSFORMS_CFGUARD_H
13
14#include "llvm/IR/PassManager.h"
16
17namespace llvm {
18
19class CallBase;
20class FunctionPass;
21class GlobalValue;
22
23class CFGuardPass : public PassInfoMixin<CFGuardPass> {
24public:
25 enum class Mechanism { Check, Dispatch };
26
27 CFGuardPass(Mechanism M = Mechanism::Check) : GuardMechanism(M) {}
29
30private:
31 Mechanism GuardMechanism;
32};
33
34/// Insert Control FLow Guard checks on indirect function calls.
35LLVM_ABI FunctionPass *createCFGuardCheckPass();
36
37/// Insert Control FLow Guard dispatches on indirect function calls.
39
40LLVM_ABI bool isCFGuardCall(const CallBase *CB);
41LLVM_ABI bool isCFGuardFunction(const GlobalValue *GV);
42
43} // namespace llvm
44
45#endif
#define LLVM_ABI
Definition Compiler.h:213
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:54
FunctionAnalysisManager FAM
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Definition CFGuard.cpp:296
CFGuardPass(Mechanism M=Mechanism::Check)
Definition CFGuard.h:27
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
LLVM_ABI bool isCFGuardCall(const CallBase *CB)
Definition CFGuard.cpp:314
LLVM_ABI bool isCFGuardFunction(const GlobalValue *GV)
Definition CFGuard.cpp:319
LLVM_ABI FunctionPass * createCFGuardDispatchPass()
Insert Control FLow Guard dispatches on indirect function calls.
Definition CFGuard.cpp:310
LLVM_ABI FunctionPass * createCFGuardCheckPass()
Insert Control FLow Guard checks on indirect function calls.
Definition CFGuard.cpp:306
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition PassManager.h:70