aboutsummaryrefslogtreecommitdiff
path: root/lib/IRReader
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-04-03 15:33:45 +0000
committerEli Bendersky <eliben@google.com>2013-04-03 15:33:45 +0000
commit1629965964b0e5c786c16b5af15f1d53059183ed (patch)
tree4ec863be0a4b2da7581f201925fbd653c90a6257 /lib/IRReader
parent110e323b619c64e63f8d7814f9ad9a455e6dbf59 (diff)
Measure time that IR parsing took as part of the -time-passes measurement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IRReader')
-rw-r--r--lib/IRReader/IRReader.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp
index fb87cbd8bf..eeec14e834 100644
--- a/lib/IRReader/IRReader.cpp
+++ b/lib/IRReader/IRReader.cpp
@@ -14,9 +14,18 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/system_error.h"
+#include "llvm/Support/Timer.h"
using namespace llvm;
+namespace llvm {
+ extern bool TimePassesIsEnabled;
+}
+
+static const char *TimeIRParsingGroupName = "LLVM IR Parsing";
+static const char *TimeIRParsingName = "Parse IR";
+
+
Module *llvm::getLazyIRModule(MemoryBuffer *Buffer, SMDiagnostic &Err,
LLVMContext &Context) {
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
@@ -50,6 +59,8 @@ Module *llvm::getLazyIRFileModule(const std::string &Filename, SMDiagnostic &Err
Module *llvm::ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err,
LLVMContext &Context) {
+ NamedRegionTimer T(TimeIRParsingName, TimeIRParsingGroupName,
+ TimePassesIsEnabled);
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
(const unsigned char *)Buffer->getBufferEnd())) {
std::string ErrMsg;