27 cl::desc(
"Use preferred fixed label for all labels"));
35 return "RISC-V Indirect Branch Tracking";
47char RISCVIndirectBranchTrackingPass::ID = 0;
50 return new RISCVIndirectBranchTrackingPass();
60bool RISCVIndirectBranchTrackingPass::runOnMachineFunction(
64 if (!Subtarget.hasStdExtZicfilp())
80 if (
F.hasFnAttribute(
"interrupt"))
83 if (
F.hasAddressTaken() || !
F.hasLocalLinkage()) {
85 if (MF.getAlignment() < LpadAlign)
86 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.