mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add support for missed and analysis optimization remarks.
Summary: This adds two new diagnostics: -pass-remarks-missed and -pass-remarks-analysis. They take the same values as -pass-remarks but are intended to be triggered in different contexts. -pass-remarks-missed is used by LLVMContext::emitOptimizationRemarkMissed, which passes call when they tried to apply a transformation but couldn't. -pass-remarks-analysis is used by LLVMContext::emitOptimizationRemarkAnalysis, which passes call when they want to inform the user about analysis results. The patch also: 1- Adds support in the inliner for the two new remarks and a test case. 2- Moves emitOptimizationRemark* functions to the llvm namespace. 3- Adds an LLVMContext argument instead of making them member functions of LLVMContext. Reviewers: qcolombet Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3682 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209442 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -142,14 +142,26 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Optimization remarks are selective. They need to check whether
|
||||
// the regexp pattern, passed via -pass-remarks, matches the name
|
||||
// of the pass that is emitting the diagnostic. If there is no match,
|
||||
// ignore the diagnostic and return.
|
||||
if (DI.getKind() == llvm::DK_OptimizationRemark &&
|
||||
!pImpl->optimizationRemarksEnabledFor(
|
||||
cast<DiagnosticInfoOptimizationRemark>(DI).getPassName()))
|
||||
return;
|
||||
// Optimization remarks are selective. They need to check whether the regexp
|
||||
// pattern, passed via one of the -pass-remarks* flags, matches the name of
|
||||
// the pass that is emitting the diagnostic. If there is no match, ignore the
|
||||
// diagnostic and return.
|
||||
switch (DI.getKind()) {
|
||||
case llvm::DK_OptimizationRemark:
|
||||
if (!cast<DiagnosticInfoOptimizationRemark>(DI).isEnabled(pImpl))
|
||||
return;
|
||||
break;
|
||||
case llvm::DK_OptimizationRemarkMissed:
|
||||
if (!cast<DiagnosticInfoOptimizationRemarkMissed>(DI).isEnabled(pImpl))
|
||||
return;
|
||||
break;
|
||||
case llvm::DK_OptimizationRemarkAnalysis:
|
||||
if (!cast<DiagnosticInfoOptimizationRemarkAnalysis>(DI).isEnabled(pImpl))
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Otherwise, print the message with a prefix based on the severity.
|
||||
std::string MsgStorage;
|
||||
@@ -177,13 +189,6 @@ void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
|
||||
diagnose(DiagnosticInfoInlineAsm(LocCookie, ErrorStr));
|
||||
}
|
||||
|
||||
void LLVMContext::emitOptimizationRemark(const char *PassName,
|
||||
const Function &Fn,
|
||||
const DebugLoc &DLoc,
|
||||
const Twine &Msg) {
|
||||
diagnose(DiagnosticInfoOptimizationRemark(PassName, Fn, DLoc, Msg));
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Metadata Kind Uniquing
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user