29#define DEBUG_TYPE "reset-machine-function"
31STATISTIC(NumFunctionsReset,
"Number of functions reset");
32STATISTIC(NumFunctionsVisited,
"Number of functions visited");
35 bool AbortOnFailedISel) {
36 ++NumFunctionsVisited;
46 if (AbortOnFailedISel)
67 if (EmitFallbackDiag) {
70 F.getContext().diagnose(DiagFallback);
79 bool EmitFallbackDiag;
81 bool AbortOnFailedISel;
85 ResetMachineFunctionLegacy(
bool EmitFallbackDiag =
false,
86 bool AbortOnFailedISel =
false)
87 : MachineFunctionPass(ID), EmitFallbackDiag(EmitFallbackDiag),
88 AbortOnFailedISel(AbortOnFailedISel) {}
90 StringRef getPassName()
const override {
return "ResetMachineFunction"; }
92 void getAnalysisUsage(AnalysisUsage &AU)
const override {
98 return runImpl(MF, EmitFallbackDiag, AbortOnFailedISel);
103char ResetMachineFunctionLegacy::ID = 0;
105 "Reset machine function if ISel failed",
false,
false)
109 bool AbortOnFailedISel =
false) {
110 return new ResetMachineFunctionLegacy(EmitFallbackDiag, AbortOnFailedISel);
116 if (
runImpl(MF, EmitFallbackDiag, AbortOnFailedISel))
static bool runImpl(MachineFunction &MF)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool runImpl(MachineFunction &MF, bool EmitFallbackDiag, bool AbortOnFailedISel)
This file contains the declaration of the ResetMachineFunctionPass class.
This file defines the scope_exit class, which executes user-defined cleanup logic at scope exit.
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.
Diagnostic information for ISel fallback path.
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.
MachineFunctionProperties & resetToInitial()
Reset all properties and re-establish baseline invariants.
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...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &)
Primary interface to the complete machine description for the target machine.
virtual void registerMachineRegisterInfoCallback(MachineFunction &MF) const
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI MachineFunctionPass * createResetMachineFunctionLegacyPass(bool EmitFallbackDiag, bool AbortOnFailedISel)
This pass resets a MachineFunction when it has the FailedISel property as if it was just created.
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.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)