Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===-- CFGuard.h - CFGuard Transformations ---------------------*- 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 // Windows Control Flow Guard passes (/guard:cf).
0009 //===---------------------------------------------------------------------===//
0010 
0011 #ifndef LLVM_TRANSFORMS_CFGUARD_H
0012 #define LLVM_TRANSFORMS_CFGUARD_H
0013 
0014 #include "llvm/IR/PassManager.h"
0015 
0016 namespace llvm {
0017 
0018 class FunctionPass;
0019 
0020 class CFGuardPass : public PassInfoMixin<CFGuardPass> {
0021 public:
0022   enum class Mechanism { Check, Dispatch };
0023 
0024   CFGuardPass(Mechanism M = Mechanism::Check) : GuardMechanism(M) {}
0025   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
0026 
0027 private:
0028   Mechanism GuardMechanism;
0029 };
0030 
0031 /// Insert Control FLow Guard checks on indirect function calls.
0032 FunctionPass *createCFGuardCheckPass();
0033 
0034 /// Insert Control FLow Guard dispatches on indirect function calls.
0035 FunctionPass *createCFGuardDispatchPass();
0036 
0037 } // namespace llvm
0038 
0039 #endif