llvm/llvm/lib/Transforms/CFGuard/CFGuard.cpp

//===-- CFGuard.cpp - Control Flow Guard checks -----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains the IR transform to add Microsoft's Control Flow Guard
/// checks on Windows targets.
///
//===----------------------------------------------------------------------===//

#include "llvm/Transforms/CFGuard.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/TargetParser/Triple.h"

usingnamespacellvm;

OperandBundleDef;

#define DEBUG_TYPE

STATISTIC(CFGuardCounter, "Number of Control Flow Guard checks added");

namespace {

/// Adds Control Flow Guard (CFG) checks on indirect function calls/invokes.
/// These checks ensure that the target address corresponds to the start of an
/// address-taken function. X86_64 targets use the Mechanism::Dispatch
/// mechanism. X86, ARM, and AArch64 targets use the Mechanism::Check machanism.
class CFGuardImpl {};

class CFGuard : public FunctionPass {};

} // end anonymous namespace

void CFGuardImpl::insertCFGuardCheck(CallBase *CB) {}

void CFGuardImpl::insertCFGuardDispatch(CallBase *CB) {}

bool CFGuardImpl::doInitialization(Module &M) {}

bool CFGuardImpl::runOnFunction(Function &F) {}

PreservedAnalyses CFGuardPass::run(Function &F, FunctionAnalysisManager &FAM) {}

char CFGuard::ID =;
INITIALIZE_PASS()

FunctionPass *llvm::createCFGuardCheckPass() {}

FunctionPass *llvm::createCFGuardDispatchPass() {}