LLVM 22.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"
15
16namespace llvm {
17
18class FunctionPass;
19class GlobalValue;
20
21class CFGuardPass : public PassInfoMixin<CFGuardPass> {
22public:
23 enum class Mechanism { Check, Dispatch };
24
25 CFGuardPass(Mechanism M = Mechanism::Check) : GuardMechanism(M) {}
27
28private:
29 Mechanism GuardMechanism;
30};
31
32/// Insert Control FLow Guard checks on indirect function calls.
33FunctionPass *createCFGuardCheckPass();
34
35/// Insert Control FLow Guard dispatches on indirect function calls.
36FunctionPass *createCFGuardDispatchPass();
37
38bool isCFGuardFunction(const GlobalValue *GV);
39
40} // namespace llvm
41
42#endif
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition MD5.cpp:55
FunctionAnalysisManager FAM
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Definition CFGuard.cpp:307
CFGuardPass(Mechanism M=Mechanism::Check)
Definition CFGuard.h:25
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.
bool isCFGuardFunction(const GlobalValue *GV)
Definition CFGuard.cpp:325
FunctionPass * createCFGuardDispatchPass()
Insert Control FLow Guard dispatches on indirect function calls.
Definition CFGuard.cpp:321
FunctionPass * createCFGuardCheckPass()
Insert Control FLow Guard checks on indirect function calls.
Definition CFGuard.cpp:317
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