44#define PASS_KEY "x86-return-thunks"
45#define DEBUG_TYPE PASS_KEY
58char X86ReturnThunksLegacy::ID = 0;
68 StringRef ThunkName =
"__x86_return_thunk";
73 const bool Is64Bit = ST.getTargetTriple().isX86_64();
74 const unsigned RetOpc = Is64Bit ? X86::RET64 : X86::RET32;
79 if (Term.getOpcode() == RetOpc)
84 const MCInstrDesc &CS = ST.getInstrInfo()->get(X86::CS_PREFIX);
85 const MCInstrDesc &JMP = ST.getInstrInfo()->get(X86::TAILJMPd);
89 BuildMI(Ret->getParent(), Ret->getDebugLoc(), CS);
90 BuildMI(Ret->getParent(), Ret->getDebugLoc(), JMP)
115 return new X86ReturnThunksLegacy();
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
constexpr StringRef X86ReturnThunksPassName
static bool runX86ReturnThunks(MachineFunction &MF)
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Module * getParent()
Get the module that this global value is contained inside of...
Describe properties that are true of each instruction in the target description file.
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.
Function & getFunction()
Return the LLVM function that this machine code represents.
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned TargetFlags=0) const
Representation of each machine instruction.
LLVM_ABI void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
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
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createX86ReturnThunksLegacyPass()