28 cl::desc(
"Use preferred fixed label for all labels"));
36 return "RISC-V Indirect Branch Tracking";
48char RISCVIndirectBranchTrackingPass::ID = 0;
51 return new RISCVIndirectBranchTrackingPass();
61bool RISCVIndirectBranchTrackingPass::runOnMachineFunction(
65 if (!Subtarget.hasStdExtZicfilp())
81 if (
F.hasFnAttribute(
"interrupt"))
84 if (
F.hasAddressTaken() || !
F.hasLocalLinkage()) {
86 if (MF.getAlignment() < LpadAlign)
87 MF.setAlignment(LpadAlign);
const HexagonInstrInfo * TII
static void emitLpad(MachineBasicBlock &MBB, const RISCVInstrInfo *TII, uint32_t Label)
cl::opt< uint32_t > PreferredLandingPadLabel("riscv-landing-pad-label", cl::ReallyHidden, cl::desc("Use preferred fixed label for all labels"))
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
FunctionPass class - This class is used to implement most global optimizations.
bool hasAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
void setAlignment(Align A)
Set alignment of the basic block.
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
Align getAlignment() const
Return alignment of the basic block.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
FunctionPass * createRISCVIndirectBranchTrackingPass()
This struct is a compact representation of a valid (non-zero power of two) alignment.