|
46 | 46 | #include "llvm/Support/FileSystem.h"
|
47 | 47 | #include "llvm/Support/MD5.h"
|
48 | 48 | #include "llvm/Support/Path.h"
|
| 49 | +#include "llvm/Support/TimeProfiler.h" |
49 | 50 | using namespace clang;
|
50 | 51 | using namespace clang::CodeGen;
|
51 | 52 |
|
@@ -2968,6 +2969,13 @@ llvm::DIType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile *Unit) {
|
2968 | 2969 | if (Ty.isNull())
|
2969 | 2970 | return nullptr;
|
2970 | 2971 |
|
| 2972 | + llvm::TimeTraceScope TimeScope("DebugType", [&]() { |
| 2973 | + std::string Name; |
| 2974 | + llvm::raw_string_ostream OS(Name); |
| 2975 | + Ty.print(OS, getPrintingPolicy()); |
| 2976 | + return Name; |
| 2977 | + }); |
| 2978 | + |
2971 | 2979 | // Unwrap the type as needed for debug information.
|
2972 | 2980 | Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext());
|
2973 | 2981 |
|
@@ -3686,6 +3694,15 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
|
3686 | 3694 | if (!D)
|
3687 | 3695 | return;
|
3688 | 3696 |
|
| 3697 | + llvm::TimeTraceScope TimeScope("DebugFunction", [&]() { |
| 3698 | + std::string Name; |
| 3699 | + llvm::raw_string_ostream OS(Name); |
| 3700 | + if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) |
| 3701 | + ND->getNameForDiagnostic(OS, getPrintingPolicy(), |
| 3702 | + /*Qualified=*/true); |
| 3703 | + return Name; |
| 3704 | + }); |
| 3705 | + |
3689 | 3706 | llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
|
3690 | 3707 | llvm::DIFile *Unit = getOrCreateFile(Loc);
|
3691 | 3708 | bool IsDeclForCallSite = Fn ? true : false;
|
@@ -4406,6 +4423,14 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
|
4406 | 4423 | if (D->hasAttr<NoDebugAttr>())
|
4407 | 4424 | return;
|
4408 | 4425 |
|
| 4426 | + llvm::TimeTraceScope TimeScope("DebugGlobalVariable", [&]() { |
| 4427 | + std::string Name; |
| 4428 | + llvm::raw_string_ostream OS(Name); |
| 4429 | + D->getNameForDiagnostic(OS, getPrintingPolicy(), |
| 4430 | + /*Qualified=*/true); |
| 4431 | + return Name; |
| 4432 | + }); |
| 4433 | + |
4409 | 4434 | // If we already created a DIGlobalVariable for this declaration, just attach
|
4410 | 4435 | // it to the llvm::GlobalVariable.
|
4411 | 4436 | auto Cached = DeclCache.find(D->getCanonicalDecl());
|
@@ -4466,6 +4491,14 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) {
|
4466 | 4491 | assert(DebugKind >= codegenoptions::LimitedDebugInfo);
|
4467 | 4492 | if (VD->hasAttr<NoDebugAttr>())
|
4468 | 4493 | return;
|
| 4494 | + llvm::TimeTraceScope TimeScope("DebugConstGlobalVariable", [&]() { |
| 4495 | + std::string Name; |
| 4496 | + llvm::raw_string_ostream OS(Name); |
| 4497 | + VD->getNameForDiagnostic(OS, getPrintingPolicy(), |
| 4498 | + /*Qualified=*/true); |
| 4499 | + return Name; |
| 4500 | + }); |
| 4501 | + |
4469 | 4502 | auto Align = getDeclAlignIfRequired(VD, CGM.getContext());
|
4470 | 4503 | // Create the descriptor for the variable.
|
4471 | 4504 | llvm::DIFile *Unit = getOrCreateFile(VD->getLocation());
|
|
0 commit comments