Go to the documentation of this file.
41 #define AVOIDCALL_DESC "X86 avoid trailing call pass"
42 #define AVOIDCALL_NAME "x86-avoid-trailing-call"
44 #define DEBUG_TYPE AVOIDCALL_NAME
65 return new X86AvoidTrailingCallPass();
74 return MI.isCall() || (!
MI.isPseudo() && !
MI.isMetaInstruction());
79 return MI.isCall() && !
MI.isReturn();
82 bool X86AvoidTrailingCallPass::runOnMachineFunction(
MachineFunction &MF) {
110 bool IsEmpty = LastRealInstr ==
MBB.
rend();
112 if (IsEmpty || IsCall) {
115 dbgs() <<
"inserting int3 after trailing call instruction:\n";
116 LastRealInstr->dump();
119 dbgs() <<
"inserting int3 in trailing empty MBB:\n";
127 MBBI = std::next(LastRealInstr.getReverse());
128 DL = LastRealInstr->getDebugLoc();
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createX86AvoidTrailingCallPass()
Return a pass that inserts int3 at the end of the function if it ends with a CALL instruction.
const X86InstrInfo * getInstrInfo() const override
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
static bool isCallInstruction(const MachineInstr &MI)
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
bool isTargetWin64() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
const HexagonInstrInfo * TII
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
MachineBasicBlock MachineBasicBlock::iterator MBBI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static bool isCallOrRealInstruction(MachineInstr &MI)
FunctionPass class - This class is used to implement most global optimizations.