From 277ef9101428a8bbeea60f9c4070d94034281db5 Mon Sep 17 00:00:00 2001
From: Adel Ejjeh <aejjeh@hpvmfpga1.cs.illinois.edu>
Date: Wed, 22 Jan 2020 13:30:20 -0600
Subject: [PATCH] modified GENVISC and NVPTX pass to use visc-rt.bc instead of
 .ll

---
 hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp | 8 +++++---
 hpvm/lib/Transforms/GenVISC/GenVISC.cpp               | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index 50f35399c5..8a36e3b8af 100644
--- a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -264,11 +264,13 @@ void CGT_NVPTX::initRuntimeAPI() {
   assert(LLVM_SRC_ROOT != NULL && "Define LLVM_SRC_ROOT environment variable!");
 
   Twine llvmSrcRoot = LLVM_SRC_ROOT;
-  Twine runtimeAPI = llvmSrcRoot + "/../build/tools/hpvm/projects/visc-rt/visc-rt.ll";
+  Twine runtimeAPI = llvmSrcRoot + "/../build/tools/hpvm/projects/visc-rt/visc-rt.bc";
 
   runtimeModule = parseIRFile(runtimeAPI.str(), Err, M.getContext());
-  if(runtimeModule == nullptr)
-    DEBUG(errs() << Err.getMessage());
+  if(runtimeModule == nullptr) {
+    DEBUG(errs() << Err.getMessage() << " " << runtimeAPI << "\n");
+    assert(false && "couldn't parse runtime");
+  }
   else
     DEBUG(errs() << "Successfully loaded visc-rt API module\n");
 
diff --git a/hpvm/lib/Transforms/GenVISC/GenVISC.cpp b/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
index 1b4425459e..cc50541539 100644
--- a/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
+++ b/hpvm/lib/Transforms/GenVISC/GenVISC.cpp
@@ -266,13 +266,15 @@ bool GenVISC::runOnModule(Module &M) {
          "Define LLVM_SRC_ROOT environment variable!");
 
   Twine llvmSrcRoot = LLVM_SRC_ROOT;
-  Twine runtimeAPI = llvmSrcRoot + "/../build/tools/hpvm/projects/visc-rt/visc-rt.ll";
+  Twine runtimeAPI = llvmSrcRoot + "/../build/tools/hpvm/projects/visc-rt/visc-rt.bc";
   errs() << llvmSrcRoot << "\n";
 
   std::unique_ptr<Module> runtimeModule = parseIRFile(runtimeAPI.str(), Err, M.getContext());
 
-  if(runtimeModule == NULL)
-    DEBUG(errs() << Err.getMessage());
+  if(runtimeModule == NULL) {
+    DEBUG(errs() << Err.getMessage() << " " << runtimeAPI << "\n");
+    assert(false && "couldn't parse runtime");
+  }
   else
     DEBUG(errs() << "Successfully loaded visc-rt API module\n");
 
-- 
GitLab