#include "llvm/Pass.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/YAMLTraits.h"
void HandleTranslationUnit(ASTContext &C) override {
{
+ llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
if (FrontendTimesIsEnabled) {
LLVMIRGenerationRefCount += 1;
--- /dev/null
+#!/usr/bin/env python
+
+import json, sys
+
+def is_inside(range1, range2):
+ a = range1["ts"]; b = a + range1["dur"]
+ c = range2["ts"]; d = c + range2["dur"]
+ return (a >= c and a <= d) and (b >= c and b <= d)
+
+def is_before(range1, range2):
+ b = range1["ts"] + range1["dur"]; c = range2["ts"]
+ return b <= c
+
+events = json.loads(sys.stdin.read())["traceEvents"]
+codegens = filter(lambda x: x["name"] == "CodeGen Function", events)
+frontends = filter(lambda x: x["name"] == "Frontend", events)
+backends = filter(lambda x: x["name"] == "Backend", events)
+
+if not all([any([is_inside(codegen, frontend) for frontend in frontends])
+ for codegen in codegens]):
+ sys.exit("Not all CodeGen sections are inside any Frontend section!")
+
+if not all([all([is_before(frontend, backend) for frontend in frontends])
+ for backend in backends]):
+ sys.exit("Not all Frontend section are before all Backend sections!")