Index: llvm/trunk/include/llvm/Analysis/OptimizationDiagnosticInfo.h =================================================================== --- llvm/trunk/include/llvm/Analysis/OptimizationDiagnosticInfo.h +++ llvm/trunk/include/llvm/Analysis/OptimizationDiagnosticInfo.h @@ -69,9 +69,6 @@ /// \brief Output the remark via the diagnostic handler and to the /// optimization record file. - /// - /// This is the new interface that should be now used rather than the legacy - /// emit* APIs. void emit(DiagnosticInfoOptimizationBase &OptDiag); /// \brief Whether we allow for extra compile-time budget to perform more Index: llvm/trunk/include/llvm/IR/DiagnosticInfo.h =================================================================== --- llvm/trunk/include/llvm/IR/DiagnosticInfo.h +++ llvm/trunk/include/llvm/IR/DiagnosticInfo.h @@ -627,11 +627,6 @@ const DiagnosticLocation &Loc, const Twine &Msg) : DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName, Fn, Loc, Msg) {} - - friend void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); }; /// Diagnostic information for missed-optimization remarks. @@ -675,12 +670,6 @@ const DiagnosticLocation &Loc, const Twine &Msg) : DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark, PassName, Fn, Loc, Msg) {} - - friend void emitOptimizationRemarkMissed(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); }; /// Diagnostic information for optimization analysis remarks. @@ -752,12 +741,6 @@ const DiagnosticLocation &Loc, const Twine &Msg) : DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark, PassName, Fn, Loc, Msg) {} - - friend void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); }; /// Diagnostic information for optimization analysis remarks related to @@ -799,10 +782,6 @@ const Twine &Msg) : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute, PassName, Fn, Loc, Msg) {} - - friend void emitOptimizationRemarkAnalysisFPCommute( - LLVMContext &Ctx, const char *PassName, const Function &Fn, - const DiagnosticLocation &Loc, const Twine &Msg); }; /// Diagnostic information for optimization analysis remarks related to @@ -843,10 +822,6 @@ const Twine &Msg) : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing, PassName, Fn, Loc, Msg) {} - - friend void emitOptimizationRemarkAnalysisAliasing( - LLVMContext &Ctx, const char *PassName, const Function &Fn, - const DiagnosticLocation &Loc, const Twine &Msg); }; /// Diagnostic information for machine IR parser. @@ -889,74 +864,6 @@ // Create wrappers for C Binding types (see CBindingWrapping.h). DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef) -/// \brief Legacy interface to emit an optimization-applied message. Use -/// (Machine)OptimizationRemarkEmitter instead. -/// -/// \p PassName is the name of the pass emitting the message. If -Rpass= is -/// given and \p PassName matches the regular expression in -Rpass, then the -/// remark will be emitted. \p Fn is the function triggering the remark, \p Loc -/// is the debug location where the diagnostic is generated. \p Msg is the -/// message string to use. -void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, - const Function &Fn, const DiagnosticLocation &Loc, - const Twine &Msg); - -/// \brief Legacy interface to emit an optimization-missed message. Use -/// (Machine)OptimizationRemarkEmitter instead. -/// -/// \p PassName is the name of the pass emitting the message. If -Rpass-missed= -/// is given and \p PassName matches the regular expression in -Rpass, then the -/// remark will be emitted. \p Fn is the function triggering the remark, \p Loc -/// is the debug location where the diagnostic is generated. \p Msg is the -/// message string to use. -void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); - -/// \brief Legacy interface to emit an optimization analysis remark message. -/// Use (Machine)OptimizationRemarkEmitter instead. -/// -/// \p PassName is the name of the pass emitting the message. If -/// -Rpass-analysis= is given and \p PassName matches the regular expression in -/// -Rpass, then the remark will be emitted. \p Fn is the function triggering -/// the remark, \p Loc is the debug location where the diagnostic is -/// generated. \p Msg is the message string to use. -void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); - -/// \brief Legacy interface to emit an optimization analysis remark related to -/// messages about floating-point non-commutativity. Use -/// (Machine)OptimizationRemarkEmitter instead. -/// -/// \p PassName is the name of the pass emitting the message. If -/// -Rpass-analysis= is given and \p PassName matches the regular expression in -/// -Rpass, then the remark will be emitted. \p Fn is the function triggering -/// the remark, \p Loc is the debug location where the diagnostic is -/// generated. \p Msg is the message string to use. -void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); - -/// \brief Legacy interface to emit an optimization analysis remark related to -/// messages about pointer aliasing. Use (Machine)OptimizationRemarkEmitter -/// instead. -/// -/// \p PassName is the name of the pass emitting the message. -/// If -Rpass-analysis= is given and \p PassName matches the regular expression -/// in -Rpass, then the remark will be emitted. \p Fn is the function triggering -/// the remark, \p Loc is the debug location where the diagnostic is generated. -/// \p Msg is the message string to use. -void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg); - /// Diagnostic information for optimization failures. class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization { public: Index: llvm/trunk/lib/IR/DiagnosticInfo.cpp =================================================================== --- llvm/trunk/lib/IR/DiagnosticInfo.cpp +++ llvm/trunk/lib/IR/DiagnosticInfo.cpp @@ -45,14 +45,11 @@ /// \brief Regular expression corresponding to the value given in one of the /// -pass-remarks* command line flags. Passes whose name matches this regexp -/// will emit a diagnostic when calling the associated diagnostic function -/// (emitOptimizationRemark, emitOptimizationRemarkMissed or -/// emitOptimizationRemarkAnalysis). +/// will emit a diagnostic via ORE->emit(...); struct PassRemarksOpt { std::shared_ptr Pattern; void operator=(const std::string &Val) { - // Create a regexp object to match pass names for emitOptimizationRemark. if (!Val.empty()) { Pattern = std::make_shared(Val); std::string RegexError; @@ -71,7 +68,7 @@ static PassRemarksOpt PassRemarksAnalysisOptLoc; // -pass-remarks -// Command line flag to enable emitOptimizationRemark() +// Command line flag to enable optimization remarks static cl::opt> PassRemarks("pass-remarks", cl::value_desc("pattern"), cl::desc("Enable optimization remarks from passes whose name match " @@ -80,7 +77,7 @@ cl::ZeroOrMore); // -pass-remarks-missed -// Command line flag to enable emitOptimizationRemarkMissed() +// Command line flag to enable missed optimization remarks static cl::opt> PassRemarksMissed( "pass-remarks-missed", cl::value_desc("pattern"), cl::desc("Enable missed optimization remarks from passes whose name match " @@ -89,7 +86,7 @@ cl::ZeroOrMore); // -pass-remarks-analysis -// Command line flag to enable emitOptimizationRemarkAnalysis() +// Command line flag to enable optimization analysis remarks static cl::opt> PassRemarksAnalysis( "pass-remarks-analysis", cl::value_desc("pattern"), @@ -334,42 +331,6 @@ DP << Diagnostic; } -void llvm::emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg) { - Ctx.diagnose(OptimizationRemark(PassName, Fn, Loc, Msg)); -} - -void llvm::emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg) { - Ctx.diagnose(OptimizationRemarkMissed(PassName, Fn, Loc, Msg)); -} - -void llvm::emitOptimizationRemarkAnalysis(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg) { - Ctx.diagnose(OptimizationRemarkAnalysis(PassName, Fn, Loc, Msg)); -} - -void llvm::emitOptimizationRemarkAnalysisFPCommute( - LLVMContext &Ctx, const char *PassName, const Function &Fn, - const DiagnosticLocation &Loc, const Twine &Msg) { - Ctx.diagnose(OptimizationRemarkAnalysisFPCommute(PassName, Fn, Loc, Msg)); -} - -void llvm::emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx, - const char *PassName, - const Function &Fn, - const DiagnosticLocation &Loc, - const Twine &Msg) { - Ctx.diagnose(OptimizationRemarkAnalysisAliasing(PassName, Fn, Loc, Msg)); -} - DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure( const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)