Skip to content

Commit

Permalink
[DiagnosticInfo] Add a diagnostic class for the fallback of ISel.
Browse files Browse the repository at this point in the history
This will be used to warm when we fallback in GlobalISel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280271 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Quentin Colombet committed Aug 31, 2016
1 parent cfe0cf0 commit aa4eb89
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions include/llvm/IR/DiagnosticInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum DiagnosticKind {
DK_Linker,
DK_DebugMetadataVersion,
DK_DebugMetadataInvalid,
DK_ISelFallback,
DK_SampleProfile,
DK_OptimizationRemark,
DK_OptimizationRemarkMissed,
Expand Down Expand Up @@ -584,6 +585,25 @@ class DiagnosticInfoMIRParser : public DiagnosticInfo {
}
};

/// Diagnostic information for ISel fallback path.
class DiagnosticInfoISelFallback : public DiagnosticInfo {
/// The function that is concerned by this diagnostic.
const Function &Fn;

public:
DiagnosticInfoISelFallback(const Function &Fn,
DiagnosticSeverity Severity = DS_Warning)
: DiagnosticInfo(DK_ISelFallback, Severity), Fn(Fn) {}

const Function &getFunction() const { return Fn; }

void print(DiagnosticPrinter &DP) const override;

static bool classof(const DiagnosticInfo *DI) {
return DI->getKind() == DK_ISelFallback;
}
};

// Create wrappers for C Binding types (see CBindingWrapping.h).
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)

Expand Down
4 changes: 4 additions & 0 deletions lib/IR/DiagnosticInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,7 @@ void llvm::emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
Ctx.diagnose(DiagnosticInfoOptimizationFailure(
Fn, DLoc, Twine("loop not interleaved: " + Msg)));
}

void DiagnosticInfoISelFallback::print(DiagnosticPrinter &DP) const {
DP << "Instruction selection used fallback path for " << getFunction();
}

0 comments on commit aa4eb89

Please sign in to comment.