From f36e936e6033f0400ce73ce3c8b19eca0df31c65 Mon Sep 17 00:00:00 2001
From: Prakalp Srivastava <psrivas2@illinois.edu>
Date: Wed, 26 Jun 2013 00:18:23 +0000
Subject: [PATCH] Author: Prakalp Srivastava Task: Added skeleton of
 Hierarchical DFG Builder Pass

File changes:
  A lib/Transforms/BuildDFG/BuildDFG.cpp
  A lib/Transforms/BuildDFG/BuildDFG.exports
  A lib/Transforms/BuildDFG/CMakeLists.txt
  A lib/Transforms/BuildDFG/Makefile
-
---
 llvm/lib/Transforms/BuildDFG/BuildDFG.cpp     | 36 +++++++++++++++++++
 llvm/lib/Transforms/BuildDFG/BuildDFG.exports |  0
 llvm/lib/Transforms/BuildDFG/CMakeLists.txt   |  3 ++
 llvm/lib/Transforms/BuildDFG/Makefile         | 15 ++++++++
 4 files changed, 54 insertions(+)
 create mode 100644 llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
 create mode 100644 llvm/lib/Transforms/BuildDFG/BuildDFG.exports
 create mode 100644 llvm/lib/Transforms/BuildDFG/CMakeLists.txt
 create mode 100644 llvm/lib/Transforms/BuildDFG/Makefile

diff --git a/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
new file mode 100644
index 0000000000..439218fb72
--- /dev/null
+++ b/llvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -0,0 +1,36 @@
+//=== BuildDFG.cpp - Implements "Hierarchical Dataflow Graph Builder Pass" ===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "buildDFG"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/IR/Function.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/raw_ostream.h"
+using namespace llvm;
+
+STATISTIC(IntrinsicCounter, "Counts number of visc intrinsics greeted");
+
+namespace {
+  // BuildDFG - The first implementation.
+  struct BuildDFG : public FunctionPass {
+    static char ID; // Pass identification, replacement for typeid
+    BuildDFG() : FunctionPass(ID) {}
+
+    virtual bool runOnFunction(Function &F) {
+      ++IntrinsicCounter;
+      errs() << "Intrinsics: ";
+      errs().write_escaped(F.getName()) << '\n';
+      return false;
+    }
+  };
+}
+
+char BuildDFG::ID = 0;
+static RegisterPass<BuildDFG> X("buildDFG", "Hierarchical Dataflow Graph Builder Pass");
+
diff --git a/llvm/lib/Transforms/BuildDFG/BuildDFG.exports b/llvm/lib/Transforms/BuildDFG/BuildDFG.exports
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/llvm/lib/Transforms/BuildDFG/CMakeLists.txt b/llvm/lib/Transforms/BuildDFG/CMakeLists.txt
new file mode 100644
index 0000000000..cdb89a2d91
--- /dev/null
+++ b/llvm/lib/Transforms/BuildDFG/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_llvm_loadable_module( LLVMBuildDFG
+  BuildDFG.cpp
+  )
diff --git a/llvm/lib/Transforms/BuildDFG/Makefile b/llvm/lib/Transforms/BuildDFG/Makefile
new file mode 100644
index 0000000000..e09cd63757
--- /dev/null
+++ b/llvm/lib/Transforms/BuildDFG/Makefile
@@ -0,0 +1,15 @@
+##===- lib/Transforms/BuildDFG/Makefile -----------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../
+LIBRARYNAME = LLVMBuildDFG
+LOADABLE_MODULE = 1
+USEDLIBS =
+
+include $(LEVEL)/Makefile.common
-- 
GitLab