Go to the documentation of this file.
28 #define DEBUG_TYPE "cfguard-longjmp"
31 "Number of Control Flow Guard longjmp targets");
46 return "Control Flow Guard longjmp targets";
57 "Insert symbols at valid longjmp targets for /guard:cf",
false,
79 if (!
MI.isCall() ||
MI.getNumOperands() < 1)
87 auto *
F = dyn_cast<Function>(MO.getGlobal());
93 if (
F->hasFnAttribute(Attribute::ReturnsTwice)) {
94 SetjmpCalls.push_back(&
MI);
101 if (SetjmpCalls.empty())
104 unsigned SetjmpNum = 0;
114 Setjmp->setPostInstrSymbol(MF, SjSymbol);
115 MF.addLongjmpTarget(SjSymbol);
116 CFGuardLongjmpTargets++;
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
INITIALIZE_PASS(CFGuardLongjmp, "CFGuardLongjmp", "Insert symbols at valid longjmp targets for /guard:cf", false, false) FunctionPass *llvm
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
MachineOperand class - Representation of each machine instruction operand.
STATISTIC(NumFunctions, "Total number of functions")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
MachineModuleInfo & getMMI() const
Representation of each machine instruction.
StringRef - Represent a constant reference to a string, i.e.
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
Function & getFunction()
Return the LLVM function that this machine code represents.
A raw_ostream that writes to an SmallVector or SmallString.
FunctionPass class - This class is used to implement most global optimizations.
const Module * getModule() const
FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
void initializeCFGuardLongjmpPass(PassRegistry &)