diff options
| author | Luboš Luňák <l.lunak@centrum.cz> | 2019-11-02 16:39:59 +0100 | 
|---|---|---|
| committer | Luboš Luňák <l.lunak@centrum.cz> | 2019-11-02 18:12:51 +0100 | 
| commit | 4f2104c5adbcfe23c1f5865fb45783938645edfd (patch) | |
| tree | 084d420e47377eeb69411a27ed85a38a7149c5c4 /clang/lib | |
| parent | 5fb17829184045b0451624f572da692f5a8f629b (diff) | |
| download | bcm5719-llvm-4f2104c5adbcfe23c1f5865fb45783938645edfd.tar.gz bcm5719-llvm-4f2104c5adbcfe23c1f5865fb45783938645edfd.zip  | |
make -ftime-trace also trace time spent creating debug info
Differential Revision: https://reviews.llvm.org/D69750
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 33 | 
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 38750d7d336..e0bb3fda7ac 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -46,6 +46,7 @@  #include "llvm/Support/FileSystem.h"  #include "llvm/Support/MD5.h"  #include "llvm/Support/Path.h" +#include "llvm/Support/TimeProfiler.h"  using namespace clang;  using namespace clang::CodeGen; @@ -2968,6 +2969,13 @@ llvm::DIType *CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile *Unit) {    if (Ty.isNull())      return nullptr; +  llvm::TimeTraceScope TimeScope("DebugType", [&]() { +    std::string Name; +    llvm::raw_string_ostream OS(Name); +    Ty.print(OS, getPrintingPolicy()); +    return Name; +  }); +    // Unwrap the type as needed for debug information.    Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext()); @@ -3686,6 +3694,15 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,    if (!D)      return; +  llvm::TimeTraceScope TimeScope("DebugFunction", [&]() { +    std::string Name; +    llvm::raw_string_ostream OS(Name); +    if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) +      ND->getNameForDiagnostic(OS, getPrintingPolicy(), +                               /*Qualified=*/true); +    return Name; +  }); +    llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;    llvm::DIFile *Unit = getOrCreateFile(Loc);    bool IsDeclForCallSite = Fn ? true : false; @@ -4406,6 +4423,14 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,    if (D->hasAttr<NoDebugAttr>())      return; +  llvm::TimeTraceScope TimeScope("DebugGlobalVariable", [&]() { +    std::string Name; +    llvm::raw_string_ostream OS(Name); +    D->getNameForDiagnostic(OS, getPrintingPolicy(), +                            /*Qualified=*/true); +    return Name; +  }); +    // If we already created a DIGlobalVariable for this declaration, just attach    // it to the llvm::GlobalVariable.    auto Cached = DeclCache.find(D->getCanonicalDecl()); @@ -4466,6 +4491,14 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) {    assert(DebugKind >= codegenoptions::LimitedDebugInfo);    if (VD->hasAttr<NoDebugAttr>())      return; +  llvm::TimeTraceScope TimeScope("DebugConstGlobalVariable", [&]() { +    std::string Name; +    llvm::raw_string_ostream OS(Name); +    VD->getNameForDiagnostic(OS, getPrintingPolicy(), +                             /*Qualified=*/true); +    return Name; +  }); +    auto Align = getDeclAlignIfRequired(VD, CGM.getContext());    // Create the descriptor for the variable.    llvm::DIFile *Unit = getOrCreateFile(VD->getLocation());  | 

