mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-03 14:21:30 +00:00
Add timing of the IR parsing code with a new -time-ir-parsing flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177543 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/system_error.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@@ -69,6 +70,10 @@ namespace llvm {
|
||||
return getLazyIRModule(File.take(), Err, Context);
|
||||
}
|
||||
|
||||
extern const char *TimeIRParsingGroupName;
|
||||
extern const char *TimeIRParsingName;
|
||||
extern bool TimeIRParsingIsEnabled;
|
||||
|
||||
/// If the given MemoryBuffer holds a bitcode image, return a Module
|
||||
/// for it. Otherwise, attempt to parse it as LLVM Assembly and return
|
||||
/// a Module for it. This function *always* takes ownership of the given
|
||||
@@ -76,6 +81,8 @@ namespace llvm {
|
||||
inline Module *ParseIR(MemoryBuffer *Buffer,
|
||||
SMDiagnostic &Err,
|
||||
LLVMContext &Context) {
|
||||
NamedRegionTimer T(TimeIRParsingName, TimeIRParsingGroupName,
|
||||
TimeIRParsingIsEnabled);
|
||||
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
|
||||
(const unsigned char *)Buffer->getBufferEnd())) {
|
||||
std::string ErrMsg;
|
||||
|
||||
Reference in New Issue
Block a user