///===- MachineOptimizationRemarkEmitter.h - Opt Diagnostics -*- C++ -*----===// /// /// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. /// See https://llvm.org/LICENSE.txt for license information. /// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception /// ///===---------------------------------------------------------------------===// /// \file /// Optimization diagnostic interfaces for machine passes. It's packaged as an /// analysis pass so that by using this service passes become dependent on MBFI /// as well. MBFI is used to compute the "hotness" of the diagnostic message. /// ///===---------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINEOPTIMIZATIONREMARKEMITTER_H #define LLVM_CODEGEN_MACHINEOPTIMIZATIONREMARKEMITTER_H #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachinePassManager.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Function.h" #include <optional> namespace llvm { class MachineBasicBlock; class MachineBlockFrequencyInfo; class MachineInstr; /// Common features for diagnostics dealing with optimization remarks /// that are used by machine passes. class DiagnosticInfoMIROptimization : public DiagnosticInfoOptimizationBase { … }; /// Diagnostic information for applied optimization remarks. class MachineOptimizationRemark : public DiagnosticInfoMIROptimization { … }; /// Diagnostic information for missed-optimization remarks. class MachineOptimizationRemarkMissed : public DiagnosticInfoMIROptimization { … }; /// Diagnostic information for optimization analysis remarks. class MachineOptimizationRemarkAnalysis : public DiagnosticInfoMIROptimization { … }; /// Extend llvm::ore:: with MI-specific helper names. namespace ore { MNV; } /// The optimization diagnostic interface. /// /// It allows reporting when optimizations are performed and when they are not /// along with the reasons for it. Hotness information of the corresponding /// code region can be included in the remark if DiagnosticsHotnessRequested is /// enabled in the LLVM context. class MachineOptimizationRemarkEmitter { … }; /// The analysis pass class MachineOptimizationRemarkEmitterAnalysis : public AnalysisInfoMixin<MachineOptimizationRemarkEmitterAnalysis> { … }; /// The analysis pass /// /// Note that this pass shouldn't generally be marked as preserved by other /// passes. It's holding onto BFI, so if the pass does not preserve BFI, BFI /// could be freed. class MachineOptimizationRemarkEmitterPass : public MachineFunctionPass { … }; } #endif