mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add opt remarks to Generic Specializer pass
Adds a combined API to output both debug message and optimization remarks. The previously added test partial_specialization_debug.sil ensures that it's an NFC for debug output.
This commit is contained in:
@@ -63,6 +63,20 @@ template <typename DerivedT> std::string Remark<DerivedT>::getMsg() const {
|
||||
return OS.str();
|
||||
}
|
||||
|
||||
template <typename DerivedT> std::string Remark<DerivedT>::getDebugMsg() const {
|
||||
std::string Str;
|
||||
llvm::raw_string_ostream OS(Str);
|
||||
|
||||
if (IndentDebugWidth)
|
||||
OS << std::string(" ", IndentDebugWidth);
|
||||
|
||||
for (const Argument &Arg : Args)
|
||||
OS << Arg.Val;
|
||||
|
||||
OS << "\n";
|
||||
return OS.str();
|
||||
}
|
||||
|
||||
Emitter::Emitter(StringRef PassName, SILModule &M)
|
||||
: Module(M), PassName(PassName),
|
||||
PassedEnabled(
|
||||
@@ -94,6 +108,14 @@ void Emitter::emit(const RemarkMissed &R) {
|
||||
emitRemark(Module, R, diag::opt_remark_missed, isEnabled<RemarkMissed>());
|
||||
}
|
||||
|
||||
void Emitter::emitDebug(const RemarkPassed &R) {
|
||||
llvm::dbgs() << R.getDebugMsg();
|
||||
}
|
||||
|
||||
void Emitter::emitDebug(const RemarkMissed &R) {
|
||||
llvm::dbgs() << R.getDebugMsg();
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user