From f2f70bbb404d84bbeb0fb8036c4d1186a9046e12 Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu>
Date: Thu, 26 Dec 2019 23:37:08 -0600
Subject: [PATCH] Moving headers and adjusting header paths

---
 .../hpvm/include}/BuildDFG/BuildDFG.h         |  0
 .../hpvm/include}/GenVISC/GenVISC.h           |  2 +-
 .../hpvm/include}/SupportVISC/DFG2LLVM.h      |  8 ++++----
 .../include}/SupportVISC/DFGTreeTraversal.h   |  0
 .../hpvm/include/SupportVISC}/DFGraph.h       |  4 ++--
 .../hpvm/include}/SupportVISC/VISCHint.h      |  0
 .../hpvm/include}/SupportVISC/VISCTimer.h     |  0
 .../hpvm/include}/SupportVISC/VISCUtils.h     |  2 +-
 .../hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp |  6 +++---
 .../hpvm/lib/Transforms/ClearDFG/ClearDFG.cpp |  2 +-
 .../DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp         | 20 ++++++++++++-------
 .../Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp  |  2 +-
 .../hpvm/lib/Transforms/GenVISC/GenVISC.cpp   |  8 ++++----
 13 files changed, 30 insertions(+), 24 deletions(-)
 rename llvm/{include/llvm => tools/hpvm/include}/BuildDFG/BuildDFG.h (100%)
 rename llvm/{include/llvm => tools/hpvm/include}/GenVISC/GenVISC.h (97%)
 rename llvm/{include/llvm => tools/hpvm/include}/SupportVISC/DFG2LLVM.h (99%)
 rename llvm/{include/llvm => tools/hpvm/include}/SupportVISC/DFGTreeTraversal.h (100%)
 rename llvm/{include/llvm/IR => tools/hpvm/include/SupportVISC}/DFGraph.h (99%)
 rename llvm/{include/llvm => tools/hpvm/include}/SupportVISC/VISCHint.h (100%)
 rename llvm/{include/llvm => tools/hpvm/include}/SupportVISC/VISCTimer.h (100%)
 rename llvm/{include/llvm => tools/hpvm/include}/SupportVISC/VISCUtils.h (99%)

diff --git a/llvm/include/llvm/BuildDFG/BuildDFG.h b/llvm/tools/hpvm/include/BuildDFG/BuildDFG.h
similarity index 100%
rename from llvm/include/llvm/BuildDFG/BuildDFG.h
rename to llvm/tools/hpvm/include/BuildDFG/BuildDFG.h
diff --git a/llvm/include/llvm/GenVISC/GenVISC.h b/llvm/tools/hpvm/include/GenVISC/GenVISC.h
similarity index 97%
rename from llvm/include/llvm/GenVISC/GenVISC.h
rename to llvm/tools/hpvm/include/GenVISC/GenVISC.h
index fcdb636a05..21ccf68b6f 100644
--- a/llvm/include/llvm/GenVISC/GenVISC.h
+++ b/llvm/tools/hpvm/include/GenVISC/GenVISC.h
@@ -13,7 +13,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Pass.h"
-#include "llvm/SupportVISC/VISCTimer.h"
+#include "SupportVISC/VISCTimer.h"
 
 using namespace llvm;
 
diff --git a/llvm/include/llvm/SupportVISC/DFG2LLVM.h b/llvm/tools/hpvm/include/SupportVISC/DFG2LLVM.h
similarity index 99%
rename from llvm/include/llvm/SupportVISC/DFG2LLVM.h
rename to llvm/tools/hpvm/include/SupportVISC/DFG2LLVM.h
index 355fb18570..1e45e87ccb 100644
--- a/llvm/include/llvm/SupportVISC/DFG2LLVM.h
+++ b/llvm/tools/hpvm/include/SupportVISC/DFG2LLVM.h
@@ -16,10 +16,10 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Pass.h"
-#include "llvm/BuildDFG/BuildDFG.h"
-#include "llvm/SupportVISC/VISCHint.h"
-#include "llvm/SupportVISC/VISCTimer.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "BuildDFG/BuildDFG.h"
+#include "SupportVISC/VISCHint.h"
+#include "SupportVISC/VISCTimer.h"
+#include "SupportVISC/VISCUtils.h"
 
 using namespace llvm;
 using namespace builddfg;
diff --git a/llvm/include/llvm/SupportVISC/DFGTreeTraversal.h b/llvm/tools/hpvm/include/SupportVISC/DFGTreeTraversal.h
similarity index 100%
rename from llvm/include/llvm/SupportVISC/DFGTreeTraversal.h
rename to llvm/tools/hpvm/include/SupportVISC/DFGTreeTraversal.h
diff --git a/llvm/include/llvm/IR/DFGraph.h b/llvm/tools/hpvm/include/SupportVISC/DFGraph.h
similarity index 99%
rename from llvm/include/llvm/IR/DFGraph.h
rename to llvm/tools/hpvm/include/SupportVISC/DFGraph.h
index 3b78849924..dd6a2f0bbb 100644
--- a/llvm/include/llvm/IR/DFGraph.h
+++ b/llvm/tools/hpvm/include/SupportVISC/DFGraph.h
@@ -28,8 +28,8 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/GraphWriter.h"
-#include "llvm/SupportVISC/VISCHint.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "SupportVISC/VISCHint.h"
+#include "SupportVISC/VISCUtils.h"
 
 
 namespace llvm {
diff --git a/llvm/include/llvm/SupportVISC/VISCHint.h b/llvm/tools/hpvm/include/SupportVISC/VISCHint.h
similarity index 100%
rename from llvm/include/llvm/SupportVISC/VISCHint.h
rename to llvm/tools/hpvm/include/SupportVISC/VISCHint.h
diff --git a/llvm/include/llvm/SupportVISC/VISCTimer.h b/llvm/tools/hpvm/include/SupportVISC/VISCTimer.h
similarity index 100%
rename from llvm/include/llvm/SupportVISC/VISCTimer.h
rename to llvm/tools/hpvm/include/SupportVISC/VISCTimer.h
diff --git a/llvm/include/llvm/SupportVISC/VISCUtils.h b/llvm/tools/hpvm/include/SupportVISC/VISCUtils.h
similarity index 99%
rename from llvm/include/llvm/SupportVISC/VISCUtils.h
rename to llvm/tools/hpvm/include/SupportVISC/VISCUtils.h
index a20ce8bccd..02a44518ee 100644
--- a/llvm/include/llvm/SupportVISC/VISCUtils.h
+++ b/llvm/tools/hpvm/include/SupportVISC/VISCUtils.h
@@ -23,7 +23,7 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/SupportVISC/VISCHint.h"
+#include "SupportVISC/VISCHint.h"
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 
diff --git a/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
index 04b01e332b..447ffdc9b1 100644
--- a/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -8,15 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 #define DEBUG_TYPE "buildDFG"
-#include "llvm/BuildDFG/BuildDFG.h"
+#include "BuildDFG/BuildDFG.h"
 
 #include "llvm/ADT/Statistic.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/IR/InstIterator.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/SupportVISC/VISCHint.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "SupportVISC/VISCHint.h"
+#include "SupportVISC/VISCUtils.h"
 
 using namespace llvm;
 
diff --git a/llvm/tools/hpvm/lib/Transforms/ClearDFG/ClearDFG.cpp b/llvm/tools/hpvm/lib/Transforms/ClearDFG/ClearDFG.cpp
index 37f74325a7..7ba4db3ed7 100644
--- a/llvm/tools/hpvm/lib/Transforms/ClearDFG/ClearDFG.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/ClearDFG/ClearDFG.cpp
@@ -13,7 +13,7 @@
 #include "llvm/IR/InstIterator.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/BuildDFG/BuildDFG.h"
+#include "BuildDFG/BuildDFG.h"
 
 using namespace llvm;
 using namespace builddfg;
diff --git a/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index 3670c2ef55..abadb75aec 100644
--- a/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -29,9 +29,9 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm-c/Core.h"
-#include "llvm/SupportVISC/VISCTimer.h"
-#include "llvm/SupportVISC/DFG2LLVM.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "SupportVISC/VISCTimer.h"
+#include "SupportVISC/DFG2LLVM.h"
+#include "SupportVISC/VISCUtils.h"
 
 #include "llvm/IR/IRPrintingPasses.h"
 #include "llvm/IR/LegacyPassManager.h"
@@ -999,11 +999,17 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
   // Clone the function
   ValueToValueMapTy VMap;
 
-  Twine FName = F->getName();
   F_nvptx = CloneFunction(F, VMap);
-  F_nvptx->setName(FName+"_nvptx");
-//  errs() << "Old Function Name: " << F->getName() << "\n";
-//  errs() << "New Function Name: " << F_nvptx->getName() << "\n";
+  //F_nvptx->setName(FName+"_nvptx");
+
+  Twine FName = F->getName();
+  StringRef fStr = FName.getSingleStringRef();
+  Twine newFName = Twine(fStr, "_nvptx"); 
+  F_nvptx->setName(newFName);
+
+  
+  //  errs() << "Old Function Name: " << F->getName() << "\n";
+  //  errs() << "New Function Name: " << F_nvptx->getName() << "\n";
 
   F_nvptx->removeFromParent();
 
diff --git a/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp b/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
index b693bd0be4..1d3a49b72a 100644
--- a/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/DFG2LLVM_X86/DFG2LLVM_X86.cpp
@@ -19,7 +19,7 @@
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Constant.h"
-#include "llvm/SupportVISC/DFG2LLVM.h"
+#include "SupportVISC/DFG2LLVM.h"
 
 using namespace llvm;
 using namespace builddfg;
diff --git a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
index faab312087..89d92f8083 100644
--- a/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #define DEBUG_TYPE "genvisc"
-#include "llvm/GenVISC/GenVISC.h"
+#include "GenVISC/GenVISC.h"
 
 #include "llvm/ADT/Statistic.h"
 #include "llvm/IR/CallSite.h"
@@ -17,14 +17,14 @@
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/IRReader/IRReader.h"
 #include "llvm/IR/DerivedTypes.h"
-#include "llvm/SupportVISC/VISCHint.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "SupportVISC/VISCHint.h"
+#include "SupportVISC/VISCUtils.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/Transforms/Utils/Cloning.h"
-#include "llvm/SupportVISC/VISCUtils.h"
+#include "SupportVISC/VISCUtils.h"
 
 
 #define TIMER(X) do { if (VISCTimer) { X; } } while (0)
-- 
GitLab