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)
93 if (
F->hasFnAttribute(Attribute::ReturnsTwice)) {
101 if (SetjmpCalls.
empty())
104 unsigned SetjmpNum = 0;
112 MCSymbol *SjSymbol = MF.getContext().getOrCreateSymbol(SymbolName);
114 Setjmp->setPostInstrSymbol(MF, SjSymbol);
115 MF.addLongjmpTarget(SjSymbol);
116 CFGuardLongjmpTargets++;
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void push_back(const T &Elt)
void initializeCFGuardLongjmpPass(PassRegistry &)
A raw_ostream that writes to an SmallVector or SmallString.
STATISTIC(NumFunctions, "Total number of functions")
MachineModuleInfo & getMMI() const
FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
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.
FunctionPass class - This class is used to implement most global optimizations.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
INITIALIZE_PASS(CFGuardLongjmp, "CFGuardLongjmp", "Insert symbols at valid longjmp targets for /guard:cf", false, false) FunctionPass *llvm
LLVM_NODISCARD bool empty() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const Module * getModule() const
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
StringRef - Represent a constant reference to a string, i.e.