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) {}
48 StringRef getPassName()
const override {
return "ResetMachineFunction"; }
50 void getAnalysisUsage(AnalysisUsage &AU)
const override {
55 bool runOnMachineFunction(MachineFunction &MF)
override {
56 ++NumFunctionsVisited;
60 auto ClearVRegTypesOnReturn =
64 if (AbortOnFailedISel)
73 TM.registerMachineRegisterInfoCallback(MF);
75 if (EmitFallbackDiag) {
77 DiagnosticInfoISelFallback DiagFallback(
F);
78 F.getContext().diagnose(DiagFallback);
88char ResetMachineFunction::ID = 0;
90 "Reset machine function if ISel failed",
false,
false)
94 bool AbortOnFailedISel =
false) {
95 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)
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
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.
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 MachineFunctionProperties & getProperties() const
Get the function properties.
void reset()
Reset the instance as if it was just created.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
LLVM_ABI void clearVirtRegTypes()
Remove all types associated to virtual registers (after instruction selection and constraining of all...
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)
LLVM_ABI MachineFunctionPass * createResetMachineFunctionPass(bool EmitFallbackDiag, bool AbortOnFailedISel)
This pass resets a MachineFunction when it has the FailedISel property as if it was just created.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)