43#define AVOIDCALL_DESC "X86 avoid trailing call pass"
44#define AVOIDCALL_NAME "x86-avoid-trailing-call"
46#define DEBUG_TYPE AVOIDCALL_NAME
64char X86AvoidTrailingCallLegacyPass::ID = 0;
67 return new X86AvoidTrailingCallLegacyPass();
77 return MI.isCall() || (!
MI.isPseudo() && !
MI.isMetaInstruction());
82 return MI.isCall() && !
MI.isReturn();
113 bool IsEmpty = LastRealInstr ==
MBB.rend();
115 if (IsEmpty || IsCall) {
118 dbgs() <<
"inserting int3 after trailing call instruction:\n";
119 LastRealInstr->dump();
122 dbgs() <<
"inserting int3 in trailing empty MBB:\n";
130 MBBI = std::next(LastRealInstr.getReverse());
131 DL = LastRealInstr->getDebugLoc();
141bool X86AvoidTrailingCallLegacyPass::runOnMachineFunction(
MachineFunction &MF) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
const HexagonInstrInfo * TII
This header defines various interfaces for pass management in LLVM.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
bool UpdatedOnX86AvoidTrailingCallPass(MachineFunction &MF)
static bool isCallInstruction(const MachineInstr &MI)
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
bool isEHFuncletEntry() const
Returns true if this is the entry block of an EH funclet.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
StringRef - Represent a constant reference to a string, i.e.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
bool isTargetWin64() const
const X86InstrInfo * getInstrInfo() const override
Pass manager infrastructure for declaring and invalidating analyses.
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.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
auto reverse(ContainerTy &&C)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
FunctionPass * createX86AvoidTrailingCallLegacyPass()