LLVM 19.0.0git
Public Member Functions | List of all members
llvm::MachineOptimizationRemarkEmitter Class Reference

The optimization diagnostic interface. More...

#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"

Public Member Functions

 MachineOptimizationRemarkEmitter (MachineFunction &MF, MachineBlockFrequencyInfo *MBFI)
 
void emit (DiagnosticInfoOptimizationBase &OptDiag)
 Emit an optimization remark.
 
bool allowExtraAnalysis (StringRef PassName) const
 Whether we allow for extra compile-time budget to perform more analysis to be more informative.
 
template<typename T >
void emit (T RemarkBuilder, decltype(RemarkBuilder()) *=nullptr)
 Take a lambda that returns a remark which will be emitted.
 
MachineBlockFrequencyInfogetBFI ()
 

Detailed Description

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.

Definition at line 152 of file MachineOptimizationRemarkEmitter.h.

Constructor & Destructor Documentation

◆ MachineOptimizationRemarkEmitter()

llvm::MachineOptimizationRemarkEmitter::MachineOptimizationRemarkEmitter ( MachineFunction MF,
MachineBlockFrequencyInfo MBFI 
)
inline

Definition at line 154 of file MachineOptimizationRemarkEmitter.h.

Member Function Documentation

◆ allowExtraAnalysis()

bool llvm::MachineOptimizationRemarkEmitter::allowExtraAnalysis ( StringRef  PassName) const
inline

Whether we allow for extra compile-time budget to perform more analysis to be more informative.

This is useful to enable additional missed optimizations to be reported that are normally too noisy. In this mode, we can use the extra analysis (1) to filter trivial false positives or (2) to provide more context so that non-trivial false positives can be quickly detected by the user.

Definition at line 168 of file MachineOptimizationRemarkEmitter.h.

References llvm::Function::getContext(), llvm::LLVMContext::getDiagHandlerPtr(), llvm::MachineFunction::getFunction(), llvm::LLVMContext::getLLVMRemarkStreamer(), llvm::DiagnosticHandler::isAnyRemarkEnabled(), and PassName.

Referenced by llvm::AsmPrinter::emitFunctionBody().

◆ emit() [1/2]

void MachineOptimizationRemarkEmitter::emit ( DiagnosticInfoOptimizationBase OptDiag)

◆ emit() [2/2]

template<typename T >
void llvm::MachineOptimizationRemarkEmitter::emit ( T  RemarkBuilder,
decltype(RemarkBuilder()) *  = nullptr 
)
inline

Take a lambda that returns a remark which will be emitted.

Second argument is only used to restrict this to functions.

Definition at line 178 of file MachineOptimizationRemarkEmitter.h.

References emit, llvm::Function::getContext(), llvm::LLVMContext::getDiagHandlerPtr(), llvm::MachineFunction::getFunction(), llvm::LLVMContext::getLLVMRemarkStreamer(), and llvm::DiagnosticHandler::isAnyRemarkEnabled().

◆ getBFI()

MachineBlockFrequencyInfo * llvm::MachineOptimizationRemarkEmitter::getBFI ( )
inline

Definition at line 193 of file MachineOptimizationRemarkEmitter.h.


The documentation for this class was generated from the following files: