From 1629965964b0e5c786c16b5af15f1d53059183ed Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Wed, 3 Apr 2013 15:33:45 +0000 Subject: 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 --- lib/IRReader/IRReader.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/IRReader') diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp index fb87cbd..eeec14e 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; -- cgit v1.1