summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-04-10 10:34:13 +0000
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-04-10 10:34:13 +0000
commitc88deb100f1d4a1d14dbcc42de01d325919ebec6 (patch)
tree36fe084ef5681b5e643f8eb90483a14f00df70d4 /clang/lib/Lex/PPMacroExpansion.cpp
parent037d3b20d3c0d9ea5c90aec9de3a5257d46b70c9 (diff)
downloadbcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.tar.gz
bcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.zip
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report: -Some general Code Generation Time; -Total time of Backend Consumer actions. This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc. Differential Revision: https://reviews.llvm.org/D43578 llvm-svn: 329684
Diffstat (limited to 'clang/lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 5af8ba57241..7c44cc84300 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -26,9 +26,9 @@
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/PTHLexer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorLexer.h"
-#include "clang/Lex/PTHLexer.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
@@ -36,15 +36,16 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -57,6 +58,9 @@
using namespace clang;
+static const char *const GroupName = "clangparser";
+static const char *const GroupDescription = "===== Clang Parser =====";
+
MacroDirective *
Preprocessor::getLocalMacroDirectiveHistory(const IdentifierInfo *II) const {
if (!II->hadMacroDefinition())
@@ -69,6 +73,8 @@ Preprocessor::getLocalMacroDirectiveHistory(const IdentifierInfo *II) const {
void Preprocessor::appendMacroDirective(IdentifierInfo *II, MacroDirective *MD){
assert(MD && "MacroDirective should be non-zero!");
assert(!MD->getPrevious() && "Already attached to a MacroDirective history.");
+ llvm::NamedRegionTimer NRT("appendmacro", "PP Append Macro", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
MacroState &StoredMD = CurSubmoduleState->Macros[II];
auto *OldMD = StoredMD.getLatest();
@@ -131,6 +137,8 @@ ModuleMacro *Preprocessor::addModuleMacro(Module *Mod, IdentifierInfo *II,
MacroInfo *Macro,
ArrayRef<ModuleMacro *> Overrides,
bool &New) {
+ llvm::NamedRegionTimer NRT("addmodulemacro", "PP Add Module Macro", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
llvm::FoldingSetNodeID ID;
ModuleMacro::Profile(ID, Mod, II);
@@ -182,6 +190,9 @@ void Preprocessor::updateModuleMacroInfo(const IdentifierInfo *II,
assert(Info.ActiveModuleMacrosGeneration !=
CurSubmoduleState->VisibleModules.getGeneration() &&
"don't need to update this macro name info");
+ llvm::NamedRegionTimer NRT("updatemodulemacro", "PP Update Module Macro",
+ GroupName, GroupDescription,
+ llvm::TimePassesIsEnabled);
Info.ActiveModuleMacrosGeneration =
CurSubmoduleState->VisibleModules.getGeneration();
@@ -754,6 +765,8 @@ static bool GenerateNewArgTokens(Preprocessor &PP,
MacroArgs *Preprocessor::ReadMacroCallArgumentList(Token &MacroName,
MacroInfo *MI,
SourceLocation &MacroEnd) {
+ llvm::NamedRegionTimer NRT("ppmacrocall", "PP Macro Call Args", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
// The number of fixed arguments to parse.
unsigned NumFixedArgsLeft = MI->getNumParams();
bool isVariadic = MI->isVariadic();
OpenPOWER on IntegriCloud