28#define DEBUG_TYPE "reset-machine-function"
30STATISTIC(NumFunctionsReset,
"Number of functions reset");
31STATISTIC(NumFunctionsVisited,
"Number of functions visited");
37 bool EmitFallbackDiag;
39 bool AbortOnFailedISel;
43 ResetMachineFunction(
bool EmitFallbackDiag =
false,
44 bool AbortOnFailedISel =
false)
46 AbortOnFailedISel(AbortOnFailedISel) {}
56 ++NumFunctionsVisited;
60 auto ClearVRegTypesOnReturn =
64 MachineFunctionProperties::Property::FailedISel)) {
65 if (AbortOnFailedISel)
74 TM.registerMachineRegisterInfoCallback(MF);
76 if (EmitFallbackDiag) {
79 F.getContext().diagnose(DiagFallback);
89char ResetMachineFunction::ID = 0;
91 "Reset machine function if ISel failed",
false,
false)
95 bool AbortOnFailedISel =
false) {
96 return new ResetMachineFunction(EmitFallbackDiag, AbortOnFailedISel);
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the make_scope_exit function, which executes user-defined cleanup logic at scope ex...
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Represent the analysis usage information of a pass.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
Diagnostic information for ISel fallback path.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
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.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
bool hasProperty(Property P) const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void initTargetMachineFunctionInfo(const TargetSubtargetInfo &STI)
Initialize the target specific MachineFunctionInfo.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineFunctionProperties & getProperties() const
Get the function properties.
void reset()
Reset the instance as if it was just created.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
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.
detail::scope_exit< std::decay_t< Callable > > make_scope_exit(Callable &&F)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MachineFunctionPass * createResetMachineFunctionPass(bool EmitFallbackDiag, bool AbortOnFailedISel)
This pass resets a MachineFunction when it has the FailedISel property as if it was just created.