From ac2e5526f6beeb933a32834f98a3f9b4dfb71dc5 Mon Sep 17 00:00:00 2001
From: Hashim Sharif <hsharif3@tyler.cs.illinois.edu>
Date: Mon, 30 Dec 2019 21:38:47 -0600
Subject: [PATCH] Adding scripts to construct and apply LLVM source patches

---
 llvm/tools/hpvm/llvm_patches/apply_patch.sh   | 33 +++++++++++++++++--
 .../hpvm/llvm_patches/construct_patch.sh      |  6 ++--
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/llvm/tools/hpvm/llvm_patches/apply_patch.sh b/llvm/tools/hpvm/llvm_patches/apply_patch.sh
index 7fe4e80c2d..ea86575207 100644
--- a/llvm/tools/hpvm/llvm_patches/apply_patch.sh
+++ b/llvm/tools/hpvm/llvm_patches/apply_patch.sh
@@ -1,7 +1,34 @@
 #!/bin/sh
 
 ### File Copies
-cp include/IR/IntrinsicsVISC.td  ../../../include/llvm/IR/IntrinsicsVISC.td
+cp include/IR/IntrinsicsVISC.td  ${LLVM_SRC_ROOT}/include/llvm/IR/IntrinsicsVISC.td
 
-## File Patches
-patch  /home/hsharif3/Github/llvm-project/llvm/include/llvm/IR/Attributes.td  <  ./include/IR/Attributes.td.patch 
+
+## Header File Patches
+patch  ${LLVM_SRC_ROOT}/include/llvm/IR/Attributes.td  <  ./include/IR/Attributes.td.patch 
+
+patch  ${LLVM_SRC_ROOT}/include/llvm/IR/Intrinsics.td  <  ./include/IR/Intrinsics.td.patch
+
+patch  ${LLVM_SRC_ROOT}/include/llvm/Bitcode/LLVMBitCodes.h  <  ./include/Bitcode/LLVMBitCodes.h.patch
+
+patch  ${LLVM_SRC_ROOT}/include/llvm/Support/Debug.h   <   ./include/Support/Debug.h.patch
+
+
+#### Patching Sources 
+
+
+patch  ${LLVM_SRC_ROOT}/lib/AsmParser/LLLexer.cpp   <  ./lib/AsmParser/LLLexer.cpp.patch 
+
+patch  ${LLVM_SRC_ROOT}/lib/AsmParser/LLLexer.h   <  ./lib/AsmParser/LLLexer.h.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/AsmParser/LLParser.cpp   <   ./lib/AsmParser/LLParser.cpp.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/AsmParser/LLParser.h   <   ./lib/AsmParser/LLParser.h.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/AsmParser/LLToken.h   <   ./lib/AsmParser/LLToken.h.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/IR/Attributes.cpp  <  ./lib/IR/Attributes.cpp.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/Bitcode/Reader/BitcodeReader.cpp   <   ./lib/Bitcode/Reader/BitcodeReader.cpp.patch
+
+patch  ${LLVM_SRC_ROOT}/lib/Bitcode/Writer/BitcodeWriter.cpp  <   ./lib/Bitcode/Writer/BitcodeWriter.cpp.patch
diff --git a/llvm/tools/hpvm/llvm_patches/construct_patch.sh b/llvm/tools/hpvm/llvm_patches/construct_patch.sh
index e191308e95..4034b542f0 100644
--- a/llvm/tools/hpvm/llvm_patches/construct_patch.sh
+++ b/llvm/tools/hpvm/llvm_patches/construct_patch.sh
@@ -1,18 +1,16 @@
 #!/bin/sh
 
-#### Patching Headers
+#### Computing Header Diff
 diff -u  ../../../include/llvm/Bitcode/LLVMBitCodes.h  include/Bitcode/LLVMBitCodes.h > include/Bitcode/LLVMBitCodes.h.patch 
 
 diff -u  ../../../include/llvm/IR/Attributes.td   include/IR/Attributes.td   > include/IR/Attributes.td.patch
 
 diff -u  ../../../include/llvm/IR/Intrinsics.td   include/IR/Intrinsics.td > include/IR/Intrinsics.td.patch
 
-cp include/IR/IntrinsicsVISC.td  ../../../include/llvm/IR/IntrinsicsVISC.td 
-
 diff -u  ../../../include/llvm/Support/Debug.h   include/Support/Debug.h > include/Support/Debug.h.patch
 
 
-#### Patching Sources
+#### Computing Source File Diff
 
 diff -u  ../../../lib/AsmParser/LLLexer.cpp   lib/AsmParser/LLLexer.cpp > lib/AsmParser/LLLexer.cpp.patch 
 
-- 
GitLab