23#define DEBUG_TYPE "riscv-lpad-setup"
24#define PASS_NAME "RISC-V Landing Pad Setup"
48 const RISCVInstrInfo &
TII = *STI.getInstrInfo();
50 if (!MF.
getInfo<RISCVMachineFunctionInfo>()->hasCFProtectionBranch())
54 if (std::optional<uint32_t> Preferred = STI.getCLOpts().landing_pad_label) {
66 for (MachineBasicBlock &
MBB : MF)
68 if (
MI.getOpcode() != RISCV::PseudoBRIND &&
69 MI.getOpcode() != RISCV::PseudoCALLIndirect &&
70 MI.getOpcode() != RISCV::PseudoTAILIndirect)
74 MachineInstrBuilder(MF, &
MI).
addUse(RISCV::X7, RegState::ImplicitKill);
83char RISCVLandingPadSetup::ID = 0;
86 return new RISCVLandingPadSetup();
const HexagonInstrInfo * TII
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
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.
Represent a constant reference to a string, i.e.
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.