#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
usingnamespacellvm;
#define DEBUG_TYPE …
#define KCFI_PASS_NAME …
STATISTIC(NumKCFIChecksAdded, "Number of indirect call checks added");
namespace {
class KCFI : public MachineFunctionPass { … };
char KCFI::ID = …;
}
INITIALIZE_PASS(…)
FunctionPass *llvm::createKCFIPass() { … }
bool KCFI::emitCheck(MachineBasicBlock &MBB,
MachineBasicBlock::instr_iterator MBBI) const { … }
bool KCFI::runOnMachineFunction(MachineFunction &MF) { … }