23#define DEBUG_TYPE "riscv-lpad-setup"
24#define PASS_NAME "RISC-V Landing Pad Setup"
50 const RISCVInstrInfo &
TII = *STI.getInstrInfo();
52 if (!MF.
getInfo<RISCVMachineFunctionInfo>()->hasCFProtectionBranch())
68 for (MachineBasicBlock &
MBB : MF)
70 if (
MI.getOpcode() != RISCV::PseudoBRIND &&
71 MI.getOpcode() != RISCV::PseudoCALLIndirect &&
72 MI.getOpcode() != RISCV::PseudoTAILIndirect)
76 MachineInstrBuilder(MF, &
MI).
addUse(RISCV::X7, RegState::ImplicitKill);
85char RISCVLandingPadSetup::
ID = 0;
88 return new RISCVLandingPadSetup();
const HexagonInstrInfo * TII
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
cl::opt< uint32_t > PreferredLandingPadLabel("riscv-landing-pad-label", cl::ReallyHidden, cl::desc("Use preferred fixed label for all labels"))
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass class - This class is used to implement most global optimizations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineInstrBuilder & addUse(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a virtual register use operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
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.
FunctionPass * createRISCVLandingPadSetupPass()
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.