From 6c200323dc835bbaeb74ef8e30397370794b1e6d Mon Sep 17 00:00:00 2001
From: Adel Ejjeh <aejjeh@tyler.cs.illinois.edu>
Date: Fri, 17 Jan 2020 18:49:11 -0600
Subject: [PATCH] Adding CBE and changes to NVPTX pass to support GPU

---
 hpvm/include/SupportVISC/VISCUtils.h          |  208 +-
 .../DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp         | 1480 +++--
 hpvm/projects/llvm-cbe/CMakeLists.txt         |    2 +
 hpvm/projects/llvm-cbe/LICENSE                |   57 +
 hpvm/projects/llvm-cbe/Makefile               |   14 +
 hpvm/projects/llvm-cbe/README.md              |  120 +
 hpvm/projects/llvm-cbe/build/CMakeCache.txt   |  314 +
 .../CMakeFiles/3.5.1/CMakeCCompiler.cmake     |   67 +
 .../CMakeFiles/3.5.1/CMakeCXXCompiler.cmake   |   68 +
 .../3.5.1/CMakeDetermineCompilerABI_C.bin     |  Bin 0 -> 8640 bytes
 .../3.5.1/CMakeDetermineCompilerABI_CXX.bin   |  Bin 0 -> 8656 bytes
 .../build/CMakeFiles/3.5.1/CMakeSystem.cmake  |   15 +
 .../3.5.1/CompilerIdC/CMakeCCompilerId.c      |  544 ++
 .../build/CMakeFiles/3.5.1/CompilerIdC/a.out  |  Bin 0 -> 8800 bytes
 .../CompilerIdCXX/CMakeCXXCompilerId.cpp      |  533 ++
 .../CMakeFiles/3.5.1/CompilerIdCXX/a.out      |  Bin 0 -> 8808 bytes
 .../llvm-cbe/build/CMakeFiles/CMakeOutput.log |  554 ++
 .../build/CMakeFiles/cmake.check_cache        |    1 +
 .../build/CMakeFiles/feature_tests.bin        |  Bin 0 -> 12696 bytes
 .../llvm-cbe/build/CMakeFiles/feature_tests.c |   34 +
 .../build/CMakeFiles/feature_tests.cxx        |  405 ++
 hpvm/projects/llvm-cbe/docs/index.html        |    6 +
 hpvm/projects/llvm-cbe/include/sample.h       |    8 +
 hpvm/projects/llvm-cbe/lib/CMakeLists.txt     |    1 +
 hpvm/projects/llvm-cbe/lib/Makefile           |   14 +
 .../llvm-cbe/lib/Target/CBackend/CBackend.cpp | 5717 +++++++++++++++++
 .../llvm-cbe/lib/Target/CBackend/CBackend.h   |  344 +
 .../lib/Target/CBackend/CMakeLists.txt        |   23 +
 .../lib/Target/CBackend/CTargetMachine.h      |   58 +
 .../lib/Target/CBackend/LLVMBuild.txt         |   46 +
 .../llvm-cbe/lib/Target/CBackend/Makefile     |   17 +
 .../TargetInfo/CBackendTargetInfo.cpp         |   21 +
 .../TargetInfo/CBackendTargetInfo.cpp~        |   21 +
 .../Target/CBackend/TargetInfo/CMakeLists.txt |   17 +
 .../Target/CBackend/TargetInfo/LLVMBuild.txt  |   23 +
 .../lib/Target/CBackend/TargetInfo/Makefile   |   14 +
 .../llvm-cbe/lib/Target/CMakeLists.txt        |    1 +
 hpvm/projects/llvm-cbe/lib/Target/Makefile    |   14 +
 hpvm/projects/llvm-cbe/test/.cdsenv           |  104 +
 hpvm/projects/llvm-cbe/test/.cdsinit          |  120 +
 hpvm/projects/llvm-cbe/test/.gitignore        |    5 +
 hpvm/projects/llvm-cbe/test/.log              |    1 +
 hpvm/projects/llvm-cbe/test/APInt-C.cpp       |  535 ++
 hpvm/projects/llvm-cbe/test/APInt-C.h         |   89 +
 .../llvm-cbe/test/CBEWarningsErrors.txt       |   31 +
 hpvm/projects/llvm-cbe/test/Makefile          |   80 +
 hpvm/projects/llvm-cbe/test/cds.lib           |   13 +
 hpvm/projects/llvm-cbe/test/cfiles/test001.c  |   17 +
 hpvm/projects/llvm-cbe/test/cfiles/test002.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test003.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test004.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test005.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test006.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test007.c  |   33 +
 hpvm/projects/llvm-cbe/test/cfiles/test008.c  |   29 +
 hpvm/projects/llvm-cbe/test/cfiles/test009.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test010.c  |   43 +
 hpvm/projects/llvm-cbe/test/cfiles/test011.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test012.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test013.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test014.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test015.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test016.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test017.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test018.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test019.c  |   21 +
 hpvm/projects/llvm-cbe/test/cfiles/test020.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test021.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test022.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test023.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test024.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test025.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test026.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test027.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test028.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test029.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test030.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test031.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test032.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test033.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test034.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test035.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test036.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test037.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test038.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test039.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test040.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test041.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test042.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test043.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test044.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test045.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test046.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test047.c  |   19 +
 hpvm/projects/llvm-cbe/test/cfiles/test048.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test049.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test050.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test051.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test052.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test053.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test054.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test055.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test056.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test057.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test058.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test059.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test060.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test061.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test062.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test063.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test064.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test065.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test066.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test067.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test068.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test069.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test070.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test071.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test072.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test073.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test074.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test075.c  |   28 +
 hpvm/projects/llvm-cbe/test/cfiles/test076.c  |   22 +
 hpvm/projects/llvm-cbe/test/cfiles/test077.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test078.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test079.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test080.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test081.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test082.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test083.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test084.c  |   28 +
 hpvm/projects/llvm-cbe/test/cfiles/test085.c  |   29 +
 hpvm/projects/llvm-cbe/test/cfiles/test086.c  |   28 +
 hpvm/projects/llvm-cbe/test/cfiles/test087.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test088.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test089.c  |   26 +
 hpvm/projects/llvm-cbe/test/cfiles/test090.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test091.c  |   25 +
 hpvm/projects/llvm-cbe/test/cfiles/test092.c  |   35 +
 hpvm/projects/llvm-cbe/test/cfiles/test093.c  |   29 +
 hpvm/projects/llvm-cbe/test/cfiles/test094.c  |   29 +
 hpvm/projects/llvm-cbe/test/cfiles/test095.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test096.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test097.c  |   27 +
 hpvm/projects/llvm-cbe/test/cfiles/test098.c  |   28 +
 hpvm/projects/llvm-cbe/test/cfiles/test099.c  |   20 +
 hpvm/projects/llvm-cbe/test/cfiles/test100.c  |   30 +
 hpvm/projects/llvm-cbe/test/cfiles/test101.c  |   37 +
 hpvm/projects/llvm-cbe/test/cfiles/test102.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test103.c  |   23 +
 hpvm/projects/llvm-cbe/test/cfiles/test104.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/test105.c  |   24 +
 hpvm/projects/llvm-cbe/test/cfiles/testbad.c  |   17 +
 hpvm/projects/llvm-cbe/test/dtypes.h          |  204 +
 hpvm/projects/llvm-cbe/test/platform.h        |  113 +
 .../llvm-cbe/test/selectionsort/main.c        |   39 +
 hpvm/projects/llvm-cbe/test/test.log          |   52 +
 hpvm/projects/llvm-cbe/test/test.sh           |    3 +
 hpvm/projects/llvm-cbe/test/test001.c         |   17 +
 hpvm/projects/llvm-cbe/test/test002.c         |   21 +
 hpvm/projects/llvm-cbe/test/test003.c         |   23 +
 hpvm/projects/llvm-cbe/test/test004.c         |   21 +
 hpvm/projects/llvm-cbe/test/test005.c         |   21 +
 hpvm/projects/llvm-cbe/test/test006.c         |   24 +
 hpvm/projects/llvm-cbe/test/test007.c         |   33 +
 hpvm/projects/llvm-cbe/test/test008.c         |   29 +
 hpvm/projects/llvm-cbe/test/test009.c         |   21 +
 hpvm/projects/llvm-cbe/test/test010.c         |   43 +
 hpvm/projects/llvm-cbe/test/test011.c         |   20 +
 hpvm/projects/llvm-cbe/test/test012.c         |   20 +
 hpvm/projects/llvm-cbe/test/test013.c         |   20 +
 hpvm/projects/llvm-cbe/test/test014.c         |   20 +
 hpvm/projects/llvm-cbe/test/test015.c         |   20 +
 hpvm/projects/llvm-cbe/test/test016.c         |   23 +
 hpvm/projects/llvm-cbe/test/test017.c         |   23 +
 hpvm/projects/llvm-cbe/test/test018.c         |   21 +
 hpvm/projects/llvm-cbe/test/test019.c         |   21 +
 hpvm/projects/llvm-cbe/test/test020.c         |   25 +
 hpvm/projects/llvm-cbe/test/test021.c         |   24 +
 hpvm/projects/llvm-cbe/test/test022.c         |   25 +
 hpvm/projects/llvm-cbe/test/test023.c         |   24 +
 hpvm/projects/llvm-cbe/test/test024.c         |   24 +
 hpvm/projects/llvm-cbe/test/test025.c         |   24 +
 hpvm/projects/llvm-cbe/test/test026.c         |   25 +
 hpvm/projects/llvm-cbe/test/test027.c         |   25 +
 hpvm/projects/llvm-cbe/test/test028.c         |   26 +
 hpvm/projects/llvm-cbe/test/test029.c         |   27 +
 hpvm/projects/llvm-cbe/test/test030.c         |   27 +
 hpvm/projects/llvm-cbe/test/test031.c         |   27 +
 hpvm/projects/llvm-cbe/test/test032.c         |   27 +
 hpvm/projects/llvm-cbe/test/test033.c         |   25 +
 hpvm/projects/llvm-cbe/test/test034.c         |   25 +
 hpvm/projects/llvm-cbe/test/test035.c         |   25 +
 hpvm/projects/llvm-cbe/test/test036.c         |   25 +
 hpvm/projects/llvm-cbe/test/test037.c         |   25 +
 hpvm/projects/llvm-cbe/test/test038.c         |   26 +
 hpvm/projects/llvm-cbe/test/test039.c         |   26 +
 hpvm/projects/llvm-cbe/test/test040.c         |   26 +
 hpvm/projects/llvm-cbe/test/test041.c         |   26 +
 hpvm/projects/llvm-cbe/test/test042.c         |   25 +
 hpvm/projects/llvm-cbe/test/test043.c         |   24 +
 hpvm/projects/llvm-cbe/test/test044.c         |   23 +
 hpvm/projects/llvm-cbe/test/test045.c         |   24 +
 hpvm/projects/llvm-cbe/test/test046.c         |   24 +
 hpvm/projects/llvm-cbe/test/test047.c         |   19 +
 hpvm/projects/llvm-cbe/test/test048.c         |   22 +
 hpvm/projects/llvm-cbe/test/test049.c         |   22 +
 hpvm/projects/llvm-cbe/test/test050.c         |   22 +
 hpvm/projects/llvm-cbe/test/test051.c         |   24 +
 hpvm/projects/llvm-cbe/test/test052.c         |   23 +
 hpvm/projects/llvm-cbe/test/test053.c         |   23 +
 hpvm/projects/llvm-cbe/test/test054.c         |   22 +
 hpvm/projects/llvm-cbe/test/test055.c         |   23 +
 hpvm/projects/llvm-cbe/test/test056.c         |   22 +
 hpvm/projects/llvm-cbe/test/test057.c         |   23 +
 hpvm/projects/llvm-cbe/test/test058.c         |   23 +
 hpvm/projects/llvm-cbe/test/test059.c         |   23 +
 hpvm/projects/llvm-cbe/test/test060.c         |   22 +
 hpvm/projects/llvm-cbe/test/test061.c         |   22 +
 hpvm/projects/llvm-cbe/test/test062.c         |   23 +
 hpvm/projects/llvm-cbe/test/test063.c         |   23 +
 hpvm/projects/llvm-cbe/test/test064.c         |   23 +
 hpvm/projects/llvm-cbe/test/test065.c         |   22 +
 hpvm/projects/llvm-cbe/test/test066.c         |   23 +
 hpvm/projects/llvm-cbe/test/test067.c         |   23 +
 hpvm/projects/llvm-cbe/test/test068.c         |   23 +
 hpvm/projects/llvm-cbe/test/test069.c         |   23 +
 hpvm/projects/llvm-cbe/test/test070.c         |   22 +
 hpvm/projects/llvm-cbe/test/test071.c         |   20 +
 hpvm/projects/llvm-cbe/test/test072.c         |   25 +
 hpvm/projects/llvm-cbe/test/test073.c         |   22 +
 hpvm/projects/llvm-cbe/test/test074.c         |   25 +
 hpvm/projects/llvm-cbe/test/test075.c         |   28 +
 hpvm/projects/llvm-cbe/test/test076.c         |   22 +
 hpvm/projects/llvm-cbe/test/test077.c         |   24 +
 hpvm/projects/llvm-cbe/test/test078.c         |   23 +
 hpvm/projects/llvm-cbe/test/test079.c         |   25 +
 hpvm/projects/llvm-cbe/test/test080.c         |   24 +
 hpvm/projects/llvm-cbe/test/test081.c         |   23 +
 hpvm/projects/llvm-cbe/test/test082.c         |   25 +
 hpvm/projects/llvm-cbe/test/test083.c         |   24 +
 hpvm/projects/llvm-cbe/test/test084.c         |   28 +
 hpvm/projects/llvm-cbe/test/test085.c         |   29 +
 hpvm/projects/llvm-cbe/test/test086.c         |   28 +
 hpvm/projects/llvm-cbe/test/test087.c         |   27 +
 hpvm/projects/llvm-cbe/test/test088.c         |   25 +
 hpvm/projects/llvm-cbe/test/test089.c         |   26 +
 hpvm/projects/llvm-cbe/test/test090.c         |   25 +
 hpvm/projects/llvm-cbe/test/test091.c         |   25 +
 hpvm/projects/llvm-cbe/test/test092.c         |   35 +
 hpvm/projects/llvm-cbe/test/test093.c         |   29 +
 hpvm/projects/llvm-cbe/test/test094.c         |   29 +
 hpvm/projects/llvm-cbe/test/test095           |  Bin 0 -> 8464 bytes
 hpvm/projects/llvm-cbe/test/test095.c         |   27 +
 hpvm/projects/llvm-cbe/test/test096.c         |   24 +
 hpvm/projects/llvm-cbe/test/test097.c         |   27 +
 hpvm/projects/llvm-cbe/test/test098.c         |   28 +
 hpvm/projects/llvm-cbe/test/test099.c         |   20 +
 hpvm/projects/llvm-cbe/test/test100.c         |   30 +
 hpvm/projects/llvm-cbe/test/test101.c         |   37 +
 hpvm/projects/llvm-cbe/test/test102.c         |   23 +
 hpvm/projects/llvm-cbe/test/test103.c         |   23 +
 hpvm/projects/llvm-cbe/test/test104.c         |   24 +
 hpvm/projects/llvm-cbe/test/test105.c         |   24 +
 hpvm/projects/llvm-cbe/test/testCaseInfo.csv  |  105 +
 hpvm/projects/llvm-cbe/test/testFile.py       |   87 +
 hpvm/projects/llvm-cbe/test/testbad.c         |   17 +
 hpvm/projects/llvm-cbe/tools/CMakeLists.txt   |    2 +
 hpvm/projects/llvm-cbe/tools/Makefile         |   14 +
 .../llvm-cbe/tools/llvm-cbe/CMakeLists.txt    |   43 +
 .../llvm-cbe/tools/llvm-cbe/LLVMBuild.txt     |   38 +
 .../projects/llvm-cbe/tools/llvm-cbe/Makefile |   21 +
 .../llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp      |  363 ++
 .../llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp~     |  557 ++
 .../llvm-cbe/tools/llvm-cbe/llvm-cbe.julia    |  356 +
 .../llvm-cbe/tools/llvm-cbe/llvm-cbe.old      |  559 ++
 276 files changed, 18844 insertions(+), 611 deletions(-)
 create mode 100644 hpvm/projects/llvm-cbe/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/LICENSE
 create mode 100644 hpvm/projects/llvm-cbe/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/README.md
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeCache.txt
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCCompiler.cmake
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCXXCompiler.cmake
 create mode 100755 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_C.bin
 create mode 100755 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_CXX.bin
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeSystem.cmake
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/CMakeCCompilerId.c
 create mode 100755 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/a.out
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
 create mode 100755 hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/a.out
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/CMakeOutput.log
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/cmake.check_cache
 create mode 100755 hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.bin
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
 create mode 100644 hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
 create mode 100644 hpvm/projects/llvm-cbe/docs/index.html
 create mode 100644 hpvm/projects/llvm-cbe/include/sample.h
 create mode 100644 hpvm/projects/llvm-cbe/lib/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp~
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/lib/Target/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/test/.cdsenv
 create mode 100644 hpvm/projects/llvm-cbe/test/.cdsinit
 create mode 100644 hpvm/projects/llvm-cbe/test/.gitignore
 create mode 100644 hpvm/projects/llvm-cbe/test/.log
 create mode 100644 hpvm/projects/llvm-cbe/test/APInt-C.cpp
 create mode 100644 hpvm/projects/llvm-cbe/test/APInt-C.h
 create mode 100644 hpvm/projects/llvm-cbe/test/CBEWarningsErrors.txt
 create mode 100644 hpvm/projects/llvm-cbe/test/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/test/cds.lib
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test001.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test002.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test003.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test004.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test005.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test006.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test007.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test008.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test009.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test010.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test011.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test012.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test013.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test014.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test015.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test016.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test017.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test018.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test019.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test020.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test021.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test022.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test023.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test024.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test025.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test026.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test027.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test028.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test029.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test030.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test031.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test032.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test033.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test034.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test035.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test036.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test037.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test038.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test039.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test040.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test041.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test042.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test043.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test044.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test045.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test046.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test047.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test048.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test049.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test050.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test051.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test052.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test053.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test054.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test055.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test056.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test057.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test058.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test059.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test060.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test061.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test062.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test063.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test064.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test065.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test066.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test067.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test068.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test069.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test070.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test071.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test072.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test073.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test074.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test075.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test076.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test077.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test078.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test079.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test080.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test081.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test082.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test083.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test084.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test085.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test086.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test087.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test088.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test089.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test090.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test091.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test092.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test093.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test094.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test095.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test096.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test097.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test098.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test099.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test100.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test101.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test102.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test103.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test104.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/test105.c
 create mode 100644 hpvm/projects/llvm-cbe/test/cfiles/testbad.c
 create mode 100644 hpvm/projects/llvm-cbe/test/dtypes.h
 create mode 100644 hpvm/projects/llvm-cbe/test/platform.h
 create mode 100644 hpvm/projects/llvm-cbe/test/selectionsort/main.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test.log
 create mode 100644 hpvm/projects/llvm-cbe/test/test.sh
 create mode 100644 hpvm/projects/llvm-cbe/test/test001.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test002.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test003.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test004.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test005.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test006.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test007.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test008.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test009.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test010.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test011.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test012.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test013.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test014.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test015.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test016.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test017.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test018.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test019.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test020.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test021.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test022.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test023.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test024.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test025.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test026.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test027.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test028.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test029.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test030.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test031.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test032.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test033.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test034.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test035.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test036.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test037.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test038.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test039.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test040.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test041.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test042.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test043.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test044.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test045.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test046.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test047.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test048.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test049.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test050.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test051.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test052.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test053.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test054.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test055.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test056.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test057.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test058.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test059.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test060.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test061.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test062.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test063.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test064.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test065.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test066.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test067.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test068.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test069.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test070.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test071.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test072.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test073.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test074.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test075.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test076.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test077.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test078.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test079.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test080.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test081.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test082.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test083.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test084.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test085.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test086.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test087.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test088.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test089.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test090.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test091.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test092.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test093.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test094.c
 create mode 100755 hpvm/projects/llvm-cbe/test/test095
 create mode 100644 hpvm/projects/llvm-cbe/test/test095.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test096.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test097.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test098.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test099.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test100.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test101.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test102.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test103.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test104.c
 create mode 100644 hpvm/projects/llvm-cbe/test/test105.c
 create mode 100644 hpvm/projects/llvm-cbe/test/testCaseInfo.csv
 create mode 100755 hpvm/projects/llvm-cbe/test/testFile.py
 create mode 100644 hpvm/projects/llvm-cbe/test/testbad.c
 create mode 100644 hpvm/projects/llvm-cbe/tools/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/tools/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/CMakeLists.txt
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/LLVMBuild.txt
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/Makefile
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp~
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.julia
 create mode 100644 hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.old

diff --git a/hpvm/include/SupportVISC/VISCUtils.h b/hpvm/include/SupportVISC/VISCUtils.h
index f2c0d0d276..cfd9346792 100644
--- a/hpvm/include/SupportVISC/VISCUtils.h
+++ b/hpvm/include/SupportVISC/VISCUtils.h
@@ -198,7 +198,7 @@ void replaceNodeFunctionInIR(Module &M, Function* F, Function* G) {
 }
 
 
-// Create new function F' as a copy of old function F with a new signature.
+// Create new function F' as a copy of old function F with a new signature and input VMAP.
 // The following two most used cases are handled by this function.
 // 1. When some extra arguments need to be added to this function
 //    - Here we can map the old function arguments to
@@ -208,8 +208,8 @@ void replaceNodeFunctionInIR(Module &M, Function* F, Function* G) {
 //      over extra pointer arguments.
 // The function returns the list of return instructions to the caller to fix in
 // case the return type is also changed.
-Function* cloneFunction(Function* F, FunctionType* newFT, bool
-    isAddingPtrSizeArg, SmallVectorImpl<ReturnInst*>* Returns = NULL) {
+Function* cloneFunction(Function* F, FunctionType* newFT, 
+  bool isAddingPtrSizeArg, SmallVectorImpl<ReturnInst*>* Returns = NULL, std::vector<Argument*> *Args = NULL) {
 
   DEBUG(errs() << "Cloning Function: " << F->getName() << "\n");
   DEBUG(errs() << "Old Function Type: " << *F->getFunctionType() << "\n");
@@ -227,32 +227,62 @@ Function* cloneFunction(Function* F, FunctionType* newFT, bool
   if(isAddingPtrSizeArg) {
     DEBUG(errs() << "Case 1: Pointer arg followed by a i64 size argument in new function\n");
     Function::arg_iterator new_ai = newF->arg_begin();
-    for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
-        ai != ae; ++ai) {
-      DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
-      assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
-      VMap[&*ai] = &*new_ai;
-      new_ai->takeName(&*ai);
-      if(ai->getType()->isPointerTy()) {
-        std::string oldName = new_ai->getName();
-        // If the current argument is pointer type, the next argument in new
-        // function would be an i64 type containing the data size of this
-        // argument. Hence, skip the next arguement in new function.
+    if (Args == NULL) {
+      for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+          ai != ae; ++ai) {
+        DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+        assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+        VMap[&*ai] = &*new_ai;
+        new_ai->takeName(&*ai);
+        if(ai->getType()->isPointerTy()) {
+          std::string oldName = new_ai->getName();
+          // If the current argument is pointer type, the next argument in new
+          // function would be an i64 type containing the data size of this
+          // argument. Hence, skip the next arguement in new function.
+          ++new_ai;
+          new_ai->setName("bytes_"+oldName);
+        }
         ++new_ai;
-        new_ai->setName("bytes_"+oldName);
       }
-      ++new_ai;
+    } else {
+      DEBUG(errs() << "Arguments of original function will be read from a vector!\n");
+      for (auto *ai : *(Args)) {
+        DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+        assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+        VMap[ai] = &*new_ai;
+        new_ai->takeName(ai);
+        if(ai->getType()->isPointerTy()) {
+          std::string oldName = new_ai->getName();
+          // If the current argument is pointer type, the next argument in new
+          // function would be an i64 type containing the data size of this
+          // argument. Hence, skip the next arguement in new function.
+          ++new_ai;
+          new_ai->setName("bytes_"+oldName);
+        }
+        ++new_ai;
+      } 
     }
   }
   else {
     DEBUG(errs() << "Case 2: Extra arguments are added at the end of old function\n");
     Function::arg_iterator new_ai = newF->arg_begin();
-    for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
-        ai != ae; ++ai, ++new_ai) {
-      DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
-      assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
-      VMap[&*ai] = &*new_ai;
-      new_ai->takeName(&*ai);
+    if (Args == NULL) {
+      for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+          ai != ae; ++ai, ++new_ai) {
+        DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+        assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+        VMap[&*ai] = &*new_ai;
+        new_ai->takeName(&*ai);
+      }
+    } else {
+      DEBUG(errs() << "Arguments of original function will be read from a vector!\n");
+      for (auto *ai : *(Args)) {
+        DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+        assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+        VMap[ai] = &*new_ai;
+        new_ai->takeName(ai);
+        ++new_ai;
+      }
     }
   }
 
@@ -264,19 +294,85 @@ Function* cloneFunction(Function* F, FunctionType* newFT, bool
   return newF;
 }
 
+// Create new function F' as a copy of old function F with a new signature.
+// The following two most used cases are handled by this function.
+// 1. When some extra arguments need to be added to this function
+//    - Here we can map the old function arguments to
+//      new ones
+// 2. When each pointer argument needs an additional size argument
+//    - Here, in the absence of VMap, we map the arguments in order, skipping
+//      over extra pointer arguments.
+// The function returns the list of return instructions to the caller to fix in
+// case the return type is also changed.
+//Function* cloneFunction(Function* F, FunctionType* newFT, bool
+//    isAddingPtrSizeArg, SmallVectorImpl<ReturnInst*>* Returns = NULL) {
+//
+//  DEBUG(errs() << "Cloning Function: " << F->getName() << "\n");
+//  DEBUG(errs() << "Old Function Type: " << *F->getFunctionType() << "\n");
+//  DEBUG(errs() << "New Function Type: " << *newFT << "\n");
+//
+//  assert(F->getFunctionType()->getNumParams() <= newFT->getNumParams()
+//      && "This function assumes that the new function has more arguments than the old function!");
+//
+//  // Create Function of specified type
+//  Function* newF = Function::Create(newFT, F->getLinkage(), F->getName()+"_cloned", F->getParent());
+//  DEBUG(errs() << "Old Function name: " << F->getName() << "\n");
+//  DEBUG(errs() << "New Function name: " << newF->getName() << "\n");
+//  ValueToValueMapTy VMap;
+//  DEBUG(errs() << "No value map provided. Creating default value map\n");
+//  if(isAddingPtrSizeArg) {
+//    DEBUG(errs() << "Case 1: Pointer arg followed by a i64 size argument in new function\n");
+//    Function::arg_iterator new_ai = newF->arg_begin();
+//    for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+//        ai != ae; ++ai) {
+//      DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+//      assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+//      VMap[&*ai] = &*new_ai;
+//      new_ai->takeName(&*ai);
+//      if(ai->getType()->isPointerTy()) {
+//        std::string oldName = new_ai->getName();
+//        // If the current argument is pointer type, the next argument in new
+//        // function would be an i64 type containing the data size of this
+//        // argument. Hence, skip the next arguement in new function.
+//        ++new_ai;
+//        new_ai->setName("bytes_"+oldName);
+//      }
+//      ++new_ai;
+//    }
+//  }
+//  else {
+//    DEBUG(errs() << "Case 2: Extra arguments are added at the end of old function\n");
+//    Function::arg_iterator new_ai = newF->arg_begin();
+//    for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+//        ai != ae; ++ai, ++new_ai) {
+//      DEBUG(errs() << ai->getArgNo() << ". " << *ai << " : " << *new_ai << "\n");
+//      assert(ai->getType() == new_ai->getType() && "Arguments type do not match!");
+//      VMap[&*ai] = &*new_ai;
+//      new_ai->takeName(&*ai);
+//    }
+//  }
+//
+//  // Clone function
+//  if (Returns == NULL)
+//    Returns = new SmallVector<ReturnInst*, 8>();
+//  CloneFunctionInto(newF, F, VMap, false, *Returns);
+//
+//  return newF;
+//}
+
 // Overloaded version of cloneFunction
 Function *cloneFunction(Function *F, Function *newF,
-			bool isAddingPtrSizeArg,
-                        SmallVectorImpl<ReturnInst *> *Returns = NULL) {
+    bool isAddingPtrSizeArg,
+    SmallVectorImpl<ReturnInst *> *Returns = NULL) {
 
   DEBUG(errs() << "Cloning Function: " << F->getName() << "\n");
   DEBUG(errs() << "Old Function Type: " << *F->getFunctionType() << "\n");
   DEBUG(errs() << "New Function Type: " << *newF->getFunctionType() << "\n");
 
   assert(F->getFunctionType()->getNumParams() <=
-         newF->getFunctionType()->getNumParams() &&
-         "This function assumes that the new function has more arguments than "
-         "the old function!");
+      newF->getFunctionType()->getNumParams() &&
+      "This function assumes that the new function has more arguments than "
+      "the old function!");
 
   // Create Function of specified type
   DEBUG(errs() << "Old Function name: " << F->getName() << "\n");
@@ -324,8 +420,8 @@ Function *cloneFunction(Function *F, Function *newF,
 }
 
 
- //------------------- Helper Functions For Handling Hints -------------------//
-  
+//------------------- Helper Functions For Handling Hints -------------------//
+
 // Return true if 1st arg (tag) contains 2nd (target)
 bool tagIncludesTarget(visc::Target Tag, visc::Target T) {
   switch (Tag) {
@@ -370,27 +466,27 @@ bool tagIncludesTarget(visc::Target Tag, visc::Target T) {
 
 bool isSingleTargetTag(visc::Target T) {
   return ((T == visc::CPU_TARGET)    ||
-          (T == visc::GPU_TARGET)    ||
-          (T == visc::SPIR_TARGET)   ||
-          (T == visc::CUDNN_TARGET)  ||
-          (T == visc::PROMISE_TARGET));
+      (T == visc::GPU_TARGET)    ||
+      (T == visc::SPIR_TARGET)   ||
+      (T == visc::CUDNN_TARGET)  ||
+      (T == visc::PROMISE_TARGET));
 }
 
 // Add the specified target to the given tag
 visc::Target getUpdatedTag(visc::Target Tag, visc::Target T) {
   assert(((T == visc::CPU_TARGET)    ||
-          (T == visc::GPU_TARGET)    ||
-          (T == visc::SPIR_TARGET)   ||
-          (T == visc::CUDNN_TARGET)  ||
-          (T == visc::PROMISE_TARGET)) &&
-         "The target is only allowed to be a single target: CPU, GPU, SPIR, CUDNN, PROMISE\n");
+        (T == visc::GPU_TARGET)    ||
+        (T == visc::SPIR_TARGET)   ||
+        (T == visc::CUDNN_TARGET)  ||
+        (T == visc::PROMISE_TARGET)) &&
+      "The target is only allowed to be a single target: CPU, GPU, SPIR, CUDNN, PROMISE\n");
 
   switch (Tag) {
     case visc::None:
       return T;
     case visc::CPU_TARGET:
       assert((T != visc::CUDNN_TARGET) && (T != visc::PROMISE_TARGET) &&
-             "Unsupported target combination\n");
+          "Unsupported target combination\n");
       if (T == visc::CPU_TARGET)
         return visc::CPU_TARGET;
       if (T == visc::GPU_TARGET)
@@ -401,7 +497,7 @@ visc::Target getUpdatedTag(visc::Target Tag, visc::Target T) {
     case visc::GPU_TARGET:
       assert((T != visc::SPIR_TARGET) && "Unsupported target combination\n");
       assert((T != visc::CUDNN_TARGET) && (T != visc::PROMISE_TARGET) &&
-             "Unsupported target combination\n");
+          "Unsupported target combination\n");
       if (T == visc::CPU_TARGET)
         return visc::CPU_OR_GPU_TARGET;
       if (T == visc::GPU_TARGET)
@@ -410,7 +506,7 @@ visc::Target getUpdatedTag(visc::Target Tag, visc::Target T) {
     case visc::SPIR_TARGET:
       assert((T != visc::GPU_TARGET) && "Unsupported target combination\n");
       assert((T != visc::CUDNN_TARGET) && (T != visc::PROMISE_TARGET) &&
-             "Unsupported target combination\n");
+          "Unsupported target combination\n");
       if (T == visc::CPU_TARGET)
         return visc::CPU_OR_SPIR_TARGET;
       if (T == visc::SPIR_TARGET)
@@ -418,12 +514,12 @@ visc::Target getUpdatedTag(visc::Target Tag, visc::Target T) {
       return T;
     case visc::CPU_OR_GPU_TARGET:
       assert((T != visc::CUDNN_TARGET) && (T != visc::PROMISE_TARGET) &&
-             "Unsupported target combination\n");
+          "Unsupported target combination\n");
       assert((T != visc::SPIR_TARGET) && "Unsupported target combination\n");
       return visc::CPU_OR_GPU_TARGET;
     case visc::CPU_OR_SPIR_TARGET:
       assert((T != visc::CUDNN_TARGET) && (T != visc::PROMISE_TARGET) &&
-             "Unsupported target combination\n");
+          "Unsupported target combination\n");
       assert((T != visc::GPU_TARGET) && "Unsupported target combination\n");
       return visc::CPU_OR_SPIR_TARGET;
     default:
@@ -434,10 +530,10 @@ visc::Target getUpdatedTag(visc::Target Tag, visc::Target T) {
 
 // This functions add the hint as metadata in visc code
 void addHint(Function* F, visc::Target T) {
-   // Get Module
+  // Get Module
   Module* M = F->getParent();
   DEBUG(errs() << "Set preferred target for " << F->getName() << ": ");
- 
+
   // Based on the hint, get the hint metadata
   NamedMDNode* HintNode;
   switch (T) {
@@ -516,7 +612,7 @@ void removeHint(Function* F, visc::Target T) {
 
   // Gather metadata nodes, and keep those not associated with this function
   MDNode* N = MDNode::get(M->getContext(),
-                          ArrayRef<Metadata*>(ValueAsMetadata::get(F)));
+      ArrayRef<Metadata*>(ValueAsMetadata::get(F)));
   std::vector<MDNode*> MDNodes;
 
   for (unsigned i = 0; i < HintNode->getNumOperands(); i++) {
@@ -538,18 +634,18 @@ void removeHint(Function* F, visc::Target T) {
 visc::Target getPreferredTarget(Function* F) {
   DEBUG(errs() << "Finding preferred target for " << F->getName() << "\n");
   Module* M = F->getParent();
-  
+
   auto FoundPrefTarget = [=](StringRef Name) {
-    	NamedMDNode* HintNode = M->getOrInsertNamedMetadata(Name);
-  	for(unsigned i = 0; i < HintNode->getNumOperands(); i++) {
-    	  MDNode* N = HintNode->getOperand(i);
-    	  Value* FHint = dyn_cast<ValueAsMetadata>(N->getOperand(0).get())->getValue();
-    	  if(F == FHint)
-      	    return true;
-  	}
-        return false;	
+    NamedMDNode* HintNode = M->getOrInsertNamedMetadata(Name);
+    for(unsigned i = 0; i < HintNode->getNumOperands(); i++) {
+      MDNode* N = HintNode->getOperand(i);
+      Value* FHint = dyn_cast<ValueAsMetadata>(N->getOperand(0).get())->getValue();
+      if(F == FHint)
+        return true;
+    }
+    return false;	
   };
-  
+
   if(FoundPrefTarget("visc_hint_cpu")) return visc::CPU_TARGET;
   if(FoundPrefTarget("visc_hint_gpu")) return visc::GPU_TARGET;
   if(FoundPrefTarget("visc_hint_spir")) return visc::SPIR_TARGET;
diff --git a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
index 642202bf05..c85a8a4f2d 100644
--- a/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
+++ b/hpvm/lib/Transforms/DFG2LLVM_NVPTX/DFG2LLVM_NVPTX.cpp
@@ -1130,7 +1130,7 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
   // constant memory, subject to size of course
   std::vector<unsigned> ConstantMemArgs = globalToConstantMemoryOpt(&GlobalMemArgs, F_nvptx);
 
-  F_nvptx = changeArgAddrspace(F_nvptx, ConstantMemArgs, CONSTANT_ADDRSPACE);
+  F_nvptx = changeArgAddrspace(F_nvptx, ConstantMemArgs, GLOBAL_ADDRSPACE);
   F_nvptx = changeArgAddrspace(F_nvptx, SharedMemArgs, SHARED_ADDRSPACE);
   F_nvptx = changeArgAddrspace(F_nvptx, GlobalMemArgs, GLOBAL_ADDRSPACE);
 
@@ -1416,350 +1416,720 @@ void CGT_NVPTX::codeGen(DFLeafNode* N) {
       default:
         llvm_unreachable("Unknown VISC Intrinsic!");
         break;
-      }
+			}
+
+		}
+		else if(MemCpyInst *MemCpyI = dyn_cast<MemCpyInst>(I)) {
+			IRBuilder<> Builder(I);
+			Value *Source = MemCpyI->getSource();
+			Value *Destination = MemCpyI->getArgOperand(0)->stripPointerCasts();
+			Value *Length = MemCpyI->getOperand(2);
+			DEBUG(errs() << "Found memcpy instruction: " << *I << "\n");
+			DEBUG(errs() << "Source: " << *Source << "\n"); 
+			DEBUG(errs() << "Destination: " << *Destination << "\n"); 
+			DEBUG(errs() << "Length: " << *Length << "\n");
+
+			size_t memcpy_length;
+			unsigned int memcpy_count;
+			if (ConstantInt* CI = dyn_cast<ConstantInt>(Length)) {
+				if (CI->getBitWidth() <= 64) {
+					memcpy_length = CI->getSExtValue();
+					DEBUG(errs() << "Memcpy lenght = " << memcpy_length << "\n");
+					Type *Source_Type = Source->getType()->getPointerElementType();
+					DEBUG(errs() << "Source Type : " << *Source_Type << "\n");
+					memcpy_count = memcpy_length / (Source_Type->getPrimitiveSizeInBits() / 8);
+					DEBUG(errs() << "Memcpy count = " << memcpy_count << "\n");
+					if (GetElementPtrInst *sourceGEPI = dyn_cast<GetElementPtrInst>(Source)) {
+						if (GetElementPtrInst *destGEPI = dyn_cast<GetElementPtrInst>(Destination)) {
+							Value *SourcePtrOperand = sourceGEPI->getPointerOperand();
+							Value *DestPtrOperand = destGEPI->getPointerOperand();
+							for(int i = 0; i < memcpy_count; ++i) {
+								Constant *increment;
+								LoadInst *newLoadI;
+								StoreInst *newStoreI;
+								// First, need to increment the correct index for both source and dest 
+								// This invluves checking to see how many indeces the GEP has
+								// Assume for now only 1 or 2 are the viable options.
+
+								std::vector<Value*> GEPlIndex;
+								if (sourceGEPI->getNumIndices() == 1) {
+									Value *Index = sourceGEPI->getOperand(1);      
+									increment = ConstantInt::get(Index->getType(), i, false);
+									Value *incAdd = Builder.CreateAdd(Index, increment);
+									DEBUG(errs() << "Add: " << *incAdd << "\n");
+									GEPlIndex.push_back(incAdd);
+									Value *newGEPIl = Builder.CreateGEP(SourcePtrOperand, ArrayRef<Value*>(GEPlIndex));
+									DEBUG(errs() << "Load GEP: " << *newGEPIl << "\n");
+									newLoadI = Builder.CreateLoad(newGEPIl);
+									DEBUG(errs() << "Load: " << *newLoadI << "\n");
+								} else { 
+									llvm_unreachable("Unhandled case where source GEPI has more than 1 indices!\n");
+								}
+
+
+								std::vector<Value*> GEPsIndex;
+								if (destGEPI->getNumIndices() == 1) {
+
+								} else if (destGEPI->getNumIndices() == 2) {
+									Value *Index0 = destGEPI->getOperand(1);      
+									GEPsIndex.push_back(Index0);
+									Value *Index1 = destGEPI->getOperand(2);      
+									increment = ConstantInt::get(Index1->getType(), i, false);
+									Value *incAdd = Builder.CreateAdd(Index1, increment);
+									DEBUG(errs() << "Add: " << *incAdd << "\n");
+									GEPsIndex.push_back(incAdd);
+									Value *newGEPIs = Builder.CreateGEP(DestPtrOperand, ArrayRef<Value*>(GEPsIndex));
+									DEBUG(errs() << "Store GEP: " << *newGEPIs << "\n");
+									newStoreI = Builder.CreateStore(newLoadI, newGEPIs, MemCpyI->isVolatile());
+									DEBUG(errs() << "Store: " << *newStoreI << "\n");
+								} else {
+									llvm_unreachable("Unhandled case where dest GEPI has more than 2 indices!\n");
+								}
+							}
+							IItoRemove.push_back(sourceGEPI);
+							IItoRemove.push_back(destGEPI);
+							Instruction *destBitcastI = dyn_cast<Instruction>(MemCpyI->getArgOperand(0));
+							Instruction *sourceBitcastI = dyn_cast<Instruction>(MemCpyI->getArgOperand(1));
+							IItoRemove.push_back(destBitcastI);
+							IItoRemove.push_back(sourceBitcastI);
+							IItoRemove.push_back(MemCpyI);
+						}
+					}
+
+				}
+			} else {
+				llvm_unreachable("MEMCPY length is not a constant, not handled!\n");
+			}
+			//      llvm_unreachable("HERE!");
+		}
+
+		else if(CallInst* CI = dyn_cast<CallInst>(I)) {
+			DEBUG(errs() << "Found a call: " << *CI << "\n");
+			Function* calleeF = cast<Function>(CI->getCalledValue()->stripPointerCasts());
+			if(calleeF->isDeclaration()) {
+				// Add the declaration to kernel module
+				DEBUG(errs() << "Adding declaration to Kernel module: " << *calleeF << "\n");
+				KernelM->getOrInsertFunction(calleeF->getName(), calleeF->getFunctionType());
+				if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(CI)) {
+					// Now handle a few specific intrinsics
+					// For now, sin and cos are translated to their libclc equivalent
+					switch(II->getIntrinsicID()) {
+						case Intrinsic::sin:
+						case Intrinsic::cos:
+							{
+								DEBUG(errs() << "Found sincos: " << *II << "\n");
+								// Get the libclc function
+								// libclc uses mangled name for sin cos
+								assert(II->getType()->isFloatTy()
+										&& "Only handling sin(float) and cos(float)!");
+								std::string name;
+								if(II->getIntrinsicID() == Intrinsic::sin)
+									name = "sin";
+								else
+									name = "cos";
+
+								FunctionType* SinCosFT = FunctionType::get(II->getType(),
+										Type::getFloatTy(KernelM->getContext()),
+										false);
+								FunctionCallee LibclcFunction = KernelM->getOrInsertFunction(name, SinCosFT);
+								CallInst* CI = CallInst::Create(LibclcFunction, II->getArgOperand(0), II->getName(), II);
+
+								II->replaceAllUsesWith(CI);
+								IItoRemove.push_back(II);
+								break;
+							}
+						case Intrinsic::floor:
+							{
+								DEBUG(errs() << "Found floor intrinsic\n");
+								F = Intrinsic::getDeclaration(KernelM.get(), Intrinsic::nvvm_floor_f);
+								FunctionType* FTy = F->getFunctionType();
+								DEBUG(errs() << *F << "\n");
+
+								// Create argument list
+								std::vector<Value*> args;
+								assert(CI->getNumArgOperands() == FTy->getNumParams()
+										&& "Number of arguments of call do not match with Intrinsic");
+								for(unsigned i=0; i < CI->getNumArgOperands(); i++) {
+									Value* V = CI->getArgOperand(i);
+									// Either the type should match or both should be of pointer type
+									assert((V->getType() == FTy->getParamType(i) ||
+												(V->getType()->isPointerTy() && FTy->getParamType(i)->isPointerTy()))
+											&& "Dummy function call argument does not match with Intrinsic argument!");
+									// If the types do not match, then both must be pointer type and pointer
+									// cast needs to be performed
+									if(V->getType() != FTy->getParamType(i)) {
+										V = CastInst::CreatePointerCast(V, FTy->getParamType(i), "", CI);
+									}
+									args.push_back(V);
+								}
+								// Insert call instruction
+								CallInst* Inst = CallInst::Create(F, args,
+										F->getReturnType()->isVoidTy()? "" : CI->getName(), CI);
+								DEBUG(errs() << "\tSubstitute with: " << *Inst << "\n");
+								CI->replaceAllUsesWith(Inst);
+								IItoRemove.push_back(II);
+								break;
+							}
+						default:
+							errs() << "[WARNING] Found Intrinsic: " << *II << "\n" ;
+					}
+				}
+
+			}
+			else {
+				// Check if the called function has already been cloned before.
+				Function *NewFunc = CloneAndReplaceCall(CI, calleeF);
+				// Iterate over the new function to see if it calls any other functions
+				// in the module.
+				for(inst_iterator i = inst_begin(NewFunc), e = inst_end(NewFunc); i != e; ++i) {
+					if(auto *Call = dyn_cast<CallInst>(&*i)) {
+						Function *CalledFunc = cast<Function>(Call->getCalledValue()->stripPointerCasts());
+						CloneAndReplaceCall(Call, CalledFunc);
+					}
+				}
+			}
+			//TODO: how to handle address space qualifiers in load/store
+		}
+
+	}
+  // search for pattern where float is being casted to int and loaded/stored and change it.	
+  DEBUG(errs() << "finding pattern for replacement!\n");
+  for (inst_iterator i = inst_begin(F_nvptx), e = inst_end(F_nvptx); i != e; ++i) {
+    bool cont = false;
+    bool keepGEPI = false;
+    bool keepGEPI2= false;
+    Instruction *I = &(*i);
+    GetElementPtrInst* GEPI = dyn_cast<GetElementPtrInst>(I);
 
+    if (!GEPI) {
+      // did nod find pattern start, continue
+      continue;
+    }
+    // may have found pattern, check
+    DEBUG(errs() << "GEPI " << *GEPI << "\n");
+    // print whatever we want for debug
+    Value* PtrOp = GEPI->getPointerOperand();
+    Type *SrcTy = GEPI->getSourceElementType();
+    unsigned GEPIaddrspace = GEPI->getAddressSpace();
+
+    if (SrcTy->isArrayTy()) 
+      DEBUG(errs() << *SrcTy << " is an array type! " << *(SrcTy->getArrayElementType()) << "\n");
+    else
+      DEBUG(errs() << *SrcTy << " is not an array type!\n");
+    // check that source element type is float
+    if (SrcTy->isArrayTy()) {
+      if (!(SrcTy->getArrayElementType()->isFloatTy())) {
+        DEBUG(errs() << "GEPI type is array but not float!\n");
+        continue;
+      }
+    }
+    else if (!(SrcTy->isFPOrFPVectorTy()/*isFloatTy()*/)) {
+      DEBUG(errs() << "GEPI type is " << *SrcTy << "\n");
+      // does not fit this pattern - no float GEP instruction
+      continue;
+    }
+    // check that addressspace is 1
+    //	  if (GEPIaddrspace != 1) {
+    //			// does not fit this pattern - addrspace of pointer argument is not global
+    //			continue;
+    //		}
+    if (!(GEPI->hasOneUse())) {
+      // does not fit this pattern - more than one uses
+      //continue;
+      // Keep GEPI around if it has other uses
+      keepGEPI = true;
     }
-    else if(CallInst* CI = dyn_cast<CallInst>(I)) {
-      DEBUG(errs() << "Found a call: " << *CI << "\n");
-      Function* calleeF = cast<Function>(CI->getCalledValue()->stripPointerCasts());
-      if(calleeF->isDeclaration()) {
-        // Add the declaration to kernel module
-        DEBUG(errs() << "Adding declaration to Kernel module: " << *calleeF << "\n");
-        KernelM->getOrInsertFunction(calleeF->getName(), calleeF->getFunctionType());
-        if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(CI)) {
-          // Now handle a few specific intrinsics
-          // For now, sin and cos are translated to their libclc equivalent
-          switch(II->getIntrinsicID()) {
-          case Intrinsic::sin:
-          case Intrinsic::cos:
-          {
-            DEBUG(errs() << "Found sincos: " << *II << "\n");
-            // Get the libclc function
-            // libclc uses mangled name for sin cos
-            assert(II->getType()->isFloatTy()
-                   && "Only handling sin(float) and cos(float)!");
-            std::string name;
-            if(II->getIntrinsicID() == Intrinsic::sin)
-              name = "sin";
-            else
-              name = "cos";
-
-            FunctionType* SinCosFT = FunctionType::get(II->getType(),
-                                     Type::getFloatTy(KernelM->getContext()),
-                                     false);
-            FunctionCallee LibclcFunction = KernelM->getOrInsertFunction(name, SinCosFT);
-            CallInst* CI = CallInst::Create(LibclcFunction, II->getArgOperand(0), II->getName(), II);
-
-            II->replaceAllUsesWith(CI);
-            IItoRemove.push_back(II);
-            break;
-          }
-          case Intrinsic::floor:
-          {
-            DEBUG(errs() << "Found floor intrinsic\n");
-            F = Intrinsic::getDeclaration(KernelM.get(), Intrinsic::nvvm_floor_f);
-            FunctionType* FTy = F->getFunctionType();
-            DEBUG(errs() << *F << "\n");
-
-            // Create argument list
-            std::vector<Value*> args;
-            assert(CI->getNumArgOperands() == FTy->getNumParams()
-                   && "Number of arguments of call do not match with Intrinsic");
-            for(unsigned i=0; i < CI->getNumArgOperands(); i++) {
-              Value* V = CI->getArgOperand(i);
-              // Either the type should match or both should be of pointer type
-              assert((V->getType() == FTy->getParamType(i) ||
-                     (V->getType()->isPointerTy() && FTy->getParamType(i)->isPointerTy()))
-                     && "Dummy function call argument does not match with Intrinsic argument!");
-              // If the types do not match, then both must be pointer type and pointer
-              // cast needs to be performed
-              if(V->getType() != FTy->getParamType(i)) {
-                V = CastInst::CreatePointerCast(V, FTy->getParamType(i), "", CI);
-              }
-              args.push_back(V);
-            }
-            // Insert call instruction
-            CallInst* Inst = CallInst::Create(F, args,
-                  F->getReturnType()->isVoidTy()? "" : CI->getName(), CI);
-            DEBUG(errs() << "\tSubstitute with: " << *Inst << "\n");
-            CI->replaceAllUsesWith(Inst);
-            IItoRemove.push_back(II);
-            break;
-          }
-          default:
-            errs() << "[WARNING] Found Intrinsic: " << *II << "\n" ;
-          }
+    DEBUG(errs() << "Found GEPI " << *GEPI << "\n");
+
+    // 1st GEPI it has one use
+    //		assert(GEPI->hasOneUse() && "GEPI has a single use");
+
+    // See if it is a bitcast
+    BitCastInst *BitCastI;
+    for (User * U : GEPI->users()) {
+      if(Instruction *ui = dyn_cast<Instruction> (U)) { 
+        DEBUG(errs() << "--" << *ui << "\n");
+        if (isa<BitCastInst>(ui)) {
+          BitCastI = dyn_cast<BitCastInst>(ui);
+          DEBUG(errs() << "---Found bitcast as only use of GEP\n");
+          break;
         }
-
       }
-      else {
-      // Check if the called function has already been cloned before.
-        Function *NewFunc = CloneAndReplaceCall(CI, calleeF);
-        // Iterate over the new function to see if it calls any other functions
-        // in the module.
-        for(inst_iterator i = inst_begin(NewFunc), e = inst_end(NewFunc); i != e; ++i) {
-          if(auto *Call = dyn_cast<CallInst>(&*i)) {
-            Function *CalledFunc = cast<Function>(Call->getCalledValue()->stripPointerCasts());
-            CloneAndReplaceCall(Call, CalledFunc);
-          }
+      DEBUG(errs() << "GEPI does not have a bitcast user, continue\n");
+      cont = true;
+    }
+    //		for (Value::user_iterator ui = GEPI->user_begin(),
+    //				ue = GEPI->user_end(); ui!=ue; ++ui) {
+    //        DEBUG(errs() << "--" << *ui << "\n");
+    //			if (isa<BitCastInst>(*ui)) {
+    //				BitCastI = dyn_cast<BitCastInst>(*ui);
+    //        DEBUG(errs() << "Found bitcast as only use of GEP\n");
+    //			}
+    //		}
+
+    if (cont/*!BitCastI*/) {
+      continue; // not in pattern
+    }
+
+    //    DEBUG(errs() << *BitCastI << "\n");
+    // Otherwise, check that first operand is GEP and 2nd is i32*. 1st Operand has to be the GEP, since this is a use of the GEP.
+    Value *Op2 = BitCastI->getOperand(0);
+    DEBUG(errs() << "----" << *Op2 << "\n");
+    //		assert(cast<Type>(Op2) && "Invalid Operand for Bitcast\n");
+    //		Type *OpTy = cast<Type>(Op2);
+    Type *OpTy = BitCastI->getDestTy();
+    DEBUG(errs() << "---- Bitcast destination type: " << *OpTy << "\n");
+    //    DEBUG(errs() << "---- " << *(Type::getInt32PtrTy(M.getContext(),1)) << "\n");
+    if (!(OpTy == Type::getInt32PtrTy(M.getContext(), GEPIaddrspace))) {
+      // maybe right syntax is (Type::getInt32Ty)->getPointerTo()
+      continue; // not in pattern
+    }
+
+    DEBUG(errs() << "----Here!\n");
+    // We are in GEP, bitcast.
+
+    // user_iterator, to find the load.
+
+    if (!(BitCastI->hasOneUse())) {
+      // does not fit this pattern - more than one uses
+      continue;
+    }
+    DEBUG(errs() << "----Bitcast has one use!\n");
+    // it has one use
+    assert(BitCastI->hasOneUse() && "BitCastI has a single use");
+    LoadInst *LoadI;
+    for (User * U : BitCastI->users()) { 
+      if (Instruction *ui = dyn_cast<Instruction> (U)) {
+        DEBUG(errs() << "-----" << *ui << "\n");
+        if (isa<LoadInst>(ui)) {
+          LoadI = dyn_cast<LoadInst>(ui);
+          DEBUG(errs() << "-----Found load as only use of bitcast\n");
+          break;
         }
       }
-      //TODO: how to handle address space qualifiers in load/store
+      DEBUG(errs() << "Bitcast does not have a load user, continue!\n");
+      cont = true;
+    }
+    //		for (Value::user_iterator ui = BitCastI->user_begin(),
+    //				ue = BitCastI->user_end(); ui!=ue; ++ui) {
+    //			if (isa<LoadInst>(*ui)) {
+    //				LoadI = dyn_cast<LoadInst>(*ui);
+    //        errs() << "Found load as only use of bitcast\n";
+    //			}
+    //		}
+
+    if (cont) {
+      continue; // not in pattern
     }
 
-  }
+    DEBUG("HERE!\n");
+    // check that we load from pointer we got from bitcast - assert - the unique argument must be the use we found it from
+    assert(LoadI->getPointerOperand() == BitCastI && "Unexpected Load Instruction Operand\n");
 
-  // We need to do this explicitly: DCE pass will not remove them because we
-  // have assumed theworst memory behaviour for these function calls
-  // Traverse the vector backwards, otherwise definitions are deleted while
-  // their subsequent uses are still around
-  for (auto *I : IItoRemove) {
-    DEBUG(errs() << "Erasing: " << *I << "\n");
-    I->eraseFromParent();
-  }
+    // Copy user_iterator, to find the store.
 
- // Removed the cloned functions from the parent module into the new module 
-  for(auto *F : FuncToBeRemoved) {
-    F->removeFromParent(); //TODO: MARIA check
-    KernelM->getFunctionList().push_back(F);
-  }
+    if (!(LoadI->hasOneUse())) {
+      // does not fit this pattern - more than one uses
+      continue;
+      // TODO: generalize: one load can have more than one store users
+    }
+
+    // it has one use
+    assert(LoadI->hasOneUse() && "LoadI has a single use");
+    Value::user_iterator ui = LoadI->user_begin();
+    // skipped loop, because is has a single use
+    StoreInst *StoreI = dyn_cast<StoreInst>(*ui);
+    if (!StoreI) {
+      continue; // not in pattern
+    }
+
+    // Also check that the store uses the loaded value as the value operand
+    if (StoreI->getValueOperand() != LoadI) {
+      continue;
+    }
 
-  addCLMetadata(F_nvptx);
-  kernel->KernelFunction = F_nvptx;
-  errs() << "Identified kernel - " << kernel->KernelFunction->getName() << "\n";
-  DEBUG(errs() << *KernelM);
+    DEBUG(errs() << "-------Found store instruction\n");
+
+    // Look for its bitcast, which is its pointer operand
+    Value *StPtrOp = StoreI->getPointerOperand();
+    DEBUG(errs() << "-------" << *StPtrOp << "\n");
+    BitCastInst *BitCastI2 = dyn_cast<BitCastInst>(StPtrOp);
+    DEBUG(errs() << "-------" << *BitCastI2 << "\n");
+    if (!BitCastI2) {
+      continue; //not in pattern
+    }
 
-  return;
+    DEBUG(errs() << "-------- Found Bit Cast of store!\n" );
+    // found bitcast. Look for the second GEP, its from operand.
+    Value *BCFromOp = BitCastI2->getOperand(0);
+    GetElementPtrInst *GEPI2 = dyn_cast<GetElementPtrInst>(BCFromOp);
+    DEBUG(errs() << "---------- " << *GEPI2 << "\n");
+    if (!GEPI2) {
+      continue; //not in pattern
+    }
+
+    if (!(GEPI2->hasOneUse())) {
+      // does not fit this pattern - more than one uses
+      //continue;
+      // Keep GEPI around if it has other uses
+      keepGEPI2 = true;
+    }
+    DEBUG(errs() << "---------- Found GEPI of Bitcast!\n"); 
+
+    Value *PtrOp2 = GEPI2->getPointerOperand();
+
+    // Found GEPI2. TODO: kind of confused as o what checks I need to add here, let's add them together- all the code for int-float type checks is already above.
+
+    // Assume we found pattern
+    if (!keepGEPI) {  
+      IItoRemove.push_back(GEPI);
+      DEBUG(errs() << "Pushing " << *GEPI << " for removal\n");
+    } else {
+      DEBUG(errs() << "Keeping " << *GEPI << " since it has multiple uses!\n");
+    }
+    IItoRemove.push_back(BitCastI);
+    DEBUG(errs() << "Pushing " << *BitCastI << " for removal\n");
+    IItoRemove.push_back(LoadI);
+    DEBUG(errs() << "Pushing " << *LoadI << " for removal\n");
+    IItoRemove.push_back(GEPI2);
+    DEBUG(errs() << "Pushing " << *GEPI2 << " for removal\n");
+    IItoRemove.push_back(BitCastI2);
+    DEBUG(errs() << "Pushing " << *BitCastI2 << " for removal\n");
+    if (!keepGEPI2) {
+      IItoRemove.push_back(StoreI);
+      DEBUG(errs() << "Pushing " << *StoreI << " for removal\n");
+    } else {
+
+      DEBUG(errs() << "Keeping " << *StoreI << " since it has multiple uses!\n");
+    }
+
+    std::vector<Value*> GEPlIndex;
+    if (GEPI->hasIndices()) {
+      for(auto ii = GEPI->idx_begin(); ii != GEPI->idx_end(); ++ii) {
+        Value *Index = dyn_cast<Value>(&*ii);
+        DEBUG(errs() << "GEP-1 Index: " << *Index << "\n");
+        GEPlIndex.push_back(Index);
+      }
+    }
+    //    ArrayRef<Value*> GEPlArrayRef(GEPlIndex);
+
+    std::vector<Value*> GEPsIndex;
+    if (GEPI2->hasIndices()) {
+      for(auto ii = GEPI2->idx_begin(); ii != GEPI2->idx_end(); ++ii) {
+        Value *Index = dyn_cast<Value>(&*ii);
+        DEBUG(errs() << "GEP-2 Index: " << *Index << "\n");
+        GEPsIndex.push_back(Index);
+      }
+    }
+    //    ArrayRef<Value*> GEPsArrayRef(GEPlIndex);
+
+
+
+    //    ArrayRef<Value*>(GEPI->idx_begin(), GEPI->idx_end());
+    GetElementPtrInst* newlGEP =
+      GetElementPtrInst::Create(GEPI->getSourceElementType(), //Type::getFloatTy(M.getContext()),
+          PtrOp, // operand from 1st GEP
+          ArrayRef<Value*>(GEPlIndex),
+          Twine(),
+          StoreI);
+    DEBUG(errs() << "Adding: " << *newlGEP << "\n");
+    // insert load before GEPI
+    LoadInst *newLoadI =
+      new LoadInst(Type::getFloatTy(M.getContext()),
+          newlGEP, // new GEP
+          Twine(),
+          LoadI->isVolatile(),
+          LoadI->getAlignment(),
+          LoadI->getOrdering(),
+          LoadI->getSyncScopeID(),
+          StoreI);
+    DEBUG(errs() << "Adding: " << *newLoadI << "\n");
+    // same for GEP for store, for store operand
+    GetElementPtrInst* newsGEP =
+      GetElementPtrInst::Create(GEPI2->getSourceElementType(), // Type::getFloatTy(M.getContext()),
+          PtrOp2, // operand from 2nd GEP
+          ArrayRef<Value*>(GEPsIndex),
+          Twine(),
+          StoreI);
+    DEBUG(errs() << "Adding: " << *newsGEP << "\n");
+    // insert store before GEPI
+    StoreInst *newStoreI =
+      new StoreInst(newLoadI,
+          newsGEP, // new GEP
+          StoreI->isVolatile(),
+          StoreI->getAlignment(),
+          StoreI->getOrdering(),
+          StoreI->getSyncScopeID(),
+          StoreI);
+    DEBUG(errs() << "Adding: " << *newStoreI << "\n");
+
+  }
+
+	// We need to do this explicitly: DCE pass will not remove them because we
+	// have assumed theworst memory behaviour for these function calls
+	// Traverse the vector backwards, otherwise definitions are deleted while
+	// their subsequent uses are still around
+	for (auto *I : reverse(IItoRemove)) {
+		DEBUG(errs() << "Erasing: " << *I << "\n");
+		I->eraseFromParent();
+	}
+
+	// Removed the cloned functions from the parent module into the new module 
+	for(auto *F : FuncToBeRemoved) {
+		F->removeFromParent(); //TODO: MARIA check
+		KernelM->getFunctionList().push_back(F);
+	}
+
+	addCLMetadata(F_nvptx);
+	kernel->KernelFunction = F_nvptx;
+	errs() << "Identified kernel - " << kernel->KernelFunction->getName() << "\n";
+	DEBUG(errs() << *KernelM);
+
+	return;
 }
 
 bool DFG2LLVM_NVPTX::runOnModule(Module &M) {
-  errs() << "\nDFG2LLVM_NVPTX PASS\n";
+	errs() << "\nDFG2LLVM_NVPTX PASS\n";
 
-  // Get the BuildDFG Analysis Results:
-  // - Dataflow graph
-  // - Maps from i8* hansles to DFNode and DFEdge
-  BuildDFG &DFG = getAnalysis<BuildDFG>();
+	// Get the BuildDFG Analysis Results:
+	// - Dataflow graph
+	// - Maps from i8* hansles to DFNode and DFEdge
+	BuildDFG &DFG = getAnalysis<BuildDFG>();
 
-  // DFInternalNode *Root = DFG.getRoot();
-  std::vector<DFInternalNode*> Roots = DFG.getRoots();
-  //    BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
-  //    BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
+	// DFInternalNode *Root = DFG.getRoot();
+	std::vector<DFInternalNode*> Roots = DFG.getRoots();
+	//    BuildDFG::HandleToDFNode &HandleToDFNodeMap = DFG.getHandleToDFNodeMap();
+	//    BuildDFG::HandleToDFEdge &HandleToDFEdgeMap = DFG.getHandleToDFEdgeMap();
 
-  // Visitor for Code Generation Graph Traversal
-  CGT_NVPTX *CGTVisitor = new CGT_NVPTX(M, DFG);
+	// Visitor for Code Generation Graph Traversal
+	CGT_NVPTX *CGTVisitor = new CGT_NVPTX(M, DFG);
 
-  // Iterate over all the DFGs and produce code for each one of them
-  for (auto rootNode: Roots) {
-    // Initiate code generation for root DFNode
-    CGTVisitor->visit(rootNode);
-  }
+	// Iterate over all the DFGs and produce code for each one of them
+	for (auto rootNode: Roots) {
+		// Initiate code generation for root DFNode
+		CGTVisitor->visit(rootNode);
+	}
 
-  CGTVisitor->writeKernelsModule();
+	CGTVisitor->writeKernelsModule();
 
-  //TODO: Edit module epilogue to remove the VISC intrinsic declarations
-  delete CGTVisitor;
+	//TODO: Edit module epilogue to remove the VISC intrinsic declarations
+	delete CGTVisitor;
 
-  return true;
+	return true;
 }
 
 std::string CGT_NVPTX::getKernelsModuleName(Module &M) {
-  /*SmallString<128> currentDir;
-  llvm::sys::fs::current_path(currentDir);
-  std::string fileName = getFilenameFromModule(M);
-  Twine output = Twine(currentDir) + "/Output/" + fileName + "";
-  return output.str().append(".kernels.ll");*/
-  std::string mid = M.getModuleIdentifier();
-  return mid.append(".kernels.ll");
+	/*SmallString<128> currentDir;
+		llvm::sys::fs::current_path(currentDir);
+		std::string fileName = getFilenameFromModule(M);
+		Twine output = Twine(currentDir) + "/Output/" + fileName + "";
+		return output.str().append(".kernels.ll");*/
+	std::string mid = M.getModuleIdentifier();
+	return mid.append(".kernels.ll");
 }
 
 void CGT_NVPTX::fixValueAddrspace(Value* V, unsigned addrspace) {
-  assert(isa<PointerType>(V->getType())
-         && "Value should be of Pointer Type!");
-  PointerType* OldTy = cast<PointerType>(V->getType());
-  PointerType* NewTy = PointerType::get(OldTy->getElementType(), addrspace);
-  V->mutateType(NewTy);
-  for(Value::user_iterator ui = V->user_begin(), ue = V->user_end(); ui != ue; ui++) {
-    // Change all uses producing pointer type in same address space to new
-    // addressspace.
-    if(PointerType* PTy = dyn_cast<PointerType>((*ui)->getType())) {
-      if(PTy->getAddressSpace() == OldTy->getAddressSpace()) {
-        fixValueAddrspace(*ui, addrspace);
-      }
-    }
-  }
+	assert(isa<PointerType>(V->getType())
+			&& "Value should be of Pointer Type!");
+	PointerType* OldTy = cast<PointerType>(V->getType());
+	PointerType* NewTy = PointerType::get(OldTy->getElementType(), addrspace);
+	V->mutateType(NewTy);
+	for(Value::user_iterator ui = V->user_begin(), ue = V->user_end(); ui != ue; ui++) {
+		// Change all uses producing pointer type in same address space to new
+		// addressspace.
+		if(PointerType* PTy = dyn_cast<PointerType>((*ui)->getType())) {
+			if(PTy->getAddressSpace() == OldTy->getAddressSpace()) {
+				fixValueAddrspace(*ui, addrspace);
+			}
+		}
+	}
 }
 
 
 std::vector<unsigned> CGT_NVPTX::globalToConstantMemoryOpt(std::vector<unsigned>* GlobalMemArgs, Function* F) {
-  std::vector<unsigned> ConstantMemArgs;
-   for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
-      ai != ae; ++ai) {
-     Argument* arg = &*ai; 
-    std::vector<unsigned>::iterator pos = std::find(GlobalMemArgs->begin(),
-        GlobalMemArgs->end(), arg->getArgNo());
-    // It has to be a global memory argument to be promotable
-    if(pos == GlobalMemArgs->end())
-      continue;
-
-    // Check if it can/should be promoted
-    if(canBePromoted(arg, F)) {
-      errs() << "Promoting << " << arg->getName()  << " to constant memory."<< "\n";
-      ConstantMemArgs.push_back(arg->getArgNo());
-      GlobalMemArgs->erase(pos);
-    }
-  }
-  return ConstantMemArgs;
+	std::vector<unsigned> ConstantMemArgs;
+	for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+			ai != ae; ++ai) {
+		Argument* arg = &*ai; 
+		std::vector<unsigned>::iterator pos = std::find(GlobalMemArgs->begin(),
+				GlobalMemArgs->end(), arg->getArgNo());
+		// It has to be a global memory argument to be promotable
+		if(pos == GlobalMemArgs->end())
+			continue;
+
+		// Check if it can/should be promoted
+		if(canBePromoted(arg, F)) {
+			errs() << "Promoting << " << arg->getName()  << " to constant memory."<< "\n";
+			ConstantMemArgs.push_back(arg->getArgNo());
+			GlobalMemArgs->erase(pos);
+		}
+	}
+	return ConstantMemArgs;
 }
 
 Function* CGT_NVPTX::changeArgAddrspace(Function* F, std::vector<unsigned> &Args, unsigned addrspace) {
-  unsigned idx = 0;
-  std::vector<Type*> ArgTypes;
-  for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
-      ai != ae; ++ai) {
-    Argument *arg = &*ai;
-    DEBUG(errs() << *arg << "\n");
-    unsigned argno = arg->getArgNo();
-    if ((idx < Args.size()) && (argno == Args[idx])) {
-      fixValueAddrspace(arg, addrspace);
-      idx++;
-    }
-    ArgTypes.push_back(arg->getType());
-  }
-  FunctionType* newFT = FunctionType::get(F->getReturnType(), ArgTypes, false);
-
-  //F->mutateType(PTy);
-  Function* newF = cloneFunction(F, newFT, false);
-  replaceNodeFunctionInIR(*F->getParent(), F, newF);
-
-  DEBUG(errs() << *newF->getFunctionType() << "\n" <<*newF << "\n");
-  return newF;
+	unsigned idx = 0;
+	std::vector<Type*> ArgTypes;
+	for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+			ai != ae; ++ai) {
+		Argument *arg = &*ai;
+		DEBUG(errs() << *arg << "\n");
+		unsigned argno = arg->getArgNo();
+		if ((idx < Args.size()) && (argno == Args[idx])) {
+			fixValueAddrspace(arg, addrspace);
+			idx++;
+		}
+		ArgTypes.push_back(arg->getType());
+	}
+	FunctionType* newFT = FunctionType::get(F->getReturnType(), ArgTypes, false);
+
+	//F->mutateType(PTy);
+	Function* newF = cloneFunction(F, newFT, false);
+	replaceNodeFunctionInIR(*F->getParent(), F, newF);
+
+	DEBUG(errs() << *newF->getFunctionType() << "\n" <<*newF << "\n");
+	return newF;
 }
 
 /* Add metadata to module KernelM, for OpenCL kernels */
 void CGT_NVPTX::addCLMetadata(Function *F) {
 
-  IRBuilder<> Builder(&*F->begin());
+	IRBuilder<> Builder(&*F->begin());
 
-  SmallVector<Metadata*,8> KernelMD;
-  KernelMD.push_back(ValueAsMetadata::get(F));
+	SmallVector<Metadata*,8> KernelMD;
+	KernelMD.push_back(ValueAsMetadata::get(F));
 
-  // TODO: There is additional metadata used by kernel files but we skip them as
-  // they are not mandatory. In future they might be useful to enable
-  // optimizations
+	// TODO: There is additional metadata used by kernel files but we skip them as
+	// they are not mandatory. In future they might be useful to enable
+	// optimizations
 
-  MDTuple *MDKernelNode = MDNode::get(KernelM->getContext(), KernelMD);
-  NamedMDNode *MDN_kernels = KernelM->getOrInsertNamedMetadata("opencl.kernels");
-  MDN_kernels->addOperand(MDKernelNode);
+	MDTuple *MDKernelNode = MDNode::get(KernelM->getContext(), KernelMD);
+	NamedMDNode *MDN_kernels = KernelM->getOrInsertNamedMetadata("opencl.kernels");
+	MDN_kernels->addOperand(MDKernelNode);
 
-  KernelMD.push_back(MDString::get(KernelM->getContext(), "kernel"));
-  // TODO: Replace 1 with the number of the kernel.
-  // Add when support for multiple launces is added
-  KernelMD.push_back(ValueAsMetadata::get(ConstantInt::get(Type::getInt32Ty(KernelM->getContext()),1)));
-  MDNode *MDNvvmAnnotationsNode = MDNode::get(KernelM->getContext(), KernelMD);
-  NamedMDNode *MDN_annotations = KernelM->getOrInsertNamedMetadata("nvvm.annotations");
-  MDN_annotations->addOperand(MDNvvmAnnotationsNode);
+	KernelMD.push_back(MDString::get(KernelM->getContext(), "kernel"));
+	// TODO: Replace 1 with the number of the kernel.
+	// Add when support for multiple launces is added
+	KernelMD.push_back(ValueAsMetadata::get(ConstantInt::get(Type::getInt32Ty(KernelM->getContext()),1)));
+	MDNode *MDNvvmAnnotationsNode = MDNode::get(KernelM->getContext(), KernelMD);
+	NamedMDNode *MDN_annotations = KernelM->getOrInsertNamedMetadata("nvvm.annotations");
+	MDN_annotations->addOperand(MDNvvmAnnotationsNode);
 
 }
 
 void CGT_NVPTX::writeKernelsModule() {
 
-  // In addition to deleting all other functions, we also want to spiff it
-  // up a little bit.  Do this now.
-  legacy::PassManager Passes;
+	// In addition to deleting all other functions, we also want to spiff it
+	// up a little bit.  Do this now.
+	legacy::PassManager Passes;
 
-  errs() << "Writing to File --- ";
-  errs() << getKernelsModuleName(M).c_str() << "\n";
-  std::error_code EC;
-  ToolOutputFile Out(getKernelsModuleName(M).c_str(), EC, sys::fs::F_None);
-  if (EC) {
-    errs() << EC.message() << '\n';
-  }
+	errs() << "Writing to File --- ";
+	errs() << getKernelsModuleName(M).c_str() << "\n";
+	std::error_code EC;
+	ToolOutputFile Out(getKernelsModuleName(M).c_str(), EC, sys::fs::F_None);
+	if (EC) {
+		errs() << EC.message() << '\n';
+	}
 
-  Passes.add(
-      createPrintModulePass(Out.os()));
+	Passes.add(
+			createPrintModulePass(Out.os()));
 
-  Passes.run(*KernelM);
+	Passes.run(*KernelM);
 
-  // Declare success.
-  Out.keep();
+	// Declare success.
+	Out.keep();
 }
 
 Function* CGT_NVPTX::transformFunctionToVoid(Function* F) {
 
-  DEBUG(errs() << "Transforming function to void: " << F->getName() << "\n");
-  // FIXME: Maybe do that using the Node?
-  StructType* FRetTy = dyn_cast<StructType>(F->getReturnType());
-  assert(FRetTy && "Return Type must always be a struct");
-
-  // Keeps return statements, because we will need to replace them
-  std::vector<ReturnInst *> RItoRemove;
-  findReturnInst(F, RItoRemove);
-
-
-  // Check for { } return struct, which means that the function returns void
-  if (FRetTy->isEmptyTy()) {
-
-    DEBUG(errs() << "\tFunction output struct is void\n");
-    DEBUG(errs() << "\tNo parameters added\n");
-
-    // Replacing return statements with others returning void
-    for (auto *RI : RItoRemove) {
-      ReturnInst::Create((F->getContext()), 0, RI);
-      RI->eraseFromParent();
-    }
-    DEBUG(errs() << "\tChanged return statements to return void\n");
-  }
-  else {
-    // The struct has return values, thus needs to be converted to parameter
-
-    // Iterate over all element types of return struct and add arguments to the
-    // function
-    std::vector<Argument*> Args;
-    for (unsigned i=0; i<FRetTy->getNumElements(); i++) {
-      Argument* RetArg = new Argument(FRetTy->getElementType(i)->getPointerTo(), "ret_arg", F);
-      Args.push_back(RetArg);
-      DEBUG(errs() << "\tCreated parameter: " << *RetArg << "\n");
-    }
-
-    DEBUG(errs() << "\tReplacing Return statements\n");
-    // Replace return statements with extractValue and store instructions
-    for (auto *RI : RItoRemove) {
-      Value* RetVal = RI->getReturnValue();
-      for(unsigned i = 0; i < Args.size(); i++) {
-        ExtractValueInst* EI = ExtractValueInst::Create(RetVal, ArrayRef<unsigned>(i),
-                               Args[i]->getName()+".val", RI);
-        new StoreInst(EI, Args[i], RI);
-      }
-      // assert(RetVal && "Return value should not be null at this point");
-      // StructType* RetType = cast<StructType>(RetVal->getType());
-      // assert(RetType && "Return type is not a struct");
-
-      ReturnInst::Create((F->getContext()), 0, RI);
-      RI->eraseFromParent();
-
-    }
-  }
-  DEBUG(errs() << "\tReplaced return statements\n");
-
-  // Create the argument type list with the added argument's type
-  std::vector<Type*> ArgTypes;
-  for(Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
-      ai != ae; ++ai) {
-    ArgTypes.push_back(ai->getType());
-  }
-
-  // Adding new arguments to the function argument list, would not change the
-  // function type. We need to change the type of this function to reflect the
-  // added arguments
-  Type* VoidRetType = Type::getVoidTy(F->getContext());
-  FunctionType* newFT = FunctionType::get(VoidRetType, ArgTypes, F->isVarArg());
-
-  // Change the function type
-  //F->mutateType(PTy);
-  Function* newF = cloneFunction(F, newFT, false);
-  replaceNodeFunctionInIR(*F->getParent(), F, newF);
-  //F->eraseFromParent();
-  return newF;
+	DEBUG(errs() << "Transforming function to void: " << F->getName() << "\n");
+	// FIXME: Maybe do that using the Node?
+	StructType* FRetTy = dyn_cast<StructType>(F->getReturnType());
+	assert(FRetTy && "Return Type must always be a struct");
+
+	// Keeps return statements, because we will need to replace them
+	std::vector<ReturnInst *> RItoRemove;
+	findReturnInst(F, RItoRemove);
+
+	std::vector<Type *> RetArgTypes;
+	std::vector<Argument*> RetArgs;
+	std::vector<Argument*> Args;
+	// Check for { } return struct, which means that the function returns void
+	if (FRetTy->isEmptyTy()) {
+
+		DEBUG(errs() << "\tFunction output struct is void\n");
+		DEBUG(errs() << "\tNo parameters added\n");
+
+		// Replacing return statements with others returning void
+		for (auto *RI : RItoRemove) {
+			ReturnInst::Create((F->getContext()), 0, RI);
+			RI->eraseFromParent();
+		}
+		DEBUG(errs() << "\tChanged return statements to return void\n");
+	}
+	else {
+		// The struct has return values, thus needs to be converted to parameter
+
+		// Iterate over all element types of return struct and add arguments to the
+		// function
+		for (unsigned i=0; i<FRetTy->getNumElements(); i++) {
+			Argument* RetArg = new Argument(FRetTy->getElementType(i)->getPointerTo(), "ret_arg", F);
+			RetArgs.push_back(RetArg);
+			RetArgTypes.push_back(RetArg->getType());
+			DEBUG(errs() << "\tCreated parameter: " << *RetArg << "\n");
+		}
+
+		DEBUG(errs() << "\tReplacing Return statements\n");
+		// Replace return statements with extractValue and store instructions
+		for (auto *RI : RItoRemove) {
+			Value* RetVal = RI->getReturnValue();
+			for(unsigned i = 0; i < RetArgs.size(); i++) {
+				ExtractValueInst* EI = ExtractValueInst::Create(RetVal, ArrayRef<unsigned>(i),
+						RetArgs[i]->getName()+".val", RI);
+				new StoreInst(EI, RetArgs[i], RI);
+			}
+			// assert(RetVal && "Return value should not be null at this point");
+			// StructType* RetType = cast<StructType>(RetVal->getType());
+			// assert(RetType && "Return type is not a struct");
+
+			ReturnInst::Create((F->getContext()), 0, RI);
+			RI->eraseFromParent();
+
+		}
+	}
+	DEBUG(errs() << "\tReplaced return statements\n");
+
+	// Create the argument type list with the added argument's type
+	std::vector<Type*> ArgTypes;
+	for(Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+			ai != ae; ++ai) {
+		ArgTypes.push_back(ai->getType());
+	}
+	for(auto *RATy: RetArgTypes) {
+		ArgTypes.push_back(RATy);
+	}
+
+	// Creating Args vector to use in cloning!
+	for(Function::arg_iterator ai = F->arg_begin(), ae = F->arg_end();
+			ai != ae; ++ai) {
+		Args.push_back(&*ai);
+	}
+	for(auto *ai : RetArgs) {
+		Args.push_back(ai);
+	}
+
+	// Adding new arguments to the function argument list, would not change the
+	// function type. We need to change the type of this function to reflect the
+	// added arguments
+	Type* VoidRetType = Type::getVoidTy(F->getContext());
+	FunctionType* newFT = FunctionType::get(VoidRetType, ArgTypes, F->isVarArg());
+
+	// Change the function type
+	//F->mutateType(PTy);
+	Function* newF = cloneFunction(F, newFT, false, NULL, &Args);
+	replaceNodeFunctionInIR(*F->getParent(), F, newF);
+	//F->eraseFromParent();
+	return newF;
 }
 
 /******************************************************************************
@@ -1771,333 +2141,333 @@ Function* CGT_NVPTX::transformFunctionToVoid(Function* F) {
 // 2. Loads not dependent on getNodeInstanceID itrinsic
 
 static bool findLoadStoreUses(Value* V, std::vector<Value*>*UseList, std::vector<Value*>*VisitedList) {
-  if(std::find(VisitedList->begin(), VisitedList->end(), V) != VisitedList->end()) {
-    DEBUG(errs() << "\tAlready visited value: " << *V << "\n");
-    return false;
-  }
-  VisitedList->push_back(V);
-  for(Value::user_iterator ui = V->user_begin(), ue = V->user_end();
-      ui != ue; ++ui) {
-    Instruction* I = dyn_cast<Instruction>(*ui);
-    if(!I) {
-      // if use is not an instruction, then skip it
-      continue;
-    }
-    DEBUG(errs() << "\t" << *I << "\n");
-    if(isa<LoadInst>(I)) {
-      DEBUG(errs() << "\tFound load instruction: " << *I << "\n");
-      DEBUG(errs() << "\tAdd to use list: " << *V << "\n");
-      UseList->push_back(V);
-    }
-    else if(isa<StoreInst>(I) || isa<AtomicRMWInst>(I)) {
-      // found a store in use chain
-      DEBUG(errs() << "Found store/atomicrmw instruction: " << *I << "\n");
-      return true;
-    }
-    else if(BuildDFG::isViscIntrinsic(I)) {
-      // If it is an atomic intrinsic, we found a store
-      IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
-      assert(II && II->getCalledValue()->getName().startswith("llvm.visc.atomic")
-          && "Only visc atomic intrinsics can have an argument as input");
-      return true;
-    }
-    else {
-      DEBUG(errs() << "\tTraverse use chain of: " << *I << "\n");
-      if(findLoadStoreUses(I, UseList, VisitedList))
-        return true;
-    }
-  }
- return false;
+	if(std::find(VisitedList->begin(), VisitedList->end(), V) != VisitedList->end()) {
+		DEBUG(errs() << "\tAlready visited value: " << *V << "\n");
+		return false;
+	}
+	VisitedList->push_back(V);
+	for(Value::user_iterator ui = V->user_begin(), ue = V->user_end();
+			ui != ue; ++ui) {
+		Instruction* I = dyn_cast<Instruction>(*ui);
+		if(!I) {
+			// if use is not an instruction, then skip it
+			continue;
+		}
+		DEBUG(errs() << "\t" << *I << "\n");
+		if(isa<LoadInst>(I)) {
+			DEBUG(errs() << "\tFound load instruction: " << *I << "\n");
+			DEBUG(errs() << "\tAdd to use list: " << *V << "\n");
+			UseList->push_back(V);
+		}
+		else if(isa<StoreInst>(I) || isa<AtomicRMWInst>(I)) {
+			// found a store in use chain
+			DEBUG(errs() << "Found store/atomicrmw instruction: " << *I << "\n");
+			return true;
+		}
+		else if(BuildDFG::isViscIntrinsic(I)) {
+			// If it is an atomic intrinsic, we found a store
+			IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
+			assert(II && II->getCalledValue()->getName().startswith("llvm.visc.atomic")
+					&& "Only visc atomic intrinsics can have an argument as input");
+			return true;
+		}
+		else {
+			DEBUG(errs() << "\tTraverse use chain of: " << *I << "\n");
+			if(findLoadStoreUses(I, UseList, VisitedList))
+				return true;
+		}
+	}
+	return false;
 }
 
 static bool isDependentOnNodeInstanceID(Value* V, std::vector<Value*>*DependenceList) {
-  if(std::find(DependenceList->begin(), DependenceList->end(), V) != DependenceList->end()) {
-    DEBUG(errs() << "\tAlready visited value: " << *V << "\n");
-    return false;
-  }
-  DependenceList->push_back(V);
-  // If not an instruction, then not dependent on node instance id
-  if(!isa<Instruction>(V) || isa<Constant>(V)) {
-    DEBUG(errs() << "\tStop\n");
-    return false;
-  }
-
-  Instruction* I = cast<Instruction>(V);
-  for(unsigned i = 0; i < I->getNumOperands(); i++) {
-    Value* operand = I->getOperand(i);
-    if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(operand)) {
-      if((II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_x
-          || II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_y
-            || II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_z)) {
-        Value* Node = II->getArgOperand(0);
-        IntrinsicInst* GN = dyn_cast<IntrinsicInst>(Node);
-        assert(GN && "NodeInstanceID operande should be node/parent node intrinsic\n");
-        if(GN->getIntrinsicID() == Intrinsic::visc_getNode) {
-          DEBUG(errs() << "\tDependency found on Node instance ID: " << *II << "\n");
-          return true;
-        }
-      }
-    }
-    if(CmpInst* CI = dyn_cast<CmpInst>(operand)) {
-      DEBUG(errs() << "Found compare instruction: "<< *CI<<"\nNot following its dependency list\n");
-      continue;
-    }
-    DEBUG( errs() << "\tTraverse the operand chain of: " << *operand << "\n");
-    if(isDependentOnNodeInstanceID(operand, DependenceList)) {
-      return true;
-    }
-  }
-  return false;
+	if(std::find(DependenceList->begin(), DependenceList->end(), V) != DependenceList->end()) {
+		DEBUG(errs() << "\tAlready visited value: " << *V << "\n");
+		return false;
+	}
+	DependenceList->push_back(V);
+	// If not an instruction, then not dependent on node instance id
+	if(!isa<Instruction>(V) || isa<Constant>(V)) {
+		DEBUG(errs() << "\tStop\n");
+		return false;
+	}
+
+	Instruction* I = cast<Instruction>(V);
+	for(unsigned i = 0; i < I->getNumOperands(); i++) {
+		Value* operand = I->getOperand(i);
+		if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(operand)) {
+			if((II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_x
+						|| II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_y
+						|| II->getIntrinsicID() == Intrinsic::visc_getNodeInstanceID_z)) {
+				Value* Node = II->getArgOperand(0);
+				IntrinsicInst* GN = dyn_cast<IntrinsicInst>(Node);
+				assert(GN && "NodeInstanceID operande should be node/parent node intrinsic\n");
+				if(GN->getIntrinsicID() == Intrinsic::visc_getNode) {
+					DEBUG(errs() << "\tDependency found on Node instance ID: " << *II << "\n");
+					return true;
+				}
+			}
+		}
+		if(CmpInst* CI = dyn_cast<CmpInst>(operand)) {
+			DEBUG(errs() << "Found compare instruction: "<< *CI<<"\nNot following its dependency list\n");
+			continue;
+		}
+		DEBUG( errs() << "\tTraverse the operand chain of: " << *operand << "\n");
+		if(isDependentOnNodeInstanceID(operand, DependenceList)) {
+			return true;
+		}
+	}
+	return false;
 }
 
 // Function to check if argument arg can be changed to a constant memory pointer
 static bool canBePromoted(Argument* arg, Function* F) {
-  DEBUG(errs() << "OPT: Check if Argument " << *arg << " can be changed to constant memory\n");
-  std::vector<Value*> UseList;
-  std::vector<Value*> VisitedList;
-  // recursively traverse use chain
-  // if find a store instruction return false, everything fails, cannot be
-  // promoted
-  // if find a load instruction as use, add the GEP instruction to list
-  bool foundStore = findLoadStoreUses(arg, &UseList, &VisitedList);
-  if(foundStore == true)
-    return false;
-  // See that the GEP instructions are not dependent on getNodeInstanceID
-  // intrinsic
-  DEBUG(errs() << foundStore << "\tNo Store Instruction found. Check dependence on node instance ID\n");
-  std::vector<Value*>DependenceList;
-  for(auto U: UseList) {
-    if(isDependentOnNodeInstanceID(U, &DependenceList))
-      return false;
-  }
-  DEBUG(errs() << "\tYes, Promotable to Constant Memory\n");
-  return true;
+	DEBUG(errs() << "OPT: Check if Argument " << *arg << " can be changed to constant memory\n");
+	std::vector<Value*> UseList;
+	std::vector<Value*> VisitedList;
+	// recursively traverse use chain
+	// if find a store instruction return false, everything fails, cannot be
+	// promoted
+	// if find a load instruction as use, add the GEP instruction to list
+	bool foundStore = findLoadStoreUses(arg, &UseList, &VisitedList);
+	if(foundStore == true)
+		return false;
+	// See that the GEP instructions are not dependent on getNodeInstanceID
+	// intrinsic
+	DEBUG(errs() << foundStore << "\tNo Store Instruction found. Check dependence on node instance ID\n");
+	std::vector<Value*>DependenceList;
+	for(auto U: UseList) {
+		if(isDependentOnNodeInstanceID(U, &DependenceList))
+			return false;
+	}
+	DEBUG(errs() << "\tYes, Promotable to Constant Memory\n");
+	return true;
 }
 
 
 // Calculate execute node parameters which include, number of diemnsions for
 // dynamic instances of the kernel, local and global work group sizes.
 static void getExecuteNodeParams(Module &M, Value* &workDim, Value* &LocalWGPtr, Value*
-                                 &GlobalWGPtr, Kernel* kernel, ValueToValueMapTy& VMap, Instruction* IB) {
-
-  // Assign number of dimenstions a constant value
-  workDim = ConstantInt::get(Type::getInt32Ty(M.getContext()), kernel->gridDim);
-
-  // If local work group size if null
-  if(!kernel->hasLocalWG()) {
-    LocalWGPtr = Constant::getNullValue(Type::getInt64PtrTy(M.getContext()));
-  }
-  else {
-    for(unsigned i = 0; i < kernel->localWGSize.size(); i++) {
-      if(isa<Argument>(kernel->localWGSize[i]))
-        kernel->localWGSize[i] = VMap[kernel->localWGSize[i]];
-    }
-    LocalWGPtr = genWorkGroupPtr(M, kernel->localWGSize, VMap, IB, "LocalWGSize");
-  }
-
-  for(unsigned i = 0; i < kernel->globalWGSize.size(); i++) {
-    if(isa<Argument>(kernel->globalWGSize[i]))
-      kernel->globalWGSize[i] = VMap[kernel->globalWGSize[i]];
-  }
-
-  // For OpenCL, global work group size is the total bumber of instances in each
-  // dimension. So, multiply local and global dim limits.
-  std::vector<Value*> globalWGSizeInsts;
-  if(kernel->hasLocalWG()) {
-    for (unsigned i = 0; i < kernel->gridDim; i++) {
-      BinaryOperator* MulInst = BinaryOperator::Create(Instruction::Mul, kernel->globalWGSize[i], kernel->localWGSize[i], "", IB);
-      globalWGSizeInsts.push_back(MulInst);
-    }
-  }
-  else {
-    globalWGSizeInsts = kernel->globalWGSize;
-  }
-  GlobalWGPtr = genWorkGroupPtr(M, globalWGSizeInsts, VMap, IB, "GlobalWGSize");
-  DEBUG(errs() << "Pointer to global work group: " << *GlobalWGPtr << "\n");
+		&GlobalWGPtr, Kernel* kernel, ValueToValueMapTy& VMap, Instruction* IB) {
+
+	// Assign number of dimenstions a constant value
+	workDim = ConstantInt::get(Type::getInt32Ty(M.getContext()), kernel->gridDim);
+
+	// If local work group size if null
+	if(!kernel->hasLocalWG()) {
+		LocalWGPtr = Constant::getNullValue(Type::getInt64PtrTy(M.getContext()));
+	}
+	else {
+		for(unsigned i = 0; i < kernel->localWGSize.size(); i++) {
+			if(isa<Argument>(kernel->localWGSize[i]))
+				kernel->localWGSize[i] = VMap[kernel->localWGSize[i]];
+		}
+		LocalWGPtr = genWorkGroupPtr(M, kernel->localWGSize, VMap, IB, "LocalWGSize");
+	}
+
+	for(unsigned i = 0; i < kernel->globalWGSize.size(); i++) {
+		if(isa<Argument>(kernel->globalWGSize[i]))
+			kernel->globalWGSize[i] = VMap[kernel->globalWGSize[i]];
+	}
+
+	// For OpenCL, global work group size is the total bumber of instances in each
+	// dimension. So, multiply local and global dim limits.
+	std::vector<Value*> globalWGSizeInsts;
+	if(kernel->hasLocalWG()) {
+		for (unsigned i = 0; i < kernel->gridDim; i++) {
+			BinaryOperator* MulInst = BinaryOperator::Create(Instruction::Mul, kernel->globalWGSize[i], kernel->localWGSize[i], "", IB);
+			globalWGSizeInsts.push_back(MulInst);
+		}
+	}
+	else {
+		globalWGSizeInsts = kernel->globalWGSize;
+	}
+	GlobalWGPtr = genWorkGroupPtr(M, globalWGSizeInsts, VMap, IB, "GlobalWGSize");
+	DEBUG(errs() << "Pointer to global work group: " << *GlobalWGPtr << "\n");
 }
 
 // CodeGen for allocating space for Work Group on stack and returning a pointer
 // to its address
 static Value* genWorkGroupPtr(Module &M, std::vector<Value*> WGSize, ValueToValueMapTy& VMap, Instruction* IB, const Twine& WGName) {
-  Value* WGPtr;
-  // Get int64_t and or ease of use
-  Type* Int64Ty = Type::getInt64Ty(M.getContext());
-
-  // Work Group type is [#dim x i64]
-  Type* WGTy = ArrayType::get(Int64Ty, WGSize.size());
-  // Allocate space of Global work group data on stack and get pointer to
-  // first element.
-  AllocaInst* WG = new AllocaInst(WGTy, 0, WGName, IB);
-  WGPtr = BitCastInst::CreatePointerCast(WG, Int64Ty->getPointerTo(), WG->getName()+".0", IB);
-  Value* nextDim = WGPtr;
-  DEBUG(errs() << *WGPtr << "\n");
-
-  // Iterate over the number of dimensions and store the global work group
-  // size in that dimension
-  for(unsigned i=0; i < WGSize.size(); i++) {
-    DEBUG(errs() << *WGSize[i] << "\n");
-    assert(WGSize[i]->getType()->isIntegerTy() && "Dimension not an integer type!");
-
-    if(WGSize[i]->getType() != Int64Ty) {
-      // If number of dimensions are mentioned in any other integer format,
-      // generate code to extend it to i64. We need to use the mapped value in
-      // the new generated function, hence the use of VMap
-      // FIXME: Why are we changing the kernel WGSize vector here?
-      DEBUG(errs() << "Not i64. Zero extend required.\n");
-      DEBUG(errs() << *WGSize[i] << "\n");
-      CastInst* CI = BitCastInst::CreateIntegerCast(WGSize[i], Int64Ty, true, "", IB);
-      DEBUG(errs() << "Bitcast done.\n");
-      StoreInst* SI = new StoreInst(CI, nextDim, IB);
-      DEBUG(errs() << "Zero extend done.\n");
-      DEBUG(errs() << "\tZero extended work group size: " << *SI << "\n");
-    } else {
-      // Store the value representing work group size in ith dimension on
-      // stack
-      StoreInst* SI = new StoreInst(WGSize[i], nextDim, IB);
-
-      DEBUG(errs() << "\t Work group size: " << *SI << "\n");
-    }
-    if(i+1 < WGSize.size()) {
-      // Move to next dimension
-      GetElementPtrInst* GEP = GetElementPtrInst::Create(nullptr, nextDim,
-                               ArrayRef<Value*>(ConstantInt::get(Int64Ty, 1)),
-                               WG->getName()+"."+Twine(i+1),
-                               IB);
-      DEBUG(errs() << "\tPointer to next dimension on stack: " << *GEP << "\n");
-      nextDim = GEP;
-    }
-  }
-  return WGPtr;
+	Value* WGPtr;
+	// Get int64_t and or ease of use
+	Type* Int64Ty = Type::getInt64Ty(M.getContext());
+
+	// Work Group type is [#dim x i64]
+	Type* WGTy = ArrayType::get(Int64Ty, WGSize.size());
+	// Allocate space of Global work group data on stack and get pointer to
+	// first element.
+	AllocaInst* WG = new AllocaInst(WGTy, 0, WGName, IB);
+	WGPtr = BitCastInst::CreatePointerCast(WG, Int64Ty->getPointerTo(), WG->getName()+".0", IB);
+	Value* nextDim = WGPtr;
+	DEBUG(errs() << *WGPtr << "\n");
+
+	// Iterate over the number of dimensions and store the global work group
+	// size in that dimension
+	for(unsigned i=0; i < WGSize.size(); i++) {
+		DEBUG(errs() << *WGSize[i] << "\n");
+		assert(WGSize[i]->getType()->isIntegerTy() && "Dimension not an integer type!");
+
+		if(WGSize[i]->getType() != Int64Ty) {
+			// If number of dimensions are mentioned in any other integer format,
+			// generate code to extend it to i64. We need to use the mapped value in
+			// the new generated function, hence the use of VMap
+			// FIXME: Why are we changing the kernel WGSize vector here?
+			DEBUG(errs() << "Not i64. Zero extend required.\n");
+			DEBUG(errs() << *WGSize[i] << "\n");
+			CastInst* CI = BitCastInst::CreateIntegerCast(WGSize[i], Int64Ty, true, "", IB);
+			DEBUG(errs() << "Bitcast done.\n");
+			StoreInst* SI = new StoreInst(CI, nextDim, IB);
+			DEBUG(errs() << "Zero extend done.\n");
+			DEBUG(errs() << "\tZero extended work group size: " << *SI << "\n");
+		} else {
+			// Store the value representing work group size in ith dimension on
+			// stack
+			StoreInst* SI = new StoreInst(WGSize[i], nextDim, IB);
+
+			DEBUG(errs() << "\t Work group size: " << *SI << "\n");
+		}
+		if(i+1 < WGSize.size()) {
+			// Move to next dimension
+			GetElementPtrInst* GEP = GetElementPtrInst::Create(nullptr, nextDim,
+					ArrayRef<Value*>(ConstantInt::get(Int64Ty, 1)),
+					WG->getName()+"."+Twine(i+1),
+					IB);
+			DEBUG(errs() << "\tPointer to next dimension on stack: " << *GEP << "\n");
+			nextDim = GEP;
+		}
+	}
+	return WGPtr;
 
 }
 
 // Get generated PTX binary name
 static std::string getPTXFilename(const Module& M) {
-  std::string moduleID = M.getModuleIdentifier();
-  moduleID.append(".kernels.cl");
-  return moduleID;
+	std::string moduleID = M.getModuleIdentifier();
+	moduleID.append(".kernels.cl");
+	return moduleID;
 }
 
 // Get the name of the input file from module ID
 static std::string getFilenameFromModule(const Module& M) {
-  std::string moduleID = M.getModuleIdentifier();
-  return moduleID.substr(moduleID.find_last_of("/")+1);
+	std::string moduleID = M.getModuleIdentifier();
+	return moduleID.substr(moduleID.find_last_of("/")+1);
 }
 
 // Changes the data layout of the Module to be compiled with NVPTX backend
 // TODO: Figure out when to call it, probably after duplicating the modules
 static void changeDataLayout(Module &M) {
-  std::string nvptx32_layoutStr = "e-p:32:32-i64:64-v16:16-v32:32-n16:32:64";
-  std::string nvptx64_layoutStr = "e-i64:64-v16:16-v32:32-n16:32:64";
+	std::string nvptx32_layoutStr = "e-p:32:32-i64:64-v16:16-v32:32-n16:32:64";
+	std::string nvptx64_layoutStr = "e-i64:64-v16:16-v32:32-n16:32:64";
 
-  if (TARGET_PTX == 32)
-    M.setDataLayout(StringRef(nvptx32_layoutStr));
-  else if (TARGET_PTX == 64)
-    M.setDataLayout(StringRef(nvptx64_layoutStr));
-  else assert(false && "Invalid PTX target");
+	if (TARGET_PTX == 32)
+		M.setDataLayout(StringRef(nvptx32_layoutStr));
+	else if (TARGET_PTX == 64)
+		M.setDataLayout(StringRef(nvptx64_layoutStr));
+	else assert(false && "Invalid PTX target");
 
-  return;
+	return;
 }
 
 static void changeTargetTriple(Module &M) {
-  std::string nvptx32_TargetTriple = "nvptx--nvidiacl";
-  std::string nvptx64_TargetTriple = "nvptx64--nvidiacl";
+	std::string nvptx32_TargetTriple = "nvptx--nvidiacl";
+	std::string nvptx64_TargetTriple = "nvptx64--nvidiacl";
 
-  if (TARGET_PTX == 32)
-    M.setTargetTriple(StringRef(nvptx32_TargetTriple));
-  else if (TARGET_PTX == 64)
-    M.setTargetTriple(StringRef(nvptx64_TargetTriple));
-  else assert(false && "Invalid PTX target");
+	if (TARGET_PTX == 32)
+		M.setTargetTriple(StringRef(nvptx32_TargetTriple));
+	else if (TARGET_PTX == 64)
+		M.setTargetTriple(StringRef(nvptx64_TargetTriple));
+	else assert(false && "Invalid PTX target");
 
-  return;
+	return;
 }
 
 // Helper function, populate a vector with all return statements in a function
 static void findReturnInst(Function* F, std::vector<ReturnInst *> & ReturnInstVec) {
-  for (auto &BB : *F) {
-    if(auto *RI = dyn_cast<ReturnInst>(BB.getTerminator()))
-	ReturnInstVec.push_back(RI);
-  }	
+	for (auto &BB : *F) {
+		if(auto *RI = dyn_cast<ReturnInst>(BB.getTerminator()))
+			ReturnInstVec.push_back(RI);
+	}	
 }
 
 // Helper function, populate a vector with all IntrinsicID intrinsics in a function
 static void findIntrinsicInst(Function* F, Intrinsic::ID IntrinsicID, std::vector<IntrinsicInst *> & IntrinsicInstVec) {
-  for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
-    Instruction *I = &(*i);
-    IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
-    if (II && II->getIntrinsicID() == IntrinsicID) {
-      IntrinsicInstVec.push_back(II);
-    }
-  }
+	for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
+		Instruction *I = &(*i);
+		IntrinsicInst* II = dyn_cast<IntrinsicInst>(I);
+		if (II && II->getIntrinsicID() == IntrinsicID) {
+			IntrinsicInstVec.push_back(II);
+		}
+	}
 }
 
 // Helper funtion, returns the atomicrmw op, corresponding to intrinsic atomic op
 static AtomicRMWInst::BinOp getAtomicOp(Intrinsic::ID ID) {
-  switch(ID) {
-  case Intrinsic::visc_atomic_add:
-    return AtomicRMWInst::Add;
-  case Intrinsic::visc_atomic_sub:
-    return AtomicRMWInst::Sub;
-  case Intrinsic::visc_atomic_min:
-    return AtomicRMWInst::Min;
-  case Intrinsic::visc_atomic_umin:
-    return AtomicRMWInst::UMin;
-  case Intrinsic::visc_atomic_max:
-    return AtomicRMWInst::Max;
-  case Intrinsic::visc_atomic_umax:
-    return AtomicRMWInst::UMax;
-  //case Intrinsic::visc_atomic_inc: return AtomicRMWInst::Inc;
-  //case Intrinsic::visc_atomic_dec: return AtomicRMWInst::Dec;
-  case Intrinsic::visc_atomic_xchg:
-    return AtomicRMWInst::Xchg;
-  case Intrinsic::visc_atomic_and:
-    return AtomicRMWInst::And;
-  case Intrinsic::visc_atomic_or:
-    return AtomicRMWInst::Or;
-  case Intrinsic::visc_atomic_xor:
-    return AtomicRMWInst::Xor;
-  default:
-    llvm_unreachable("Unsupported atomic intrinsic!");
-  };
+	switch(ID) {
+		case Intrinsic::visc_atomic_add:
+			return AtomicRMWInst::Add;
+		case Intrinsic::visc_atomic_sub:
+			return AtomicRMWInst::Sub;
+		case Intrinsic::visc_atomic_min:
+			return AtomicRMWInst::Min;
+		case Intrinsic::visc_atomic_umin:
+			return AtomicRMWInst::UMin;
+		case Intrinsic::visc_atomic_max:
+			return AtomicRMWInst::Max;
+		case Intrinsic::visc_atomic_umax:
+			return AtomicRMWInst::UMax;
+			//case Intrinsic::visc_atomic_inc: return AtomicRMWInst::Inc;
+			//case Intrinsic::visc_atomic_dec: return AtomicRMWInst::Dec;
+		case Intrinsic::visc_atomic_xchg:
+			return AtomicRMWInst::Xchg;
+		case Intrinsic::visc_atomic_and:
+			return AtomicRMWInst::And;
+		case Intrinsic::visc_atomic_or:
+			return AtomicRMWInst::Or;
+		case Intrinsic::visc_atomic_xor:
+			return AtomicRMWInst::Xor;
+		default:
+			llvm_unreachable("Unsupported atomic intrinsic!");
+	};
 }
 
 
 // Helper funtion, returns the OpenCL function name, corresponding to atomic op
 static std::string getAtomicOpName(Intrinsic::ID ID) {
-  switch(ID) {
-  case Intrinsic::visc_atomic_cmpxchg:
-    return "atom_cmpxchg";
-  case Intrinsic::visc_atomic_add:
-    return "atom_add";
-  case Intrinsic::visc_atomic_sub:
-    return "atom_sub";
-  case Intrinsic::visc_atomic_min:
-    return "atom_min";
-  case Intrinsic::visc_atomic_max:
-    return "atom_max";
-  case Intrinsic::visc_atomic_inc:
-    return "atom_inc";
-  case Intrinsic::visc_atomic_dec:
-    return "atom_dec";
-  case Intrinsic::visc_atomic_xchg:
-    return "atom_xchg";
-  case Intrinsic::visc_atomic_and:
-    return "atom_and";
-  case Intrinsic::visc_atomic_or:
-    return "atom_or";
-  case Intrinsic::visc_atomic_xor:
-    return "atom_xor";
-  default:
-    llvm_unreachable("Unsupported atomic intrinsic!");
-  };
+	switch(ID) {
+		case Intrinsic::visc_atomic_cmpxchg:
+			return "atom_cmpxchg";
+		case Intrinsic::visc_atomic_add:
+			return "atom_add";
+		case Intrinsic::visc_atomic_sub:
+			return "atom_sub";
+		case Intrinsic::visc_atomic_min:
+			return "atom_min";
+		case Intrinsic::visc_atomic_max:
+			return "atom_max";
+		case Intrinsic::visc_atomic_inc:
+			return "atom_inc";
+		case Intrinsic::visc_atomic_dec:
+			return "atom_dec";
+		case Intrinsic::visc_atomic_xchg:
+			return "atom_xchg";
+		case Intrinsic::visc_atomic_and:
+			return "atom_and";
+		case Intrinsic::visc_atomic_or:
+			return "atom_or";
+		case Intrinsic::visc_atomic_xor:
+			return "atom_xor";
+		default:
+			llvm_unreachable("Unsupported atomic intrinsic!");
+	};
 }
 
 } // End of namespace
 
 char DFG2LLVM_NVPTX::ID = 0;
 static RegisterPass<DFG2LLVM_NVPTX> X("dfg2llvm-nvptx",
-                                      "Dataflow Graph to LLVM for NVPTX Pass",
-                                      false /* does not modify the CFG */,
-                                      true /* transformation,   *
-                                            * not just analysis */);
+		"Dataflow Graph to LLVM for NVPTX Pass",
+		false /* does not modify the CFG */,
+		true /* transformation,   *
+					* not just analysis */);
 
diff --git a/hpvm/projects/llvm-cbe/CMakeLists.txt b/hpvm/projects/llvm-cbe/CMakeLists.txt
new file mode 100644
index 0000000000..cc29966da9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(lib)
+add_subdirectory(tools)
diff --git a/hpvm/projects/llvm-cbe/LICENSE b/hpvm/projects/llvm-cbe/LICENSE
new file mode 100644
index 0000000000..42b02dd208
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/LICENSE
@@ -0,0 +1,57 @@
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign.
+All rights reserved.
+Developed by:
+LLVM Team
+University of Illinois at Urbana-Champaign
+http://llvm.org
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimers.
+* Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimers in the
+documentation and/or other materials provided with the distribution.
+* Neither the names of the LLVM Team, University of Illinois at
+Urbana-Champaign, nor the names of its contributors may be used to
+endorse or promote products derived from this Software without specific
+prior written permission.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties. Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+Program Directory
+------- ---------
+Autoconf llvm/autoconf
+llvm/projects/ModuleMaker/autoconf
+llvm/projects/sample/autoconf
+Google Test llvm/utils/unittest/googletest
+OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
+pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
+ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
+md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
diff --git a/hpvm/projects/llvm-cbe/Makefile b/hpvm/projects/llvm-cbe/Makefile
new file mode 100644
index 0000000000..3a4fefd3ef
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/Makefile
@@ -0,0 +1,14 @@
+##===- projects/sample/lib/Makefile ------------------------*- Makefile -*-===##
+
+#
+# Relative path to the top of the source tree.
+#
+LEVEL := ../..
+include $(LEVEL)/Makefile.config
+
+#
+# List all of the subdirectories that we will compile.
+#
+DIRS := lib tools
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/README.md b/hpvm/projects/llvm-cbe/README.md
new file mode 100644
index 0000000000..5212d1ac15
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/README.md
@@ -0,0 +1,120 @@
+llvm-cbe
+========
+
+LLVM 3.9 "C Backend", with improvements
+
+
+INSTALLATION INSTRUCTIONS
+=========================
+
+This version of the LLVM-CBE library works with LLVM 3.9. You will have to
+compile this version of LLVM before you try to use LLVM-CBE. This
+guide will walk you through the compilation and installation of both
+tools and show usage statements to verify that the LLVM-CBE library is
+compiled correctly.
+
+The library is known to compile on various Linux versions (Redhat,
+Mageia, Ubuntu, Debian), Mac OS X, and Windows (Mingw-w64).
+
+
+Step 1: Installing GCC 4.8
+==========================
+
+### Ubuntu 14.04
+
+```bash
+sudo apt-get install python-software-properties
+sudo add-apt-repository ppa:ubuntu-toolchain-r/test
+sudo apt-get update
+sudo apt-get install gcc-4.8
+sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
+```
+
+Step 2: Installing CMAKE 3.4.3 or higher
+========================================
+
+### Ubuntu 14.04
+
+LLVM/Clang 3.9 needs cmake 3.4.3 or higher, since Ubuntu does not have this natively, just install it from a binary package: (installed here in $HOME/progs)
+
+```bash
+wget https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz
+tar -xf cmake-3.5.2-Linux-x86_64.tar.gz -C ~/progs
+export PATH=~/progs/cmake-3.5.2-Linux-x86_64/bin:$PATH
+
+sudo apt-get install clang-3.9 cmake
+export CC=clang-3.9
+export CXX=clang++-3.9
+```
+
+Step 3: Installing LLVM
+=======================
+
+The next step is to compile LLVM on your machine
+(this assumes an in-tree build, but out-of-tree will also work):
+
+```bash
+cd $HOME
+git clone https://github.com/llvm-mirror/llvm
+cd llvm
+git checkout release_39
+```
+
+Step 4: Compiling LLVM-CBE
+==========================
+
+Next, download and compile llvm-cbe from the same folder:
+
+```bash
+cd $HOME/llvm/projects
+git clone https://github.com/gapkalov/llvm-cbe.git llvm-cbe
+cd $HOME/llvm/
+mkdir build
+cd build
+cmake -G "Unix Makefiles" ..
+make
+```
+
+Step 5: Run Tests
+=================
+
+If llvm-cbe compiles, you should be able to run it with the following commands.
+
+```bash
+cd $HOME/llvm/projects/test
+make clean
+make
+```
+
+Step 6: Usage Examples
+======================
+
+```bash
+$ cd llvm/lib/test/selectionsort
+$ ls
+main.c
+$ clang -S -emit-llvm main.c
+$ ls
+main.c main.ll
+$ $(HOME)/llvm/Release/bin/llvm-cbe main.ll
+```
+
+Compile Generated C-Code and Run
+================================
+```bash
+$ gcc -o main.cbe main.cbe.c
+$ ls
+main.c  main.cbe  main.cbe.c  main.ll
+$ ./main.cbe
+```
+
+
+Known Issues
+============
+1. Type uint64_t not genrated, now replaced to int64_t
+2. local array is not generated correctly
+3. APInt-c.cpp not compiled
+4. Warning as error now disabled
+5. Test 86 - disabled
+6. Test 87 - disabled
+7. Too much FIX ME in the code ;)
diff --git a/hpvm/projects/llvm-cbe/build/CMakeCache.txt b/hpvm/projects/llvm-cbe/build/CMakeCache.txt
new file mode 100644
index 0000000000..5d9ac64042
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeCache.txt
@@ -0,0 +1,314 @@
+# This is the CMakeCache file.
+# For build in directory: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build
+# It was generated by CMake: /usr/bin/cmake
+# You can edit this file to change values found and used by cmake.
+# If you do not want to change any of the values, simply exit the editor.
+# If you do want to change a value, simply edit, save, and exit the editor.
+# The syntax for the file is as follows:
+# KEY:TYPE=VALUE
+# KEY is the name of a variable in the cache.
+# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
+# VALUE is the current value for the KEY.
+
+########################
+# EXTERNAL cache entries
+########################
+
+//Path to a program.
+CMAKE_AR:FILEPATH=/usr/bin/ar
+
+//For backwards compatibility, what version of CMake commands and
+// syntax should this version of CMake try to support.
+CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
+
+//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
+// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
+CMAKE_BUILD_TYPE:STRING=
+
+//Enable/Disable color output during build.
+CMAKE_COLOR_MAKEFILE:BOOL=ON
+
+//CXX compiler
+CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
+
+//Flags used by the compiler during all build types.
+CMAKE_CXX_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_CXX_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release builds for minimum
+// size.
+CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds.
+CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during release builds with debug info.
+CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
+
+//C compiler
+CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
+
+//Flags used by the compiler during all build types.
+CMAKE_C_FLAGS:STRING=
+
+//Flags used by the compiler during debug builds.
+CMAKE_C_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the compiler during release builds for minimum
+// size.
+CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the compiler during release builds.
+CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the compiler during release builds with debug info.
+CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
+
+//Flags used by the linker.
+CMAKE_EXE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Enable/Disable output of compile commands during generation.
+CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
+
+//Install path prefix, prepended onto install directories.
+CMAKE_INSTALL_PREFIX:PATH=/usr/local
+
+//Path to a program.
+CMAKE_LINKER:FILEPATH=/usr/bin/ld
+
+//Path to a program.
+CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
+
+//Flags used by the linker during the creation of modules.
+CMAKE_MODULE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_NM:FILEPATH=/usr/bin/nm
+
+//Path to a program.
+CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
+
+//Path to a program.
+CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
+
+//Value Computed by CMake
+CMAKE_PROJECT_NAME:STATIC=Project
+
+//Path to a program.
+CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
+
+//Flags used by the linker during the creation of dll's.
+CMAKE_SHARED_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//If set, runtime paths are not added when installing shared libraries,
+// but are added when building.
+CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
+
+//If set, runtime paths are not added when using shared libraries.
+CMAKE_SKIP_RPATH:BOOL=NO
+
+//Flags used by the linker during the creation of static libraries.
+CMAKE_STATIC_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during debug builds.
+CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during release minsize builds.
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during release builds.
+CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during Release with Debug Info builds.
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_STRIP:FILEPATH=/usr/bin/strip
+
+//If this value is on, makefiles will be generated without the
+// .SILENT directive, and all commands will be echoed to the console
+// during the make.  This is useful for debugging only. With Visual
+// Studio IDE projects all commands are done without /nologo.
+CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
+
+//Single output directory for building all executables.
+EXECUTABLE_OUTPUT_PATH:PATH=
+
+//Single output directory for building all libraries.
+LIBRARY_OUTPUT_PATH:PATH=
+
+//Value Computed by CMake
+Project_BINARY_DIR:STATIC=/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build
+
+//Value Computed by CMake
+Project_SOURCE_DIR:STATIC=/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe
+
+
+########################
+# INTERNAL cache entries
+########################
+
+//ADVANCED property for variable: CMAKE_AR
+CMAKE_AR-ADVANCED:INTERNAL=1
+//This is the directory where this CMakeCache.txt was created
+CMAKE_CACHEFILE_DIR:INTERNAL=/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build
+//Major version of cmake used to create the current loaded cache
+CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
+//Minor version of cmake used to create the current loaded cache
+CMAKE_CACHE_MINOR_VERSION:INTERNAL=5
+//Patch version of cmake used to create the current loaded cache
+CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
+//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
+CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
+//Path to CMake executable.
+CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
+//Path to cpack program executable.
+CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
+//Path to ctest program executable.
+CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
+//ADVANCED property for variable: CMAKE_CXX_COMPILER
+CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
+CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
+CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER
+CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS
+CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
+CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//Executable file format
+CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
+CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
+CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
+CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
+CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
+//Name of external makefile project generator.
+CMAKE_EXTRA_GENERATOR:INTERNAL=
+//Name of generator.
+CMAKE_GENERATOR:INTERNAL=Unix Makefiles
+//Name of generator platform.
+CMAKE_GENERATOR_PLATFORM:INTERNAL=
+//Name of generator toolset.
+CMAKE_GENERATOR_TOOLSET:INTERNAL=
+//Source directory with the top level CMakeLists.txt file for this
+// project
+CMAKE_HOME_DIRECTORY:INTERNAL=/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe
+//Install .so files without execute permission.
+CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
+//ADVANCED property for variable: CMAKE_LINKER
+CMAKE_LINKER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
+CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
+CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
+CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
+CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_NM
+CMAKE_NM-ADVANCED:INTERNAL=1
+//number of local generators
+CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=4
+//ADVANCED property for variable: CMAKE_OBJCOPY
+CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJDUMP
+CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_RANLIB
+CMAKE_RANLIB-ADVANCED:INTERNAL=1
+//Path to CMake installation.
+CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.5
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
+CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
+CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
+CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
+CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_RPATH
+CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
+CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
+CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
+CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STRIP
+CMAKE_STRIP-ADVANCED:INTERNAL=1
+//uname command
+CMAKE_UNAME:INTERNAL=/bin/uname
+//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
+CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
+
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCCompiler.cmake b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCCompiler.cmake
new file mode 100644
index 0000000000..f40522e627
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCCompiler.cmake
@@ -0,0 +1,67 @@
+set(CMAKE_C_COMPILER "/usr/bin/cc")
+set(CMAKE_C_COMPILER_ARG1 "")
+set(CMAKE_C_COMPILER_ID "GNU")
+set(CMAKE_C_COMPILER_VERSION "5.4.0")
+set(CMAKE_C_COMPILER_WRAPPER "")
+set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
+set(CMAKE_C_COMPILE_FEATURES "c_function_prototypes;c_restrict;c_variadic_macros;c_static_assert")
+set(CMAKE_C90_COMPILE_FEATURES "c_function_prototypes")
+set(CMAKE_C99_COMPILE_FEATURES "c_restrict;c_variadic_macros")
+set(CMAKE_C11_COMPILE_FEATURES "c_static_assert")
+
+set(CMAKE_C_PLATFORM_ID "Linux")
+set(CMAKE_C_SIMULATE_ID "")
+set(CMAKE_C_SIMULATE_VERSION "")
+
+set(CMAKE_AR "/usr/bin/ar")
+set(CMAKE_RANLIB "/usr/bin/ranlib")
+set(CMAKE_LINKER "/usr/bin/ld")
+set(CMAKE_COMPILER_IS_GNUCC 1)
+set(CMAKE_C_COMPILER_LOADED 1)
+set(CMAKE_C_COMPILER_WORKS TRUE)
+set(CMAKE_C_ABI_COMPILED TRUE)
+set(CMAKE_COMPILER_IS_MINGW )
+set(CMAKE_COMPILER_IS_CYGWIN )
+if(CMAKE_COMPILER_IS_CYGWIN)
+  set(CYGWIN 1)
+  set(UNIX 1)
+endif()
+
+set(CMAKE_C_COMPILER_ENV_VAR "CC")
+
+if(CMAKE_COMPILER_IS_MINGW)
+  set(MINGW 1)
+endif()
+set(CMAKE_C_COMPILER_ID_RUN 1)
+set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
+set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+set(CMAKE_C_LINKER_PREFERENCE 10)
+
+# Save compiler ABI information.
+set(CMAKE_C_SIZEOF_DATA_PTR "8")
+set(CMAKE_C_COMPILER_ABI "ELF")
+set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+
+if(CMAKE_C_SIZEOF_DATA_PTR)
+  set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
+endif()
+
+if(CMAKE_C_COMPILER_ABI)
+  set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
+endif()
+
+if(CMAKE_C_LIBRARY_ARCHITECTURE)
+  set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+endif()
+
+set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
+if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
+  set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
+
+
+
+set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "c")
+set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/5;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
+set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCXXCompiler.cmake b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCXXCompiler.cmake
new file mode 100644
index 0000000000..013ee9298f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeCXXCompiler.cmake
@@ -0,0 +1,68 @@
+set(CMAKE_CXX_COMPILER "/usr/bin/c++")
+set(CMAKE_CXX_COMPILER_ARG1 "")
+set(CMAKE_CXX_COMPILER_ID "GNU")
+set(CMAKE_CXX_COMPILER_VERSION "5.4.0")
+set(CMAKE_CXX_COMPILER_WRAPPER "")
+set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "98")
+set(CMAKE_CXX_COMPILE_FEATURES "cxx_template_template_parameters;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
+set(CMAKE_CXX98_COMPILE_FEATURES "cxx_template_template_parameters")
+set(CMAKE_CXX11_COMPILE_FEATURES "cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
+set(CMAKE_CXX14_COMPILE_FEATURES "cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
+
+set(CMAKE_CXX_PLATFORM_ID "Linux")
+set(CMAKE_CXX_SIMULATE_ID "")
+set(CMAKE_CXX_SIMULATE_VERSION "")
+
+set(CMAKE_AR "/usr/bin/ar")
+set(CMAKE_RANLIB "/usr/bin/ranlib")
+set(CMAKE_LINKER "/usr/bin/ld")
+set(CMAKE_COMPILER_IS_GNUCXX 1)
+set(CMAKE_CXX_COMPILER_LOADED 1)
+set(CMAKE_CXX_COMPILER_WORKS TRUE)
+set(CMAKE_CXX_ABI_COMPILED TRUE)
+set(CMAKE_COMPILER_IS_MINGW )
+set(CMAKE_COMPILER_IS_CYGWIN )
+if(CMAKE_COMPILER_IS_CYGWIN)
+  set(CYGWIN 1)
+  set(UNIX 1)
+endif()
+
+set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
+
+if(CMAKE_COMPILER_IS_MINGW)
+  set(MINGW 1)
+endif()
+set(CMAKE_CXX_COMPILER_ID_RUN 1)
+set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
+set(CMAKE_CXX_LINKER_PREFERENCE 30)
+set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
+
+# Save compiler ABI information.
+set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
+set(CMAKE_CXX_COMPILER_ABI "ELF")
+set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+
+if(CMAKE_CXX_SIZEOF_DATA_PTR)
+  set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
+endif()
+
+if(CMAKE_CXX_COMPILER_ABI)
+  set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
+endif()
+
+if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
+  set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+endif()
+
+set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
+if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
+  set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
+
+
+
+set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;c")
+set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/5;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
+set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_C.bin b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_C.bin
new file mode 100755
index 0000000000000000000000000000000000000000..007976746bbc08577dee275193a151481f73ad7d
GIT binary patch
literal 8640
zcmeHNeQXrR6`#BF$2m6Vg8(rfE!!4aL*>ocHI4zb?D=f7Cbpr*CP}GTpM7Wh$oY=m
z?GYO#4V4p;Q$m80s6|y9QB_r`lt#3wT2Q250t)malB0?$E%}3n(wG2^Q4(ZD#Mk#`
z=iSG6krG8!|6#1#H}5y^_vT|~XJ_8}(U$gBr^CT0IoY=uYP(A`4p~>oF6FAg8d(|B
z*b26sl>kx<KaH25v~nb8glm#+Vdnx_1iwb71vEM}o*}v1f}sX0Q43LGeYvEGtR-J4
zvs99dDI7o^w$<z5D#$*bA*qOVR0~NwRFPLLc-4YOa#A#mB=rybhQDs%uiL4ChPsA=
zHS=puqAjMam&_36hlQhIw}vq2maOL*V<d_9ZQx-$KW*{~!!A+Zt;S_q^pB)a+1=4d
ze?$G<(NIk^5=)KNj5apZG}NofxLU{ijsDSgQ)dsaiN;X@4cojBemDoPJpJdfYxg}c
zw9sV7|MEob%S(TG>iOeXhW$ZaDf|w4_qo}Z7MHt=isn68#563!TaEQJwVb=Ut1R%h
zS1vyHaK-u`mA`cF#fg8saq-2v{`1$~`riG^cRl*!hmRk)?x|S#&Wp#YijQ6S>-*wv
z0$EBmpequFYB~HC*x)h16dU~4x4=){0{;%+Ubck!ynT?%r66PxS0wx=9AC;BC42yI
z#m4>-z~_S}pO{B9Z=MEx0rRk<r5fZI3-c>uLm&~SbzqIae+JSEi-FwEDq%k;{A>{R
zKje5hQ%W>}SmFyD_b^4YM?5C14RCCyCh$dq^)+r^$yN$nz>L8>9KdPUzzhTPM$!x>
zOk*S%i4ii8Oc{fbScDmE-5o|KoCps^l4dy3-4Te!W8v;#e>BV@vB9{JjO-1^2aV8f
zGr^2-C};-32MWt8C_^Lhn5e=4e_J3Qio}dmG91dU4r(*OLkz+GWRmEc_ZVHG@<240
zOoo$In`~ROslBZ!VAQE~>RPL}G)4}1vh4rxnZrNpxj<HGX#^e<Cp&MsU^A6{JcrK@
zK4X-s#5}@hjq1TNef+9hf2#P6GKJ}nPngA1U+3Uy_bDu8EVK4CD9Wrl4cE#Q8stzP
z#-hs?GLTk12m0Va1TfWJYfHbmQ%}F6kN<0WYj@k337i4?nUgpH^)qL1{!IM=cpnZ{
zu4rcL*gep&9=!(Vn?63{(bJdqEIWptusQR4Phdgj0vJDrAnQGatr%2Ee-+Dn^dJ0(
zJ2*M(0tb3}T0c3pQFpwqzd36z%6cm&Z<Q;+k5&J^Z<ay(S!#X{5T|0$u-?~;Z@3la
z_<+}RLV*{8KE9EqimyBmysWe9NXSg~Ufv5F%%>l@s;5&I&a~Xbc0Sc|RX<eu`+Ydi
zD_@;(wA>`*{ygL+G$Y#;J|6!2{M-HMjK9a<-F{$IXNdxxJ5YmiTU+`@Tl!r4>P!5d
zo&3Z#wQ)9+(I3BNDz)cnJlfOmwWn`1gNMw*xApN;4t?E~)O-5)Y4?s^|9Abp{+)i~
z)WKY(AHaR){=fonxualqFxJ-Dx@CRdW3$88*o*z+c(6aR1NIjPIF`9K;5(}res6t}
z$?OB^hURSrIScX#NF7G%EXZRZy*P;>;d=s;V{aF8jCvi*DoWi49i?8xac^)Ge62wP
zk?idmTM6Z8zZL8iwDovfJyn}4%O7&@V;h%lSo4jQUq%>hVA`=xXcJ$<{2uRqXJB5*
z9;jH9g+Pu%c^D*X@_3(hHhHR^akY4q14T`q>Zgl!k8gj8?r9t^?eJ&`Pov-C^LwhB
zJPO!>eUrz{`}Gpg4}+il=M7!nPPa$k_6Xb_f&a${Xz>2UqzK6sxQOLAD=S0+?d#?V
zo%Ux-gihzHWkSa_6cZgMtKjvC3D;drRQ}OyCXV_cr-p*RH&9L#X(;&F0OgERL&5Ig
zSH|8I68Gzvsw}~1A1Tz_-Uqe^m}m_qdwP%HehAZDmSFA@jpqoTF1B=PH}Uaof{Aok
z=6Qc6g+09DxK86bE%YOz++zRluXK);YuYaQDdU?0f%QstPk$<Arj)g6z3QuJNO7(9
z`?U?KuU@UKU2PR8b-vmLUxRO*>_gUFFsmA!nhe7|a%RuV`GqbhF>UROvh$_TzBoHi
z3h|Qcd@96CncaPG!R(~_S7=|xXdV>ecVy>FAwKs!gyk+)0S8+x-<0QFY#!^g#dGJg
ze3FaVoRh%7m3RItw4a}iFBIYn*kRa>%E`s<%*Idh%UrOlq35{}U&L^mEGHLR3~?1Z
z{I2XdC7<KMr%61oh4|d_F_yb*&Z!not5MDiK8Ho@dM1ZhIb7!)uzJYt$Mww#=i|fD
zeL>HNUyyKB;PSfK%>C!i)3hFJ<M`b1+$;RhIt?mM`{C-axi7x}+^%28xxJU+X#*1l
zL~b<>uYrvNA_51?G&IkqNyyoa4;t9j`!;9ZIcJ_+<9?Q~YU%!d%<;MN#Ki|{?mS$~
z@wxMPHQ)}L_{v(2&z)EI0*>(yJe^{q_rngr6^;~Mj&gkNJbVanyLiTvfZN4;dH`Qw
z^ZY)`@xnS$ds+CA<3q0iuFN%Oe*)Yt4)k}x?czXF-~;15a-8XR!d{LKT?X7PKJ<~W
zm*Ybp18&z&4-B{+ev$jJSw9C7X3|Uz4ypqXa@ic{GTPg=bsGlDg?kKh#2CPU4+LF|
zP}~@b#`}X&BV@)CNh6pVWdre%-O;ca4ypI7T~}{!!~;o2Fp&t3L3qbZjIqH)a3pMm
zQX?Z{K*`e#3<4FH20DTdh64epCK3%N{7r4pSRQwRgEDYiyZjw3MoVWiG~4O}<qJGv
zOevI%8^gg^2m)6|^8=m!j<x`xd1gEc1`xzojTT+F)|<Nkg0L4=vZ;MblfT{A(%QPM
zrQ7KCH?_B5)jW>&IiqG$EKbw%!&#pvsFoK`vx0n|DX7NO<k*NA><4KkEICZMNDP94
zyO|n`n_(61PK_BH653EKrS_*H5blnIn2OqPFgeWB&{z!oSrTG~ykt)}k&MJ+1&RS>
ziEuQC1d-bvHJQregeqj!p*W~!coeQYR;ec9JpQPLhsC5C4uKQWEUGoTEC%Iw4S*R`
z6C8;QKpWyFx(5V<nJUC0nF{lK1m>>I>hReieBZ$%nOz@gA4lJHXkSmB(KbJQ1r*#%
z)B4)&)IiI9H&M8jyA<WJJXZ_Xd_L_9P2q5*WH0ma{d)uU-c<h~r^XqF1klH|-1&p{
z`2uF0kioMC@n@VGXm~E+f}Ir|#&|1ci4Siap0>l)1wZ1``DQ{i^j*s=dzHs;CzRk>
zg7~y=JyL8@zABhP&DKNq4?;PfO-QHx?W7<mf-kpUzzp{z*i_=vK6qO2sh?E8-2cY}
zzezZx^OYMbgp|+6yv%<FFdP$Mp8d|C2!PI+V8W9aR#I6Sa`}9%MB`<e;456qUGRGo
zCXz2eKA+zw_<e#;?d2r6$ofwuKD|$O3;u7V8&36-zn@EdI)ASe7124A?B)LdO7Q9a
z(f1*r;5QIaNV)#sNPPNEN#8H)CB9t$35ieVjl-h;4<)`let(2=+`Hm4go)w}^gUCy
zm-TbNse~W#>HJb9HpH^Mtp5|Zc#DWn=LF?b^8XE7yw${~^ALS+o)q_AOo#0Jq5E)1
zs-M2^%wVS=$?YYb<ojTg-~R0RN>rerle|Pck~2`2&!>H;BKXu!azQ-OXCZ?a^&dae
zVDbr~Y%hj`+u#My0f_msh?OC}_;i*nB|gddP(pQQjUY2E7M=<+6orz?>!xQXpFb?x
gPwT)Jp|B2q)F0uVf5Wz`|LkJRTkii6EM2buzg*&!g#Z8m

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_CXX.bin b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_CXX.bin
new file mode 100755
index 0000000000000000000000000000000000000000..9717f93a704a711c1635031e2c1da2d3efcb684d
GIT binary patch
literal 8656
zcmeHMeQZ<L6~DIg*#yT>pebSFbptIR<u!p20&L^ij*}PWge)W-8x0R9b`pbQXZABo
zSVuFZpjwO$?L$LTS52BGF{yvB{;@GtEksnnCQYKM=&E*qWKb%~S3zx2v_ZUc?z_i+
zett;prb+vQ6FKLe-#zEt&v)NF=RF$;wmTgTM&x8)XDIcQDI7BXGv-;wMS-=lN~W+C
zY&k0fq!fM%uR(5<h|dYv#4CiJ3wR0qTAc>a>Qs1v_;Le=77U^uBFFafq==%y^-4n|
z&X~jjw8Or7+*|~{n-_>nq965wlO2j^S1;`9g&pw=qGQBqd^k4z^$CA{P6Z^C6=bZ9
z|Ic&OMe4bthq0^*M{0$FFvtdP<`QGX$?ltAhyDDl<PnO!qP+*r%WW|};zDFk#-f8Q
z%}>U{4Y6oEJ<%}H+S1U{ET<CkT0U;{kGdV*{k$cbM+qeC^J4hn9>Dsu18eGTzB^OD
z<g4o5YyX<79J+OD0oLJo(5@VQM?F&&?1{yd6(uDLo-bhv*5OiPJHEih8+$7KZ@+r^
zC(l%G`bE{t-?)7G-M?ObY3<;9H{bd0j^%rv{pB-%I&#Ndz4+2g*Wda`tRxuPPy=9+
z4PFJ<A{%@FFv$jg@d5aW2jHE6d)VWw(X$&$dFp{8;*teF%<*Nc)q?i|F4^eE0AC26
zJYpZwzWF}ji<p}oEmxq#ScLy)>?z=g(>bt4;75Ub*s`L2)(ZW0;b*hZKgjVaHdm?$
z#9&|GI4p(ek9bVjS2$k7N(7!Wg8epx+pC3X8kV(`9!l!kSST7NWGI!^hNJN)(>nXQ
zv~VOD8HuL!NV2cXA4|j|eWAfvglUm*NDqMtGQ$Z7BV&oU@Th_LHYkUqaV?#Sgw5W;
zxegxU2o9!FWWIHu)+^fb$3m%8BxQ8LwgVl(PM=>}E3cK;^TE-`9q_!^{TVZ0)EN66
zk@T`CY=0;Fi&4$yYIgGyJ{S1x5Y>wPfzJ@NgmvoljSBT}>8F(vQxBfjORuiu;2RZZ
zur^QG^_M^;yXt-TU$a7i63U~f@ZoG0Xw@qq597Ar)O52m^X4u!b4i_k|8`Gb=eg6k
z!s@vh++gatbGSdQ{t@gx8LnB;#@NXX(7}GS0r$N+J?B<4SN7GNL|53Yg#)LsB0CGp
z&vE|)XRsH;GRd!FeZTs{Tin6SybBztncM2j)h(*ytor7>z9i?ZioDgVU;}52_NTtK
z8v4)D3;V(FY8*N?aJF<QK#q@jOQ$3_@YU%pEM0p2r(l<Jb_Wfz7Y07u4>nlN{NRR~
zNza}O+{2C@4%|?W)%;;fg3;H!e%cYZM@Xv)xd+|I4TaB#_gmhlyqT=G-`f{FvMOFC
z!QhTGAm84Zx!ak!7+igYuieaj*VPU4*{pi-rY<$TNAnTPTnlFIwt<K2;=ilYXB_Ir
z>*;Ii^cxjB2fR;v2fVwy+L@#IMn8u2=Keqfm)=pZOBn0yZr`>k72O|63~S+WJ-M^7
z6^}dv4-H0l!u<gON1bakzLQGf_s;!nb_#d}bPvz3dEm!^t1wgNfu98KaX<kG-vdaF
z{k_aF;c?VemscEhlzR}zcmE0SwFVUg+3Pd566#UE2lOS>b$i;~wOebdzE?5Dwk+Gc
zX5Gp!A&fe(?N~STiJwtkx95=4zo2X%G%V`Ez$c(S0-X8Wo*z4X?%Eez0k?Fd#OJR6
zQK{-~JXEH-Tc^vr+)C2j>UB4I-Ss}V1bU$Fb64<jy$t5R20!NK4qZN^hcobS1|H79
z|Kkiu@P6h*Ty#<#*YJKYs9JEk*DVk--P;})GR0SQLdG)|iNeWR5l`W{j70UH&Sw)S
zA9E_maxvfW5<|v&4$_=cLB<~8{~3E*aJ;W0)f$W~5u8}=js({SBs!x>pWZWgZ$f&^
zU~INj;U&V)3z_;&_96_;wGXcWKAz)3A6|i6run=r<O8B!H1|Je6vtW{YAI8!5SKgr
z{!LPS|6n?<r=|6Bv)tIwlIBv=fu<I@u~}|vT5VKFYa5$d8e1AS+B!0UF4$GAPQ`>6
zMHj3}pDpfUx-DLk+b?EkF4#SDw)$m^_EVvLIkQ^_7wk@2ze4>=M*E-;e<ZhG3i0B2
z2<u&}nn^bE?qUld;8n~nc-du&&&-uBW)nYwg3A>D73wd{<rfO^MQjRgt5$NcM|1fT
zbDaxrJ@h;m;!7A_qpjp(OChgfhd-8!XUsM(e451bT8J0N$5`*OiBk=nPNTdRd=5+4
zoopU4N_fsW;PkNeAI~=@%>R^SUC=Y)r!BZFaArAI+qnOHJWc1pc8(X%=YHWQcTR(h
zbO?S9n|1ju;CADBjq7_D#wSR0KE4HI2kaA!QjjQF@}T*d1sw-u3dSoHDCOxE6z%2>
zHSGHHPj32X(f+A|h8>X4sJE<pEys)Z&l7wCi}z<U$BXxQhwzW#qnWmIym-Gw0mr-u
z6Z1pwjY+^Ivjb6njpN1p^XGuu<$F?qFS2=lU*vdk1Fs4{*8I?U!0r0;H^A-kKpy~Z
zmj@~X9P>TaJkyNOx8{fL3VrK*I$@&FzcoKp4!B)E>mGn(9&!=0IX{PzdP+|Z56eT4
zo7w8`)q<Vd`!tQ^(?FU&rVU{t2(mL;IH8Ti5`&?b7S<EVlom=)u%X1*cr2nv!t#do
z8=LKwc!Eg_C6l2^$OGxgNj97ejYYI@dTeYGOiYr7*`fkfe^+R4#J^*Q9~z3rB1x~W
zQyv;0XWDmyO)b&*a6&Uh+K9Gt5W;Nm+}`W$3TT1uHW-vKLMj)ugQ=--Dxr;r;$cj8
zwSBwW+tuj@)TG99X8=L=RST%Xwc6GT5G2c}k&fUtpEsy&Yj58k=+pYVzF+{G=GnK;
zmus^m>=ebE1p9ANai%PskqP`<sW>L5Cdc&9AaFft@KGv7<B&NVXL3BDM`T#220b()
zq>*@99!y6e_Z<y08Ku!sYLv<0$vF5kxSlj>_C=DZXd+%9Xi%4o#6oBwO5-t|$vnF#
zLs1?{fT%|%;6G1j%E<)JTFQ}8vBO5g;DjW@)Yxi<1(o*<ff_Uu8jB7=9}+sc2Lw}~
zGGs8B44ZxoHgfUF@}D92{)0y}cb}$v9ewAadp>zbT{C?d1iV|*xk~px`i>%*m7!c>
zk()p^+tWQ!7Y<ii^sV;zKE4ZgaccjVQ{fiJ1n@MM^6?1W`vuIpp@6Xm+0Qu@kT6c+
zjGYhz#`pz`WDjo|PMCMc*o5rqetKMVl;Rsh+wehU<h$U9u?5-FJ@!DUp+(~tVy+$1
z-wSFOtB_3h-Q&VQGTiWQGv@vanBn~dyGr(SFFr5qX`Ix)b^Ol>d!KMf@z$)3J^HfR
zzW^BaD;FP%cxq1AQ`{-s7ww;n#a=2?xT+)^N?gkS^N1qxpMh*{UlI2FgB8?Kf60SY
z{*}d^-mg8P{a4VriKtzIegg$_`xK9th=wRGC4F2gGyM((w5Ro>??oPA-(psVvbFu+
zTkPq(C4J9qw%A+SKV`9}_+v`6|B1!kI)8tLdbpkOX9!g(|3Ke2t@>8^BG}ZJ>?xk9
zMW;YkeXINr(82km`~t-d(r2{)0Bmuo$)4gP`u=<Yodb#Okn0bv!!f8cw@=@N=5SCz
z*8Y-A{3FmY+vnmf(SU?bOhk6X=b+APPxn$u*i%2r1=*224+X?%{B)0O6oyuPF&$*i
zTmT@}m_v*L*&E;7@|9#yd?8d(+j%X<?u&z~niNH)MdWSMvtza&75(2W7Ve8sxek6b
W9^syU)3$5>{8Gc)dW&;w`~L>rS&M@J

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeSystem.cmake b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeSystem.cmake
new file mode 100644
index 0000000000..1927fbd348
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CMakeSystem.cmake
@@ -0,0 +1,15 @@
+set(CMAKE_HOST_SYSTEM "Linux-4.15.0-66-generic")
+set(CMAKE_HOST_SYSTEM_NAME "Linux")
+set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-66-generic")
+set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
+
+
+
+set(CMAKE_SYSTEM "Linux-4.15.0-66-generic")
+set(CMAKE_SYSTEM_NAME "Linux")
+set(CMAKE_SYSTEM_VERSION "4.15.0-66-generic")
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+
+set(CMAKE_CROSSCOMPILING "FALSE")
+
+set(CMAKE_SYSTEM_LOADED 1)
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/CMakeCCompilerId.c b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/CMakeCCompilerId.c
new file mode 100644
index 0000000000..570a15e994
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/CMakeCCompilerId.c
@@ -0,0 +1,544 @@
+#ifdef __cplusplus
+# error "A C++ compiler has been selected for C."
+#endif
+
+#if defined(__18CXX)
+# define ID_VOID_MAIN
+#endif
+
+
+/* Version number components: V=Version, R=Revision, P=Patch
+   Version date components:   YYYY=Year, MM=Month,   DD=Day  */
+
+#if defined(__INTEL_COMPILER) || defined(__ICC)
+# define COMPILER_ID "Intel"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+  /* __INTEL_COMPILER = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+  /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
+#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
+# define COMPILER_ID "Embarcadero"
+# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__     & 0xFFFF)
+
+#elif defined(__BORLANDC__)
+# define COMPILER_ID "Borland"
+  /* __BORLANDC__ = 0xVRR */
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
+
+#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+   /* __WATCOMC__ = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__WATCOMC__)
+# define COMPILER_ID "OpenWatcom"
+   /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__SUNPRO_C)
+# define COMPILER_ID "SunPro"
+# if __SUNPRO_C >= 0x5100
+   /* __SUNPRO_C = 0xVRRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_C    & 0xF)
+# else
+   /* __SUNPRO_CC = 0xVRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_C    & 0xF)
+# endif
+
+#elif defined(__HP_cc)
+# define COMPILER_ID "HP"
+  /* __HP_cc = VVRRPP */
+# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
+# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__HP_cc     % 100)
+
+#elif defined(__DECC)
+# define COMPILER_ID "Compaq"
+  /* __DECC_VER = VVRRTPPPP */
+# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
+# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000  % 100)
+# define COMPILER_VERSION_PATCH DEC(__DECC_VER         % 10000)
+
+#elif defined(__IBMC__) && defined(__COMPILER_VER__)
+# define COMPILER_ID "zOS"
+  /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
+
+#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
+# define COMPILER_ID "XL"
+  /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
+
+#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
+# define COMPILER_ID "VisualAge"
+  /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)
+
+#elif defined(__PGI)
+# define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI"
+  /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
+# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)
+
+#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
+# define COMPILER_ID "Fujitsu"
+
+#elif defined(__TINYC__)
+# define COMPILER_ID "TinyCC"
+
+#elif defined(__SCO_VERSION__)
+# define COMPILER_ID "SCO"
+
+#elif defined(__clang__) && defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__GNUC__)
+# define COMPILER_ID "GNU"
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# if defined(__GNUC_MINOR__)
+#  define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(_MSC_VER)
+# define COMPILER_ID "MSVC"
+  /* _MSC_VER = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+#  if _MSC_VER >= 1400
+    /* _MSC_FULL_VER = VVRRPPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#  else
+    /* _MSC_FULL_VER = VVRRPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#  endif
+# endif
+# if defined(_MSC_BUILD)
+#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
+
+#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+# define COMPILER_ID "ADSP"
+#if defined(__VISUALDSPVERSION__)
+  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
+#endif
+
+#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
+# define COMPILER_ID "IAR"
+
+#elif defined(__ARMCC_VERSION)
+# define COMPILER_ID "ARMCC"
+#if __ARMCC_VERSION >= 1000000
+  /* __ARMCC_VERSION = VRRPPPP */
+  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
+  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
+  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION     % 10000)
+#else
+  /* __ARMCC_VERSION = VRPPPP */
+  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
+  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
+  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION    % 10000)
+#endif
+
+
+#elif defined(SDCC)
+# define COMPILER_ID "SDCC"
+  /* SDCC = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(SDCC/100)
+#  define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(SDCC    % 10)
+
+#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
+# define COMPILER_ID "MIPSpro"
+# if defined(_SGI_COMPILER_VERSION)
+  /* _SGI_COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
+# else
+  /* _COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
+# endif
+
+
+/* These compilers are either not known or too old to define an
+  identification macro.  Try to identify the platform and guess that
+  it is the native compiler.  */
+#elif defined(__sgi)
+# define COMPILER_ID "MIPSpro"
+
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID "HP"
+
+#else /* unknown compiler */
+# define COMPILER_ID ""
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+   getting matched.  Store it in a pointer rather than an array
+   because some compilers will just produce instructions to fill the
+   array rather than assigning a pointer to a static array.  */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+/* Identify known platforms by name.  */
+#if defined(__linux) || defined(__linux__) || defined(linux)
+# define PLATFORM_ID "Linux"
+
+#elif defined(__CYGWIN__)
+# define PLATFORM_ID "Cygwin"
+
+#elif defined(__MINGW32__)
+# define PLATFORM_ID "MinGW"
+
+#elif defined(__APPLE__)
+# define PLATFORM_ID "Darwin"
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define PLATFORM_ID "Windows"
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+# define PLATFORM_ID "FreeBSD"
+
+#elif defined(__NetBSD__) || defined(__NetBSD)
+# define PLATFORM_ID "NetBSD"
+
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+# define PLATFORM_ID "OpenBSD"
+
+#elif defined(__sun) || defined(sun)
+# define PLATFORM_ID "SunOS"
+
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+# define PLATFORM_ID "AIX"
+
+#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
+# define PLATFORM_ID "IRIX"
+
+#elif defined(__hpux) || defined(__hpux__)
+# define PLATFORM_ID "HP-UX"
+
+#elif defined(__HAIKU__)
+# define PLATFORM_ID "Haiku"
+
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+# define PLATFORM_ID "BeOS"
+
+#elif defined(__QNX__) || defined(__QNXNTO__)
+# define PLATFORM_ID "QNX"
+
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+# define PLATFORM_ID "Tru64"
+
+#elif defined(__riscos) || defined(__riscos__)
+# define PLATFORM_ID "RISCos"
+
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+# define PLATFORM_ID "SINIX"
+
+#elif defined(__UNIX_SV__)
+# define PLATFORM_ID "UNIX_SV"
+
+#elif defined(__bsdos__)
+# define PLATFORM_ID "BSDOS"
+
+#elif defined(_MPRAS) || defined(MPRAS)
+# define PLATFORM_ID "MP-RAS"
+
+#elif defined(__osf) || defined(__osf__)
+# define PLATFORM_ID "OSF1"
+
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+# define PLATFORM_ID "SCO_SV"
+
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+# define PLATFORM_ID "ULTRIX"
+
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+# define PLATFORM_ID "Xenix"
+
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+#  define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+#  define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+#  define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+#  define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+#  define PLATFORM_ID ""
+# endif
+
+#else /* unknown platform */
+# define PLATFORM_ID ""
+
+#endif
+
+/* For windows compilers MSVC and Intel we can determine
+   the architecture of the compiler being used.  This is because
+   the compilers do not have flags that can change the architecture,
+   but rather depend on which compiler is being used
+*/
+#if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_M_IA64)
+#  define ARCHITECTURE_ID "IA64"
+
+# elif defined(_M_X64) || defined(_M_AMD64)
+#  define ARCHITECTURE_ID "x64"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# elif defined(_M_ARM)
+#  if _M_ARM == 4
+#   define ARCHITECTURE_ID "ARMV4I"
+#  elif _M_ARM == 5
+#   define ARCHITECTURE_ID "ARMV5I"
+#  else
+#   define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
+#  endif
+
+# elif defined(_M_MIPS)
+#  define ARCHITECTURE_ID "MIPS"
+
+# elif defined(_M_SH)
+#  define ARCHITECTURE_ID "SHx"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+#  define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
+#else
+#  define ARCHITECTURE_ID ""
+#endif
+
+/* Convert integer to decimal digit literals.  */
+#define DEC(n)                   \
+  ('0' + (((n) / 10000000)%10)), \
+  ('0' + (((n) / 1000000)%10)),  \
+  ('0' + (((n) / 100000)%10)),   \
+  ('0' + (((n) / 10000)%10)),    \
+  ('0' + (((n) / 1000)%10)),     \
+  ('0' + (((n) / 100)%10)),      \
+  ('0' + (((n) / 10)%10)),       \
+  ('0' +  ((n) % 10))
+
+/* Convert integer to hex digit literals.  */
+#define HEX(n)             \
+  ('0' + ((n)>>28 & 0xF)), \
+  ('0' + ((n)>>24 & 0xF)), \
+  ('0' + ((n)>>20 & 0xF)), \
+  ('0' + ((n)>>16 & 0xF)), \
+  ('0' + ((n)>>12 & 0xF)), \
+  ('0' + ((n)>>8  & 0xF)), \
+  ('0' + ((n)>>4  & 0xF)), \
+  ('0' + ((n)     & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+  'I', 'N', 'F', 'O', ':',
+  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+  COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+  '.', COMPILER_VERSION_MINOR,
+#  ifdef COMPILER_VERSION_PATCH
+   '.', COMPILER_VERSION_PATCH,
+#   ifdef COMPILER_VERSION_TWEAK
+    '.', COMPILER_VERSION_TWEAK,
+#   endif
+#  endif
+# endif
+  ']','\0'};
+#endif
+
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+  'I', 'N', 'F', 'O', ':',
+  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+  SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+  '.', SIMULATE_VERSION_MINOR,
+#  ifdef SIMULATE_VERSION_PATCH
+   '.', SIMULATE_VERSION_PATCH,
+#   ifdef SIMULATE_VERSION_TWEAK
+    '.', SIMULATE_VERSION_TWEAK,
+#   endif
+#  endif
+# endif
+  ']','\0'};
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+   getting matched.  Store it in a pointer rather than an array
+   because some compilers will just produce instructions to fill the
+   array rather than assigning a pointer to a static array.  */
+char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
+char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
+
+
+
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if !defined(__STDC_VERSION__)
+  "90"
+#elif __STDC_VERSION__ >= 201000L
+  "11"
+#elif __STDC_VERSION__ >= 199901L
+  "99"
+#else
+#endif
+"]";
+
+/*--------------------------------------------------------------------------*/
+
+#ifdef ID_VOID_MAIN
+void main() {}
+#else
+int main(int argc, char* argv[])
+{
+  int require = 0;
+  require += info_compiler[argc];
+  require += info_platform[argc];
+  require += info_arch[argc];
+#ifdef COMPILER_VERSION_MAJOR
+  require += info_version[argc];
+#endif
+#ifdef SIMULATE_ID
+  require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+  require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+  require += info_cray[argc];
+#endif
+  require += info_language_dialect_default[argc];
+  (void)argv;
+  return require;
+}
+#endif
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/a.out b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/a.out
new file mode 100755
index 0000000000000000000000000000000000000000..3e779cddc6621457f3aa2ca25bab3125c9c419b2
GIT binary patch
literal 8800
zcmeHMU2Ggz6~4Rczx=J&X+oW(kZDOIx8TXzIA+rdGV8z0M(ZRv>lS1-<FR*bFJ13O
zyR*TG3IsVxS)~b<KqxO%l?n(X9t=VyyfltnC4wgxQeJ3_`3XwXl%_vKc}TOIbLSlI
z?s$wU1aH35%(>^>^PO|<&)k`F=UcteKCj0kxOl}E1#*i%O^WQh5HD<%EXhJ*jnKq)
z@sOwkNiAHOY(Z+*nBFDROdCkg2ebyRkk=N3yqc^qeaIGr2fJ{DNYP)pXjHZ7uj*}<
zsSt`3AP!><_$3Q;SXP*76o*cfamXUBg>Wr|W4b_rG3EYY-|&i&y_i=64tWiU=#lp_
zMO`e1u3HJLKZi~w)v9QR<b+_#xGw>YAf)l1Nr0LM$lpria+~_clvuGVof_%v*p*JS
zrc;^1RO?izv$eBB&1cni*>ALuy88|cN>4nF3UC<nCb)17V0-<kH>UpFeE5ymGc9{h
zZ+btt^YR~dB9<?xe(bUiG&j0ve-dPhi(EiIMltM8VHj99@|Kyij7c+<0m=AeHbW9a
z?2AUax{Y?VUEK|q?1}Y2lo%(EXJKn<4YqxjeBEsvmNlFkS_+bH4%l*Bu88NNPv2_L
z&(_A*D?&d#XVu>L47BLeuQbft8l~L>&{WzPgL~t44Qj|wVB=ehB`7-|0e)=8))u1e
zok;Q3BYN?#`t;v#ABsh;&MnkxLce->Sdy!MtkJ}cUjy#LvBvE^LR@?b0vps@4*}7q
z@A~!P^<&#EqBRVsDSinXN{gU;O1g;8V-#a5^Dkrjp#JTDN&}bg`@n!+ysclpu~+w8
z(O<o9ZC<jrj;%Fr7x8)9|H&`>W}PBLp=l6+H!=`d{7UUlK;-#Adb*_eF|fU&Q2X}x
z0Jmi9Jp_~%;%}V*4AzU^xTO~hi&uN^$>`5+4uh4my|?rWx@V#BCDHiuoTvAmes*))
z3i5~D<kCRnODB~&t!$yR*2VJK-h1)+nebELC&R^3crYA`p4<6+g93wdt`+IwNbydj
z_*(SQ>vGO7f8@JS`lwXWPrqX+ZGYnNj23T3i+6g!LTS_M`t-a<-}83iCN7Afc=)T~
zc=$-zn4c++{|B&6q&-?Po~l(Rr>yE0Ina0T@zLz$(NsE_8-k}XUezqB+Kpq$Tt1b}
z3<d47Tct_|SAuaHaWrjOW7*u~P!x9u5}LWui6N>dQf4|iY8i>-m{~|$Lv3ww;o0VU
zA_(qrf8PN^@eI%y&?wOT_e-T80lfzF6`(yZ%j@C6!F>da=fr^UOa(mK*4H=8c<KWv
zm+ub1KPENoo4Y>vBmEcdl}ZY#`U8Fb=KYQ9zTR+B?A`jrW1rjc2#V2W4_wcK-69IY
z{=gY;_l7#}De!E!B|zK&aVD|7%OCizx69vr-q-6_&ee4JTb`@c{lPPJx<52s-|yFQ
z{!rK-4EtNU{0iuSewV*N_Uq>W4}zV_eFIIdmemnh9f8#mSRH}Y5%^z^z$|<ZVwoW-
z8MyH`D%17UFyqr?Z3FSw;Ik6T7J0{fYgpE{5zqM%r<2XpF5lIl!|ngNU&<onf>%RQ
z&iTk6eote$=+%&jwek-6BvH%*ur%95Y$nPCa}QbIa}^7}V_BcS6Y%>S%Y!x%Q{<oJ
z!^CskjE5vZ7UtnKF8iaAK777N-a~q~i4RdbiU03}^H`^&D=WoOr%BZTqT@vKME7-f
zKd!V4jubLhLD{Xshhb}HL2_;1Z0l5m9co+KqjrPR9&GCjb_Vx2eLHy{tiF&}bBZB<
z^e*Mom5n}Vv0U|Qmey0Xe(lmas+Pkla~TJps26VY<b&1A^IL6ajTm;dvvz4cRqL-4
z{9IMb*Na(KI~&A;tK7eIj#F)?QSftGEf0uAdVZ_rO>iEeRf=TY2buPqtNekb=e`o;
zgRfeC-mB%C1*Ub*;uD{Ma~C)HgM#zwN{kPmc6y$x<y(Z}D&HzFO?4KZ;N7a+;(=<7
zc&}8J*frb-J+Qkt<H!BaEBqqh*hkSa$`3i@D#@MuZjZEIjuYd+au_a;%XppuIoh9f
z*gqrnm(R<OLGISCmHK;8+Sw>(>ousA%N3})jRR`9+5f$SKCo;({7u?fKJT|kpWi2v
zg_}Jg%h%^d=zzy%J+y#)Ba9E8f?(l&KLm0`N~&+qNcr;h69ahw-g3_M(+={DV)^qm
zB<0n%kvl<loa^&hkSoj8#ScK<<lQ1#9P9Q)ltV=P{MHcmmr}k(gh-#?Q*$84alm6B
zEHYOG`X*cfu~mH8VgDrQFZwjl5Q1~+1+pJ>*nbn`XvaA|H^~m3J7JMIG|+d+j_$Ct
z0VYU6MMrrU<Twsa`>iYJ|4#Z{zOU{>I}oWt`&c{q!E@Utm|x8ij~LBad8;rsrjEk#
z;QsCbBN{mzGYpYP=91&7yp_xu)}%3-&SsK%&`4yB@pN{?OdAO+o68$!VM^d}OFC&K
z6YA%8@9A(?GR9Jwlwsy_=5ZsLv2w@7Sk9bG8i~T><Z*yha0X~vRjS?n=F`dUZaUS8
zBxJ081L6K&qxV1$1Zzjm^(uTq7(HJ(5blq3gH}b0JQf8J91$74x?x+>dj^EDFM6;m
z95oL1^&Rew8L@Czv==?d!_?7yLH0x#kyt+*_V5_R`nz$2V&+IXDU4*ov`mJS&tEmI
z^28O!6142YSkSFHnT57|)|fCe2{acu2wI6$#wg^I36aW-Weq-$Vka0EcFu0)^Dk%}
z$>+(1JOP&Aw3!(%nBy?`)rVHX*ni9zpjq!uoB6z)a_AcmGj`gw%hE2Lrr9yz;g}F=
z{`jP2jsUfCHl5&FDg$fls8BOmE2)ONBCVD=PTY8=ppFz$a2TIT2o<>rGe05J#PJN+
zv#FJ{TiB^oBgTNXTrzDUfNDq6mQdvgsZdqNv%p%(DY)ap1f{H;Gc`FuOK~CrMwqjq
z_L{U2T>siAsDT@EGBpYTWi2!h5?lZ(48BldGA3cgJD&Idmc{oiJo@E*-m3vu{_n(j
zhZMpMbt}uKfx&Nm*bZcgc{QSvEZduS-?dxe{2eNlc>XT6$lwlEB<jTXfcy^R2JHWW
zSCg6-NWk&eN@+QNB32xL3g$wLzv$I~!@Nlnq1#0M<HEl4`vJbBWO)+qm@6?}_%tb(
zLa2poZt3nEza!9sxenv`yE#M&SRElbe%539G_+&x#JooSHNq=|M?01AlUU&Q5RNJ1
zhY3GSc<v|rclQ4j;k(G-6yc{_@Mz14KMyjDi~Bi4_!+`;9!%zCtXxNm@5f5~Ea7Jz
z{bvmShhqAD2Y!L@3xwx*8SmtO=)f-$ev$C+V{jFP{j%sqsGth>pYx7uG~k>kv%Yiv
z|BUcFfBb#3NO(LWuPjO>1NC3Ph5i}Oc?|zw?QrNj{a<q6=jt?xn4=DT=)gP2@3+v7
zzm93RmhvM0-|EzN@~;85u>#NeQ!^Tc;?#HYe*qorKl|rAMfsTce*hM{%6QJl_<#5U
z8i&I3%l>&CT!6Mp|D3no#ZEzCeVZ%uEPodoD)CGC9XU`KNR)9*?>g}Oovjc)xB{NV
z_o0Hexc~gUd5G}rhxKVVm=!({pv>uq@%SgXvM`=$6Ew2#O1<-Rz=r?8DvN`azIp9e
j>V1de|0zw}r=W2cT-+bt7xDRY^B<%Gu_F%SPXGS~a;$ri

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
new file mode 100644
index 0000000000..e6d853637c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
@@ -0,0 +1,533 @@
+/* This source file must have a .cpp extension so that all C++ compilers
+   recognize the extension without flags.  Borland does not know .cxx for
+   example.  */
+#ifndef __cplusplus
+# error "A C compiler has been selected for C++."
+#endif
+
+
+/* Version number components: V=Version, R=Revision, P=Patch
+   Version date components:   YYYY=Year, MM=Month,   DD=Day  */
+
+#if defined(__COMO__)
+# define COMPILER_ID "Comeau"
+  /* __COMO_VERSION__ = VRR */
+# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
+
+#elif defined(__INTEL_COMPILER) || defined(__ICC)
+# define COMPILER_ID "Intel"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+  /* __INTEL_COMPILER = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+#  define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+  /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+#  define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
+#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
+# define COMPILER_ID "Embarcadero"
+# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__     & 0xFFFF)
+
+#elif defined(__BORLANDC__)
+# define COMPILER_ID "Borland"
+  /* __BORLANDC__ = 0xVRR */
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
+
+#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+   /* __WATCOMC__ = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__WATCOMC__)
+# define COMPILER_ID "OpenWatcom"
+   /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__SUNPRO_CC)
+# define COMPILER_ID "SunPro"
+# if __SUNPRO_CC >= 0x5100
+   /* __SUNPRO_CC = 0xVRRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+# else
+   /* __SUNPRO_CC = 0xVRP */
+#  define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
+#  define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
+#  define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+# endif
+
+#elif defined(__HP_aCC)
+# define COMPILER_ID "HP"
+  /* __HP_aCC = VVRRPP */
+# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
+# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)
+
+#elif defined(__DECCXX)
+# define COMPILER_ID "Compaq"
+  /* __DECCXX_VER = VVRRTPPPP */
+# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
+# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
+# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)
+
+#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
+# define COMPILER_ID "zOS"
+  /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)
+
+#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
+# define COMPILER_ID "XL"
+  /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)
+
+#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
+# define COMPILER_ID "VisualAge"
+  /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)
+
+#elif defined(__PGI)
+# define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI"
+  /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
+# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)
+
+#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
+# define COMPILER_ID "Fujitsu"
+
+#elif defined(__SCO_VERSION__)
+# define COMPILER_ID "SCO"
+
+#elif defined(__clang__) && defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+# if defined(_MSC_VER)
+#  define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+#  define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__GNUC__)
+# define COMPILER_ID "GNU"
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# if defined(__GNUC_MINOR__)
+#  define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+#  define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(_MSC_VER)
+# define COMPILER_ID "MSVC"
+  /* _MSC_VER = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+#  if _MSC_VER >= 1400
+    /* _MSC_FULL_VER = VVRRPPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#  else
+    /* _MSC_FULL_VER = VVRRPPPP */
+#   define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#  endif
+# endif
+# if defined(_MSC_BUILD)
+#  define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
+
+#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+# define COMPILER_ID "ADSP"
+#if defined(__VISUALDSPVERSION__)
+  /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
+#endif
+
+#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
+# define COMPILER_ID "IAR"
+
+#elif defined(__ARMCC_VERSION)
+# define COMPILER_ID "ARMCC"
+#if __ARMCC_VERSION >= 1000000
+  /* __ARMCC_VERSION = VRRPPPP */
+  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
+  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
+  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION     % 10000)
+#else
+  /* __ARMCC_VERSION = VRPPPP */
+  # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
+  # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
+  # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION    % 10000)
+#endif
+
+
+#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
+# define COMPILER_ID "MIPSpro"
+# if defined(_SGI_COMPILER_VERSION)
+  /* _SGI_COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
+# else
+  /* _COMPILER_VERSION = VRP */
+#  define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
+#  define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
+#  define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
+# endif
+
+
+/* These compilers are either not known or too old to define an
+  identification macro.  Try to identify the platform and guess that
+  it is the native compiler.  */
+#elif defined(__sgi)
+# define COMPILER_ID "MIPSpro"
+
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID "HP"
+
+#else /* unknown compiler */
+# define COMPILER_ID ""
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+   getting matched.  Store it in a pointer rather than an array
+   because some compilers will just produce instructions to fill the
+   array rather than assigning a pointer to a static array.  */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+/* Identify known platforms by name.  */
+#if defined(__linux) || defined(__linux__) || defined(linux)
+# define PLATFORM_ID "Linux"
+
+#elif defined(__CYGWIN__)
+# define PLATFORM_ID "Cygwin"
+
+#elif defined(__MINGW32__)
+# define PLATFORM_ID "MinGW"
+
+#elif defined(__APPLE__)
+# define PLATFORM_ID "Darwin"
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define PLATFORM_ID "Windows"
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+# define PLATFORM_ID "FreeBSD"
+
+#elif defined(__NetBSD__) || defined(__NetBSD)
+# define PLATFORM_ID "NetBSD"
+
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+# define PLATFORM_ID "OpenBSD"
+
+#elif defined(__sun) || defined(sun)
+# define PLATFORM_ID "SunOS"
+
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+# define PLATFORM_ID "AIX"
+
+#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
+# define PLATFORM_ID "IRIX"
+
+#elif defined(__hpux) || defined(__hpux__)
+# define PLATFORM_ID "HP-UX"
+
+#elif defined(__HAIKU__)
+# define PLATFORM_ID "Haiku"
+
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+# define PLATFORM_ID "BeOS"
+
+#elif defined(__QNX__) || defined(__QNXNTO__)
+# define PLATFORM_ID "QNX"
+
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+# define PLATFORM_ID "Tru64"
+
+#elif defined(__riscos) || defined(__riscos__)
+# define PLATFORM_ID "RISCos"
+
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+# define PLATFORM_ID "SINIX"
+
+#elif defined(__UNIX_SV__)
+# define PLATFORM_ID "UNIX_SV"
+
+#elif defined(__bsdos__)
+# define PLATFORM_ID "BSDOS"
+
+#elif defined(_MPRAS) || defined(MPRAS)
+# define PLATFORM_ID "MP-RAS"
+
+#elif defined(__osf) || defined(__osf__)
+# define PLATFORM_ID "OSF1"
+
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+# define PLATFORM_ID "SCO_SV"
+
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+# define PLATFORM_ID "ULTRIX"
+
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+# define PLATFORM_ID "Xenix"
+
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+#  define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+#  define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+#  define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+#  define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+#  define PLATFORM_ID ""
+# endif
+
+#else /* unknown platform */
+# define PLATFORM_ID ""
+
+#endif
+
+/* For windows compilers MSVC and Intel we can determine
+   the architecture of the compiler being used.  This is because
+   the compilers do not have flags that can change the architecture,
+   but rather depend on which compiler is being used
+*/
+#if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_M_IA64)
+#  define ARCHITECTURE_ID "IA64"
+
+# elif defined(_M_X64) || defined(_M_AMD64)
+#  define ARCHITECTURE_ID "x64"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# elif defined(_M_ARM)
+#  if _M_ARM == 4
+#   define ARCHITECTURE_ID "ARMV4I"
+#  elif _M_ARM == 5
+#   define ARCHITECTURE_ID "ARMV5I"
+#  else
+#   define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
+#  endif
+
+# elif defined(_M_MIPS)
+#  define ARCHITECTURE_ID "MIPS"
+
+# elif defined(_M_SH)
+#  define ARCHITECTURE_ID "SHx"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+#  define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
+#else
+#  define ARCHITECTURE_ID ""
+#endif
+
+/* Convert integer to decimal digit literals.  */
+#define DEC(n)                   \
+  ('0' + (((n) / 10000000)%10)), \
+  ('0' + (((n) / 1000000)%10)),  \
+  ('0' + (((n) / 100000)%10)),   \
+  ('0' + (((n) / 10000)%10)),    \
+  ('0' + (((n) / 1000)%10)),     \
+  ('0' + (((n) / 100)%10)),      \
+  ('0' + (((n) / 10)%10)),       \
+  ('0' +  ((n) % 10))
+
+/* Convert integer to hex digit literals.  */
+#define HEX(n)             \
+  ('0' + ((n)>>28 & 0xF)), \
+  ('0' + ((n)>>24 & 0xF)), \
+  ('0' + ((n)>>20 & 0xF)), \
+  ('0' + ((n)>>16 & 0xF)), \
+  ('0' + ((n)>>12 & 0xF)), \
+  ('0' + ((n)>>8  & 0xF)), \
+  ('0' + ((n)>>4  & 0xF)), \
+  ('0' + ((n)     & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+  'I', 'N', 'F', 'O', ':',
+  'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+  COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+  '.', COMPILER_VERSION_MINOR,
+#  ifdef COMPILER_VERSION_PATCH
+   '.', COMPILER_VERSION_PATCH,
+#   ifdef COMPILER_VERSION_TWEAK
+    '.', COMPILER_VERSION_TWEAK,
+#   endif
+#  endif
+# endif
+  ']','\0'};
+#endif
+
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+  'I', 'N', 'F', 'O', ':',
+  's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+  SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+  '.', SIMULATE_VERSION_MINOR,
+#  ifdef SIMULATE_VERSION_PATCH
+   '.', SIMULATE_VERSION_PATCH,
+#   ifdef SIMULATE_VERSION_TWEAK
+    '.', SIMULATE_VERSION_TWEAK,
+#   endif
+#  endif
+# endif
+  ']','\0'};
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+   getting matched.  Store it in a pointer rather than an array
+   because some compilers will just produce instructions to fill the
+   array rather than assigning a pointer to a static array.  */
+char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
+char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
+
+
+
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if __cplusplus >= 201402L
+  "14"
+#elif __cplusplus >= 201103L
+  "11"
+#else
+  "98"
+#endif
+"]";
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+  int require = 0;
+  require += info_compiler[argc];
+  require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+  require += info_version[argc];
+#endif
+#ifdef SIMULATE_ID
+  require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+  require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+  require += info_cray[argc];
+#endif
+  require += info_language_dialect_default[argc];
+  (void)argv;
+  return require;
+}
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/a.out b/hpvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/a.out
new file mode 100755
index 0000000000000000000000000000000000000000..8f3f2abf609f4888e5f8ff9281af2657a5e2094d
GIT binary patch
literal 8808
zcmeHMZ){W76~DIgj{=TEn-QQLPc2Akx4b%8NKLDi=ltUtIUx&9%a)lJCw3CIj-A@i
zETH{iON(kzx@em=zEDltI(1T2Wm47AX(~Y=*uG5RL;I!ukX55gTe{Jep-ck2bM8CG
ze_qT~P20Cz>AiE$pWiw6o_F8#J=fps3HCZ24#CYS9v8?hxil%V?n1n>Rk9@WiFHB~
z+r_=21|-#RX;OpK>M>m**G%ik&IPmzE}zp9_?(*TFum6jLj<ew2$5pEV$-N=(bsD&
zmZ=bm6d(@A>TydJ=!onv)o2_#QN|&QxMspN6OQR34U8$z59fwgi2Q||8gR&KNJO{1
z7b)6e8@OUdvHt=Fl~gOE?UECMDdWBdID(MHe<mJM4^q54<>ea9k14U@;Y572qy6DT
zv?UQwW@lPvd>t(v?P?~aw#j*;f3)4(KO`e@9u?ql%=f^BYXJ3*)Azl5^7YF<c=;bM
z9q;?=Ytx5+*LMrCd_nhfxAkDTse<)=AX6&H1<Yd%hut9z1N%nCjHFFtDiTkEWMV3n
zB#9yR1_Pa4Mw{BE?gCHNgLS|tah#mb?AG`?)P0#^t<;am9zGjd3X*T~SaMvhi07uy
zUaiwlREIYxLVs?-tX}>SX!O|&b>}UM{H{Sz<#&eQUcX&~9`ci@{BS7`ZRh>KkIz}w
zLbQGo$X!09=ib+6|8i|06u7joP^}65(zyXiF1=HwiRIq{?)rHB_HH50JP89E(pv_A
z=(8(sJ$L2swlnArhtm)~i;Dab7(XjRgwNwB##QFuLj92b{l7^E=We^efu6gjpIhFe
zJ1**%Z<~z;Z|m7x{dN&PZ^b|M)i>8GLS!3;0JxllfrT$t{|ZEo&t#;tiW>*EM`Wu%
z{xRSR&OSvzelh&vQNUn7_noVHF1vK8=cXL}iAFzoIni@fKczbs>)#OdZ!I`_Zt5o*
zTPw+>Vf`D&lp3vQxw*3CO*wcgAO0u(Pxy0r|BycvJh}6=It7w(vIXgZK<-8$_jd5X
zEAkniyX9K0zn#zP&wXMlt?zRFg1L`^xf|W!A%D+%`s{g!zWd|sN4Nln!~Spj!~R2l
z<NRDP-=D#{kp7BGL_Qb3Im%WYON%tn-@E_OvDDObJP}I|!`m1x>abU)Hx9?rnRqHW
z?6ul1l{)R*@rEtLbRuGor_xiyLHs(9Fp?gd9HxFW9!bQ;Od}c_k7N_(@NQpNIJUVS
z^FmDgzVEn|&wm?e2xt)KK1kIsfnET50cbls<qh!S;CBR@<LIDp%y=BzHq_S5Ichy9
zm%kl=e@I$bx61YqkL-VbGoM$`)a~hYH|?um|E;=XV$asc9{S3T`%#QOyWx5X{62#M
zzuR-%*|o98nSjWaE(+om(8o~U>Gu54+39Y2(beNtPF8ign_sBb-QMFhy4yEf+vnEO
zZlB-n^}Cxp-3r)&eW$xl&g)fxD=^>E?*_VDYik);%fMO&)-te`f&X;|=3zgGZH}m9
z;KqAYrW;5x=h9?vBk>ntTZwIpykosJB7572=lY1t$tKdv-)gX7{XcK#QwTZb)Q}Ww
zK8lC?X>4bl8WM4ryhA-n6zc$NO%@T2M44diAscL0vGH##+w(pF_vhF)TSUxIe3p+8
z&*Nr16alg^4?p8_J{sA>_C@jzvb#pSkMtz|zZ0%w?SU@dX&g10G#w;5K{P{jZ&%l&
zO7qZYHfd&+T`Fu0TRO6mYyEC(hw5!tTU#Hr6iS=7wZq%t-EEI;=UuS+d``_ShWgQ2
zsHaPnF3^}2?W+pwsocK0u#U>*u*xdr!6j-%rRU^=)yvPf+|N2OQqj*{h4oZ!zh3Zr
zRW9Ek<}3QyC>ATq-Gy_UazFKg-_vrrM=a6%TP|;a^9Zd}B>OI?v==JM?=HOer63pV
zYWaOHmp2M5>+H=Xz5wSgmE@ZR*VUyM7ryQEK9|e42&JNYtH3hV-duveRz-~ix>e%S
zd{JWc@H^;$uZw;B`2BMVxA54$qv#ps12(xza{G6;Tlz1K6UTw=09=j=`8*18^gnO&
ze_YzHel9PAywbdWFYP@7>tAeb@^1YORI>jQ=pC>g=4&;ww8(o>zB)gst>kA}!tP$R
zPW~nRtX>aJnUK}<YLxQT>$Vx>jtcAKagc9<yy58xHvT>62e~38<+mS6`RaA`6v#dB
z>t|nAI><MP)$iRiQeN&GxjFJ<U$>`0uB<i}uY$b6xkWVF*7KVvhY|66T}9YGNck4w
zBYXb+dI#i~2Rt6aCTm!r*WvPrt>U1~|4+$&$)$mX5L|12K>ocp|JOl|e(d?dgkxMh
zkHRKvYoOI2Z-9L2Ha`!5TtP!ydj#zv4|e}ucd%cA@oW;SzqetEtJ&g;v9y^nv*Y9H
z7#t7o>l!qIfde7K5YbpVHWAO5v9w`M8Doi5GL`|0Xv&yKq(&nNBWkA786%RN5qR8^
zh?%jd`pB-`?Ujv;@pv+BMAGTV5hIo~(?`U3Ix-bAqS>jbBLFGk46roIOuPCbPsh3r
z9_*rXoj_C_o1PZNH-fEg@#J`l&vC#{@1Vc0$LQ(rhACL{;eMIds4%*}-tX@Vbb(cg
zMjn=e2o8>n9-X}D-Gjo|8{FUN4;uS>dk^%4jF7)G*n<(|5$jkcE9WPSK&TInfH-rZ
zzAnsLC^DLe2_qJbm=T5)Ph~Z&^c)s43|7_=E!dWw*McsSGA1L*D7p*m2dij2X=F38
zsE}#kQz{OE<HE^VT0Rv6?Pw-LA>_HR1ScZNiELy79!dF8mN51mHU?=ebR{C0j9dsX
zH%>E7y5f|jUpyrfLd_hRG9#lv&9p@)xff5uBAXU!GG)e8e`lb@j7$(Wk<6;2**Kia
z$D=|;ZZeXY6l(NH68u@zOj{Z{%PV6H(4}LE2m+`#oiK$elcGXbok#&|#%AD-D-?`U
z@-eBgNm`SWQE<YX1+^BZh2Z{EV_*hhB2)1(7(>cL_aMP%u0p<r3i+RcrEhz||4SBs
zci~kpeAjtD$^Sob{lV_hwzNF}4DR{ivmjf@sS%ZA)whVhvz8Xl;h|HC=l!Wk4tKC2
zQ9HgH<Ts#3;P|JUnzTGc0v><0losnKVnsi6uqI;s8K(vu)=!cM-6Hb8E}T369>9)D
zwkP0@H5227OOtXbgr3jh3U_<{4uJ-19>(+j*++#~4Iz2_Y{&Fz&|?k7yhiag!YhPF
zKc(X*vA}&1=9KXxgdZV1&y(ZZ=l?9>JINu}fio5G=*y0O5o9<np649JpCdfi!{lC$
zmHS9@aFycc2|sU}KV$g+D5gKL;TH+NNO&GE<L&%u8-9uKON4(P2UpTKE{lEv9W>$j
zbNz9F63+E9+uPUwuL;l3kM}c6gvYb;(x#L$(Eklw7@zT6&+z}O?KXRR{IfRvLX9R7
z3pAnYHoQH5e+0c7E=pISKH~pf?e=#5ZNS!-;JJ=!LZ{H|_ICcyV1x7L_*}0jpA-K9
zU~#I9=emsl7hgo@(D?asd|n5qKvx={>$er06g0NCxFXN;zk{L_U#RmafWkncjAOcD
z!}GpcA-wkvcoyG=4*KHx^Zs&x@EnKjDILrT7YI;hkHdKUN4c~yo@oOpId-Yt&*-2H
t{|hT^Hde;wwO?xYJdOVqdT?I^C61Bj!{0@GKP$!e(!tn-&AC1PzX7*tb}aw^

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/CMakeOutput.log b/hpvm/projects/llvm-cbe/build/CMakeFiles/CMakeOutput.log
new file mode 100644
index 0000000000..34bcb9577d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/CMakeOutput.log
@@ -0,0 +1,554 @@
+The system is: Linux - 4.15.0-66-generic - x86_64
+Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
+Compiler: /usr/bin/cc 
+Build flags: 
+Id flags: 
+
+The output was:
+0
+
+
+Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
+
+The C compiler identification is GNU, found in "/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdC/a.out"
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
+Compiler: /usr/bin/c++ 
+Build flags: 
+Id flags: 
+
+The output was:
+0
+
+
+Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
+
+The CXX compiler identification is GNU, found in "/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/3.5.1/CompilerIdCXX/a.out"
+
+Determining if the C compiler works passed with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_a1887/fast"
+/usr/bin/make -f CMakeFiles/cmTC_a1887.dir/build.make CMakeFiles/cmTC_a1887.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_a1887.dir/testCCompiler.c.o
+/usr/bin/cc     -o CMakeFiles/cmTC_a1887.dir/testCCompiler.c.o   -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp/testCCompiler.c
+Linking C executable cmTC_a1887
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a1887.dir/link.txt --verbose=1
+/usr/bin/cc       CMakeFiles/cmTC_a1887.dir/testCCompiler.c.o  -o cmTC_a1887 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+Detecting C compiler ABI info compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_8b6ac/fast"
+/usr/bin/make -f CMakeFiles/cmTC_8b6ac.dir/build.make CMakeFiles/cmTC_8b6ac.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o
+/usr/bin/cc     -o CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o   -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c
+Linking C executable cmTC_8b6ac
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8b6ac.dir/link.txt --verbose=1
+/usr/bin/cc      -v CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o  -o cmTC_8b6ac -rdynamic  
+Using built-in specs.
+COLLECT_GCC=/usr/bin/cc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
+Target: x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Thread model: posix
+gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 
+COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
+LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
+COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_8b6ac' '-rdynamic' '-mtune=generic' '-march=x86-64'
+ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cckmhPLv.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_8b6ac /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+Parsed C implicit link information from above output:
+  link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
+  ignore line: [Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp]
+  ignore line: []
+  ignore line: [Run Build Command:"/usr/bin/make" "cmTC_8b6ac/fast"]
+  ignore line: [/usr/bin/make -f CMakeFiles/cmTC_8b6ac.dir/build.make CMakeFiles/cmTC_8b6ac.dir/build]
+  ignore line: [make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp']
+  ignore line: [Building C object CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o]
+  ignore line: [/usr/bin/cc     -o CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o   -c /usr/share/cmake-3.5/Modules/CMakeCCompilerABI.c]
+  ignore line: [Linking C executable cmTC_8b6ac]
+  ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8b6ac.dir/link.txt --verbose=1]
+  ignore line: [/usr/bin/cc      -v CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o  -o cmTC_8b6ac -rdynamic  ]
+  ignore line: [Using built-in specs.]
+  ignore line: [COLLECT_GCC=/usr/bin/cc]
+  ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper]
+  ignore line: [Target: x86_64-linux-gnu]
+  ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
+  ignore line: [Thread model: posix]
+  ignore line: [gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) ]
+  ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/]
+  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/]
+  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_8b6ac' '-rdynamic' '-mtune=generic' '-march=x86-64']
+  link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/cckmhPLv.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_8b6ac /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/collect2] ==> ignore
+    arg [-plugin] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so] ==> ignore
+    arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper] ==> ignore
+    arg [-plugin-opt=-fresolution=/tmp/cckmhPLv.res] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+    arg [-plugin-opt=-pass-through=-lc] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+    arg [--sysroot=/] ==> ignore
+    arg [--build-id] ==> ignore
+    arg [--eh-frame-hdr] ==> ignore
+    arg [-m] ==> ignore
+    arg [elf_x86_64] ==> ignore
+    arg [--hash-style=gnu] ==> ignore
+    arg [--as-needed] ==> ignore
+    arg [-export-dynamic] ==> ignore
+    arg [-dynamic-linker] ==> ignore
+    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
+    arg [-zrelro] ==> ignore
+    arg [-o] ==> ignore
+    arg [cmTC_8b6ac] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o] ==> ignore
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib]
+    arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
+    arg [-L/lib/../lib] ==> dir [/lib/../lib]
+    arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
+    arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..]
+    arg [CMakeFiles/cmTC_8b6ac.dir/CMakeCCompilerABI.c.o] ==> ignore
+    arg [-lgcc] ==> lib [gcc]
+    arg [--as-needed] ==> ignore
+    arg [-lgcc_s] ==> lib [gcc_s]
+    arg [--no-as-needed] ==> ignore
+    arg [-lc] ==> lib [c]
+    arg [-lgcc] ==> lib [gcc]
+    arg [--as-needed] ==> ignore
+    arg [-lgcc_s] ==> lib [gcc_s]
+    arg [--no-as-needed] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o] ==> ignore
+  remove lib [gcc]
+  remove lib [gcc_s]
+  remove lib [gcc]
+  remove lib [gcc_s]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5] ==> [/usr/lib/gcc/x86_64-linux-gnu/5]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib] ==> [/usr/lib]
+  collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
+  collapse library dir [/lib/../lib] ==> [/lib]
+  collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+  collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> [/usr/lib]
+  implicit libs: [c]
+  implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/5;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
+  implicit fwks: []
+
+
+
+
+Detecting C [-std=c11] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_58d37/fast"
+/usr/bin/make -f CMakeFiles/cmTC_58d37.dir/build.make CMakeFiles/cmTC_58d37.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_58d37.dir/feature_tests.c.o
+/usr/bin/cc    -std=c11 -o CMakeFiles/cmTC_58d37.dir/feature_tests.c.o   -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
+Linking C executable cmTC_58d37
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_58d37.dir/link.txt --verbose=1
+/usr/bin/cc       CMakeFiles/cmTC_58d37.dir/feature_tests.c.o  -o cmTC_58d37 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: C_FEATURE:1c_function_prototypes
+    Feature record: C_FEATURE:1c_restrict
+    Feature record: C_FEATURE:1c_static_assert
+    Feature record: C_FEATURE:1c_variadic_macros
+
+
+Detecting C [-std=c99] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_47bc6/fast"
+/usr/bin/make -f CMakeFiles/cmTC_47bc6.dir/build.make CMakeFiles/cmTC_47bc6.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_47bc6.dir/feature_tests.c.o
+/usr/bin/cc    -std=c99 -o CMakeFiles/cmTC_47bc6.dir/feature_tests.c.o   -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
+Linking C executable cmTC_47bc6
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_47bc6.dir/link.txt --verbose=1
+/usr/bin/cc       CMakeFiles/cmTC_47bc6.dir/feature_tests.c.o  -o cmTC_47bc6 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: C_FEATURE:1c_function_prototypes
+    Feature record: C_FEATURE:1c_restrict
+    Feature record: C_FEATURE:0c_static_assert
+    Feature record: C_FEATURE:1c_variadic_macros
+
+
+Detecting C [-std=c90] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_bafe8/fast"
+/usr/bin/make -f CMakeFiles/cmTC_bafe8.dir/build.make CMakeFiles/cmTC_bafe8.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_bafe8.dir/feature_tests.c.o
+/usr/bin/cc    -std=c90 -o CMakeFiles/cmTC_bafe8.dir/feature_tests.c.o   -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
+Linking C executable cmTC_bafe8
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bafe8.dir/link.txt --verbose=1
+/usr/bin/cc       CMakeFiles/cmTC_bafe8.dir/feature_tests.c.o  -o cmTC_bafe8 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: C_FEATURE:1c_function_prototypes
+    Feature record: C_FEATURE:0c_restrict
+    Feature record: C_FEATURE:0c_static_assert
+    Feature record: C_FEATURE:0c_variadic_macros
+Determining if the CXX compiler works passed with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_a4db2/fast"
+/usr/bin/make -f CMakeFiles/cmTC_a4db2.dir/build.make CMakeFiles/cmTC_a4db2.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_a4db2.dir/testCXXCompiler.cxx.o
+/usr/bin/c++      -o CMakeFiles/cmTC_a4db2.dir/testCXXCompiler.cxx.o -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
+Linking CXX executable cmTC_a4db2
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a4db2.dir/link.txt --verbose=1
+/usr/bin/c++        CMakeFiles/cmTC_a4db2.dir/testCXXCompiler.cxx.o  -o cmTC_a4db2 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+Detecting CXX compiler ABI info compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_9fb11/fast"
+/usr/bin/make -f CMakeFiles/cmTC_9fb11.dir/build.make CMakeFiles/cmTC_9fb11.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o
+/usr/bin/c++      -o CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp
+Linking CXX executable cmTC_9fb11
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9fb11.dir/link.txt --verbose=1
+/usr/bin/c++       -v CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o  -o cmTC_9fb11 -rdynamic  
+Using built-in specs.
+COLLECT_GCC=/usr/bin/c++
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
+Target: x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Thread model: posix
+gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 
+COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
+LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
+COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_9fb11' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
+ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccHuuX3E.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_9fb11 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+Parsed CXX implicit link information from above output:
+  link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
+  ignore line: [Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp]
+  ignore line: []
+  ignore line: [Run Build Command:"/usr/bin/make" "cmTC_9fb11/fast"]
+  ignore line: [/usr/bin/make -f CMakeFiles/cmTC_9fb11.dir/build.make CMakeFiles/cmTC_9fb11.dir/build]
+  ignore line: [make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp']
+  ignore line: [Building CXX object CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o]
+  ignore line: [/usr/bin/c++      -o CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.5/Modules/CMakeCXXCompilerABI.cpp]
+  ignore line: [Linking CXX executable cmTC_9fb11]
+  ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9fb11.dir/link.txt --verbose=1]
+  ignore line: [/usr/bin/c++       -v CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o  -o cmTC_9fb11 -rdynamic  ]
+  ignore line: [Using built-in specs.]
+  ignore line: [COLLECT_GCC=/usr/bin/c++]
+  ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper]
+  ignore line: [Target: x86_64-linux-gnu]
+  ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.11' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
+  ignore line: [Thread model: posix]
+  ignore line: [gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11) ]
+  ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/]
+  ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/]
+  ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_9fb11' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
+  link line: [ /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccHuuX3E.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o cmTC_9fb11 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o]
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/collect2] ==> ignore
+    arg [-plugin] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so] ==> ignore
+    arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper] ==> ignore
+    arg [-plugin-opt=-fresolution=/tmp/ccHuuX3E.res] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+    arg [-plugin-opt=-pass-through=-lc] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+    arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+    arg [--sysroot=/] ==> ignore
+    arg [--build-id] ==> ignore
+    arg [--eh-frame-hdr] ==> ignore
+    arg [-m] ==> ignore
+    arg [elf_x86_64] ==> ignore
+    arg [--hash-style=gnu] ==> ignore
+    arg [--as-needed] ==> ignore
+    arg [-export-dynamic] ==> ignore
+    arg [-dynamic-linker] ==> ignore
+    arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
+    arg [-zrelro] ==> ignore
+    arg [-o] ==> ignore
+    arg [cmTC_9fb11] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o] ==> ignore
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib]
+    arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
+    arg [-L/lib/../lib] ==> dir [/lib/../lib]
+    arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
+    arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
+    arg [-L/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..]
+    arg [CMakeFiles/cmTC_9fb11.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
+    arg [-lstdc++] ==> lib [stdc++]
+    arg [-lm] ==> lib [m]
+    arg [-lgcc_s] ==> lib [gcc_s]
+    arg [-lgcc] ==> lib [gcc]
+    arg [-lc] ==> lib [c]
+    arg [-lgcc_s] ==> lib [gcc_s]
+    arg [-lgcc] ==> lib [gcc]
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/crtend.o] ==> ignore
+    arg [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o] ==> ignore
+  remove lib [gcc_s]
+  remove lib [gcc]
+  remove lib [gcc_s]
+  remove lib [gcc]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5] ==> [/usr/lib/gcc/x86_64-linux-gnu/5]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib] ==> [/usr/lib]
+  collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
+  collapse library dir [/lib/../lib] ==> [/lib]
+  collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+  collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
+  collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/5/../../..] ==> [/usr/lib]
+  implicit libs: [stdc++;m;c]
+  implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/5;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
+  implicit fwks: []
+
+
+
+
+Detecting CXX [-std=c++14] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_72948/fast"
+/usr/bin/make -f CMakeFiles/cmTC_72948.dir/build.make CMakeFiles/cmTC_72948.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_72948.dir/feature_tests.cxx.o
+/usr/bin/c++     -std=c++14 -o CMakeFiles/cmTC_72948.dir/feature_tests.cxx.o -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
+Linking CXX executable cmTC_72948
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_72948.dir/link.txt --verbose=1
+/usr/bin/c++        CMakeFiles/cmTC_72948.dir/feature_tests.cxx.o  -o cmTC_72948 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: CXX_FEATURE:1cxx_aggregate_default_initializers
+    Feature record: CXX_FEATURE:1cxx_alias_templates
+    Feature record: CXX_FEATURE:1cxx_alignas
+    Feature record: CXX_FEATURE:1cxx_alignof
+    Feature record: CXX_FEATURE:1cxx_attributes
+    Feature record: CXX_FEATURE:1cxx_attribute_deprecated
+    Feature record: CXX_FEATURE:1cxx_auto_type
+    Feature record: CXX_FEATURE:1cxx_binary_literals
+    Feature record: CXX_FEATURE:1cxx_constexpr
+    Feature record: CXX_FEATURE:1cxx_contextual_conversions
+    Feature record: CXX_FEATURE:1cxx_decltype
+    Feature record: CXX_FEATURE:1cxx_decltype_auto
+    Feature record: CXX_FEATURE:1cxx_decltype_incomplete_return_types
+    Feature record: CXX_FEATURE:1cxx_default_function_template_args
+    Feature record: CXX_FEATURE:1cxx_defaulted_functions
+    Feature record: CXX_FEATURE:1cxx_defaulted_move_initializers
+    Feature record: CXX_FEATURE:1cxx_delegating_constructors
+    Feature record: CXX_FEATURE:1cxx_deleted_functions
+    Feature record: CXX_FEATURE:1cxx_digit_separators
+    Feature record: CXX_FEATURE:1cxx_enum_forward_declarations
+    Feature record: CXX_FEATURE:1cxx_explicit_conversions
+    Feature record: CXX_FEATURE:1cxx_extended_friend_declarations
+    Feature record: CXX_FEATURE:1cxx_extern_templates
+    Feature record: CXX_FEATURE:1cxx_final
+    Feature record: CXX_FEATURE:1cxx_func_identifier
+    Feature record: CXX_FEATURE:1cxx_generalized_initializers
+    Feature record: CXX_FEATURE:1cxx_generic_lambdas
+    Feature record: CXX_FEATURE:1cxx_inheriting_constructors
+    Feature record: CXX_FEATURE:1cxx_inline_namespaces
+    Feature record: CXX_FEATURE:1cxx_lambdas
+    Feature record: CXX_FEATURE:1cxx_lambda_init_captures
+    Feature record: CXX_FEATURE:1cxx_local_type_template_args
+    Feature record: CXX_FEATURE:1cxx_long_long_type
+    Feature record: CXX_FEATURE:1cxx_noexcept
+    Feature record: CXX_FEATURE:1cxx_nonstatic_member_init
+    Feature record: CXX_FEATURE:1cxx_nullptr
+    Feature record: CXX_FEATURE:1cxx_override
+    Feature record: CXX_FEATURE:1cxx_range_for
+    Feature record: CXX_FEATURE:1cxx_raw_string_literals
+    Feature record: CXX_FEATURE:1cxx_reference_qualified_functions
+    Feature record: CXX_FEATURE:1cxx_relaxed_constexpr
+    Feature record: CXX_FEATURE:1cxx_return_type_deduction
+    Feature record: CXX_FEATURE:1cxx_right_angle_brackets
+    Feature record: CXX_FEATURE:1cxx_rvalue_references
+    Feature record: CXX_FEATURE:1cxx_sizeof_member
+    Feature record: CXX_FEATURE:1cxx_static_assert
+    Feature record: CXX_FEATURE:1cxx_strong_enums
+    Feature record: CXX_FEATURE:1cxx_template_template_parameters
+    Feature record: CXX_FEATURE:1cxx_thread_local
+    Feature record: CXX_FEATURE:1cxx_trailing_return_types
+    Feature record: CXX_FEATURE:1cxx_unicode_literals
+    Feature record: CXX_FEATURE:1cxx_uniform_initialization
+    Feature record: CXX_FEATURE:1cxx_unrestricted_unions
+    Feature record: CXX_FEATURE:1cxx_user_literals
+    Feature record: CXX_FEATURE:1cxx_variable_templates
+    Feature record: CXX_FEATURE:1cxx_variadic_macros
+    Feature record: CXX_FEATURE:1cxx_variadic_templates
+
+
+Detecting CXX [-std=c++11] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_4b9af/fast"
+/usr/bin/make -f CMakeFiles/cmTC_4b9af.dir/build.make CMakeFiles/cmTC_4b9af.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_4b9af.dir/feature_tests.cxx.o
+/usr/bin/c++     -std=c++11 -o CMakeFiles/cmTC_4b9af.dir/feature_tests.cxx.o -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
+Linking CXX executable cmTC_4b9af
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4b9af.dir/link.txt --verbose=1
+/usr/bin/c++        CMakeFiles/cmTC_4b9af.dir/feature_tests.cxx.o  -o cmTC_4b9af -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: CXX_FEATURE:0cxx_aggregate_default_initializers
+    Feature record: CXX_FEATURE:1cxx_alias_templates
+    Feature record: CXX_FEATURE:1cxx_alignas
+    Feature record: CXX_FEATURE:1cxx_alignof
+    Feature record: CXX_FEATURE:1cxx_attributes
+    Feature record: CXX_FEATURE:0cxx_attribute_deprecated
+    Feature record: CXX_FEATURE:1cxx_auto_type
+    Feature record: CXX_FEATURE:0cxx_binary_literals
+    Feature record: CXX_FEATURE:1cxx_constexpr
+    Feature record: CXX_FEATURE:0cxx_contextual_conversions
+    Feature record: CXX_FEATURE:1cxx_decltype
+    Feature record: CXX_FEATURE:0cxx_decltype_auto
+    Feature record: CXX_FEATURE:1cxx_decltype_incomplete_return_types
+    Feature record: CXX_FEATURE:1cxx_default_function_template_args
+    Feature record: CXX_FEATURE:1cxx_defaulted_functions
+    Feature record: CXX_FEATURE:1cxx_defaulted_move_initializers
+    Feature record: CXX_FEATURE:1cxx_delegating_constructors
+    Feature record: CXX_FEATURE:1cxx_deleted_functions
+    Feature record: CXX_FEATURE:0cxx_digit_separators
+    Feature record: CXX_FEATURE:1cxx_enum_forward_declarations
+    Feature record: CXX_FEATURE:1cxx_explicit_conversions
+    Feature record: CXX_FEATURE:1cxx_extended_friend_declarations
+    Feature record: CXX_FEATURE:1cxx_extern_templates
+    Feature record: CXX_FEATURE:1cxx_final
+    Feature record: CXX_FEATURE:1cxx_func_identifier
+    Feature record: CXX_FEATURE:1cxx_generalized_initializers
+    Feature record: CXX_FEATURE:0cxx_generic_lambdas
+    Feature record: CXX_FEATURE:1cxx_inheriting_constructors
+    Feature record: CXX_FEATURE:1cxx_inline_namespaces
+    Feature record: CXX_FEATURE:1cxx_lambdas
+    Feature record: CXX_FEATURE:0cxx_lambda_init_captures
+    Feature record: CXX_FEATURE:1cxx_local_type_template_args
+    Feature record: CXX_FEATURE:1cxx_long_long_type
+    Feature record: CXX_FEATURE:1cxx_noexcept
+    Feature record: CXX_FEATURE:1cxx_nonstatic_member_init
+    Feature record: CXX_FEATURE:1cxx_nullptr
+    Feature record: CXX_FEATURE:1cxx_override
+    Feature record: CXX_FEATURE:1cxx_range_for
+    Feature record: CXX_FEATURE:1cxx_raw_string_literals
+    Feature record: CXX_FEATURE:1cxx_reference_qualified_functions
+    Feature record: CXX_FEATURE:0cxx_relaxed_constexpr
+    Feature record: CXX_FEATURE:0cxx_return_type_deduction
+    Feature record: CXX_FEATURE:1cxx_right_angle_brackets
+    Feature record: CXX_FEATURE:1cxx_rvalue_references
+    Feature record: CXX_FEATURE:1cxx_sizeof_member
+    Feature record: CXX_FEATURE:1cxx_static_assert
+    Feature record: CXX_FEATURE:1cxx_strong_enums
+    Feature record: CXX_FEATURE:1cxx_template_template_parameters
+    Feature record: CXX_FEATURE:1cxx_thread_local
+    Feature record: CXX_FEATURE:1cxx_trailing_return_types
+    Feature record: CXX_FEATURE:1cxx_unicode_literals
+    Feature record: CXX_FEATURE:1cxx_uniform_initialization
+    Feature record: CXX_FEATURE:1cxx_unrestricted_unions
+    Feature record: CXX_FEATURE:1cxx_user_literals
+    Feature record: CXX_FEATURE:0cxx_variable_templates
+    Feature record: CXX_FEATURE:1cxx_variadic_macros
+    Feature record: CXX_FEATURE:1cxx_variadic_templates
+
+
+Detecting CXX [-std=c++98] compiler features compiled with the following output:
+Change Dir: /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp
+
+Run Build Command:"/usr/bin/make" "cmTC_1ceb0/fast"
+/usr/bin/make -f CMakeFiles/cmTC_1ceb0.dir/build.make CMakeFiles/cmTC_1ceb0.dir/build
+make[1]: Entering directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+Building CXX object CMakeFiles/cmTC_1ceb0.dir/feature_tests.cxx.o
+/usr/bin/c++     -std=c++98 -o CMakeFiles/cmTC_1ceb0.dir/feature_tests.cxx.o -c /home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
+Linking CXX executable cmTC_1ceb0
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1ceb0.dir/link.txt --verbose=1
+/usr/bin/c++        CMakeFiles/cmTC_1ceb0.dir/feature_tests.cxx.o  -o cmTC_1ceb0 -rdynamic 
+make[1]: Leaving directory '/home/hsharif3/Gitlab/hpvm-fpga/hpvm/llvm/projects/llvm-cbe/build/CMakeFiles/CMakeTmp'
+
+
+    Feature record: CXX_FEATURE:0cxx_aggregate_default_initializers
+    Feature record: CXX_FEATURE:0cxx_alias_templates
+    Feature record: CXX_FEATURE:0cxx_alignas
+    Feature record: CXX_FEATURE:0cxx_alignof
+    Feature record: CXX_FEATURE:0cxx_attributes
+    Feature record: CXX_FEATURE:0cxx_attribute_deprecated
+    Feature record: CXX_FEATURE:0cxx_auto_type
+    Feature record: CXX_FEATURE:0cxx_binary_literals
+    Feature record: CXX_FEATURE:0cxx_constexpr
+    Feature record: CXX_FEATURE:0cxx_contextual_conversions
+    Feature record: CXX_FEATURE:0cxx_decltype
+    Feature record: CXX_FEATURE:0cxx_decltype_auto
+    Feature record: CXX_FEATURE:0cxx_decltype_incomplete_return_types
+    Feature record: CXX_FEATURE:0cxx_default_function_template_args
+    Feature record: CXX_FEATURE:0cxx_defaulted_functions
+    Feature record: CXX_FEATURE:0cxx_defaulted_move_initializers
+    Feature record: CXX_FEATURE:0cxx_delegating_constructors
+    Feature record: CXX_FEATURE:0cxx_deleted_functions
+    Feature record: CXX_FEATURE:0cxx_digit_separators
+    Feature record: CXX_FEATURE:0cxx_enum_forward_declarations
+    Feature record: CXX_FEATURE:0cxx_explicit_conversions
+    Feature record: CXX_FEATURE:0cxx_extended_friend_declarations
+    Feature record: CXX_FEATURE:0cxx_extern_templates
+    Feature record: CXX_FEATURE:0cxx_final
+    Feature record: CXX_FEATURE:0cxx_func_identifier
+    Feature record: CXX_FEATURE:0cxx_generalized_initializers
+    Feature record: CXX_FEATURE:0cxx_generic_lambdas
+    Feature record: CXX_FEATURE:0cxx_inheriting_constructors
+    Feature record: CXX_FEATURE:0cxx_inline_namespaces
+    Feature record: CXX_FEATURE:0cxx_lambdas
+    Feature record: CXX_FEATURE:0cxx_lambda_init_captures
+    Feature record: CXX_FEATURE:0cxx_local_type_template_args
+    Feature record: CXX_FEATURE:0cxx_long_long_type
+    Feature record: CXX_FEATURE:0cxx_noexcept
+    Feature record: CXX_FEATURE:0cxx_nonstatic_member_init
+    Feature record: CXX_FEATURE:0cxx_nullptr
+    Feature record: CXX_FEATURE:0cxx_override
+    Feature record: CXX_FEATURE:0cxx_range_for
+    Feature record: CXX_FEATURE:0cxx_raw_string_literals
+    Feature record: CXX_FEATURE:0cxx_reference_qualified_functions
+    Feature record: CXX_FEATURE:0cxx_relaxed_constexpr
+    Feature record: CXX_FEATURE:0cxx_return_type_deduction
+    Feature record: CXX_FEATURE:0cxx_right_angle_brackets
+    Feature record: CXX_FEATURE:0cxx_rvalue_references
+    Feature record: CXX_FEATURE:0cxx_sizeof_member
+    Feature record: CXX_FEATURE:0cxx_static_assert
+    Feature record: CXX_FEATURE:0cxx_strong_enums
+    Feature record: CXX_FEATURE:1cxx_template_template_parameters
+    Feature record: CXX_FEATURE:0cxx_thread_local
+    Feature record: CXX_FEATURE:0cxx_trailing_return_types
+    Feature record: CXX_FEATURE:0cxx_unicode_literals
+    Feature record: CXX_FEATURE:0cxx_uniform_initialization
+    Feature record: CXX_FEATURE:0cxx_unrestricted_unions
+    Feature record: CXX_FEATURE:0cxx_user_literals
+    Feature record: CXX_FEATURE:0cxx_variable_templates
+    Feature record: CXX_FEATURE:0cxx_variadic_macros
+    Feature record: CXX_FEATURE:0cxx_variadic_templates
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/cmake.check_cache b/hpvm/projects/llvm-cbe/build/CMakeFiles/cmake.check_cache
new file mode 100644
index 0000000000..3dccd73172
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/cmake.check_cache
@@ -0,0 +1 @@
+# This file is generated by cmake for dependency checking of the CMakeCache.txt file
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.bin b/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.bin
new file mode 100755
index 0000000000000000000000000000000000000000..1b62f454d8a2b71fdf6dd528f88f1c018560a607
GIT binary patch
literal 12696
zcmeGiZEPIHb?(k~9Fm;vkbsj=vTZ}_Q2DTfV+^Qe&tExHCj`ePX^UC*Zuia$cY9`U
zFW4!isRF1L4UK4}MpX-~Dx_562knnSg#?L$2q0ArZHW+6RT>f$2$Ud5YE?AX_h#qa
z?d^>nP}M(`$J%}K-n{qb?VC4qGoJU|f#Jb$D8#6Q+1D6iTN_kP^4^TSzMi9k*25Mv
zm91r0um+&i!=v&RgkFu{tWZs`QSe0o*1^*g_6R*;l~)K};gO*SuaJcZvA;@DMb(4r
zT0E2>V+tpr9NOA^B}W0?$twgEVMm*QB!?)<wF$X4AxH42FpMC5AATD?qe9<kSOpAm
z6#?t#?+Qd-EL%^x2G(brI0{hZ6@pzJnGqzpTR{%({IsQ6Fph}+=JLx~@qGjZ%C5;;
z$?mRevPOH>vWrvgQ$5}7-CeOlKDL2>H|j^;O<TrzPvl1hFtm9EJQxGm-h1NMsg?gy
zd;j>x%A<EDZ+-l|<m>0K4ZjEF7QwTxd3PiG{EEemb#=?WU&mBzTMQ5O(>w6mdv`7F
zJNE2bkKVWRhMz2X^6PIMeB%#qJ+>kF=KHVTv*U`pzWdYre!us_=+YG@9y{~r527G4
zXK9BPMbf$iXv-z^aiA#@`p@Q|KQ#w^2<Xjh73)y$gj%I+g(}jO0R3T3U(I>~^bw#d
z68<dEThLpLD%89&K=^HVma{0ET%;n(O#Wu<Hh@T{b>M12-v_Xnt*)`NRqziAJv470
z<n$$MwqAu=rF;&msQ<X&7t@4&nbVutNkK15K)j_eyt<jDVO=Y@y5nj&-Li?2DipP}
zWm`-e8r`fJrekKTf@?aXoBOhP+Z@%CS(9m|p}RVWAn=p`lF8+5p-}_zTcB=OwpJ{d
zhF?1<cR_=V#AKmB;y3TqMnqqIS-ns&3!Vv512zp0_4a8SVjE%``Nz?hhhV<Q{yYzO
zEnd7MrMTLH@DH<Byk<7L_D){Id4Y3>N~?$uoI}(Twk7tw*O+*?{@f~sB_2HJ)}OwX
z6JKaNjIEVY+IRw3N>`nPchg!GYKTuD!#l@IP_Ftd;AspCUOL|&ntAn(#LS7ro|9*{
zjt(6;h$EahatH$~apVZb$LXg*?&EaR+J45Kxeg2*OSEI$C-%%n6EmlFu6YJkp;;~C
z&tpUBI50oJ^^YG$E7CE-pTqXC#P|Ne6&$({0R@Sfvx!5eZ%Tw-OuTx*U0K$)gtRrS
zW#fmv{&#<MJ=o8REn^^f+6KeMU#!0jNTH8-PtPk?qG30&V*QyPfm~VHhbT}wI{wZs
zkiq)QcRoqX6wf|9@JV8S)9-dGFwvTxI|%)hZAHuD+vB&zXG-z0_~`K7s~)*b0ps_!
zBiuGLbAD*%wc+)r_}Co!cjWZ;3#C%x!S`LI^G*8R;hA@bXU_M7hSG|^CiWZ-C9XeH
zd^fS@g~o4<$8V31$M1-1hxb+b{OB-v62}@ipjuNxRZ&sX%r5EMu|pdih>wnq4BXI>
znwrw|Oa|gwcTJdKX}y?rHJlZep0#$FPC>$-we*7Knz_j=2+0{Twmw%wJ}pt{x{j4B
z%C%7&m^bN|Dd^LXXehdQ&7Gb!Ynzgmtvl1O#=y#<XC-E(@;0n0Q<F}uEHpujThy}}
zRCj_uEMTtXGt5+0-aEBuI#@WjAox6$2alRC436m*9h-lRv@36r(nUMvf;Hul&~zs=
zH@|6UBrz{jF2B>fNB|gS7URXTGw76p>l9ONUKT0H2%|M`$5zI2wSqaRJGxwnX%}-^
zI`7=8I|hV6DvO-*QGhYbS}D*s?^wZj!h(-xITlndsuRMd;$(^M;1^2I){ZQCTeA$)
zcCEB!N@6Qx+8B^9%Z!USoO4<!Evx5}hHPS4_JrxcoW1CXST^kLOwHDFW?@oK$!71I
zop=r0R4t`XLX1kq^C_4tI2SG!nD7&x(fCU~bL_l1l`<#YTG!ebbr1w8EobJEro(NL
zuobh}Nmt@|2yw@Op{W&dbUR~Ww8@(8h3$cZKAw9iam+OAQtXte-2-a|4*a~)@0eMA
z3Rw6wlCMC%#Q-AJfT;$tFR{+bOt>0YpEb3lqo?jRT}h}qJN0Z47Z_osgrxxSm`@AG
z*7hU(j(Z|UGBV&G995jN)w(<Jmxg{bDixgeIaniPtA{(`n7RQG0s&QPi0kMU#B$~$
zt7Xx)QhCFiXUKp9#yeM;f_!zU?XYM=yu<jXa76<l>F)sSFP(Y%+NnDhZd%I@sCE+n
zIp#bD#<rev^7Ao}I}4Y<&wOZ2<VHM0*2B|wzEs)`a0fs<Z*2KzsdNC~6u_4No(9;A
zhdC&CZo?AVHNrwu&7n0*7d7q+Eow$O-}8eGIx8TboS(6Eg8vuiN+ksuqs@cS)|;D_
z+}pUD-L(3~tFK-61tg<R*e0^aKrh!Hk2XIP?pxNd9Xb|m2EYT*ZUSVz(dHk9d!wz7
zL<XYD-n!ms+Yjm!(T;~2649PLi#A79C)yK_cEqD?y-@}DfWJ4|$nAU*#E*g=|2`R2
zE|diiEO=nS0}CEl@W6rx7Cf-vfdvmNcwoT;|BoI};Q#Zy5ELINj(>1N;gzKV(!I_y
zfz!RsDuL7e>KcLLnGMTo53pAF_c|7SwgX7*=Ps1;NZ%h;5%6;=!UJ_G0)97$a5k(W
zV0fm*a?Aq^@9VI%dVsAIkU)egaD9M<&V0mA=T^Ko!E(6=*l}@>Mf8^hPIi+#-c4d5
z9R8EfzvqD9hf4#FlRwW2{C?5yN&oNPbdMeEsk=c9k~qGpukQw>Z7f-|-J-HF))nh$
z?=Etz^Zw56SVvc^vva-Ipls;q?C$99xL&HrM~pyJ^@LR)#j8eOR7R!r2y><Mx^leu
zl|>+WW~KZM<#?**U&LhN5P|5V@vG)v%qR}3>6et_rJ7!QAByb}wv;Inzem_IxbRl}
zDtJBOyPx$pMwsOO6c{4D``>E*mU5m!HGMhjXjc6sUXQR#%lQ-j#t8fuh30cLeI>(d
zv|x#_%OI~pM!&p#pXry0;A|4}wVGagKaTAY$vw44r`4#U1?OQM`><4@cr{$-La=%S
z?Z@>k4F2C87#Gxx^n(F<Owd_iUG3-kEBEQN9&F?ET7T{mddllG;8-4lCnOn{Cx9;d
zuBSPFGsA02EXTxxHkTh>0G<%s*efk6vX{%BpeFMVGRXS<8<)JaCQd%!dRDQv!1#W`
z>9uiE&mC18hpn7m8_!<>dPtIAaUG}E#?@w^%kmS(fv)gxsDAyD(`(~!8tAgTj_p8S
zE}5shIlWppVvh?w!90*Bfv(iDvuA-W%lCK%=(2o|cR>f{bp-QCo)G-OJdihlF3SUX
zTkr?-K+XVNW@l**`d_#n$vT;G+=5$7r(-F|!MM3^L>nI3HmYf?lJ23oIW2_=ACQHi
z8F?*}%_rfG$-w(UxK^EFbaQINuG@Hhmz;?wlE4+Iqff*2gzHSRG+sSuMlqM01`!|T
zU2#>hnmS&0!N2VbZXpI&8BF`;a8KH!qE&+<@y!F;z?Ob6-1`cu<6U~WTTC-C3VCfp
zw+&2P>Ho%-_~xNLp!(Q&9t@BmlS&&%2-S)H5g<Y03w5$-_?F)Iuy)Jf;I@HLZ8Y9H
zJb+#EOq$P@Hxo#{QB{9J%YTzr<IAY=vU)yKS`CX8rgN^I1n4>*oS>QoxAM*;i`jYC
zjKzD0+Fd;(u#8=dC5sm1u~`O-AvU2GCRogvwn3i<UB_z?_xV+b25opPhXSHDnRQu=
zX9~rj8q4GX#jF4p<H<=eC(kpGV&;U1q6q_(5ax+`A>c_+{jL<SK{tBNN`Vb|7u5p=
z)0twBjl^OQ*f|JR$#U?SN%%VkQ?R@*ru`Y^Ytnw56eF*{d=U`*Nuhl;?c*pPQt>lG
zy)J-v0`8Zm{hlint_$!7<@=!>u5$9!|NgMbCH4!#?HsF|D`@{N$ZQK#@C-rnvtbo5
zJa2Hoo)RC7`BqpZdH5ya1@q@3@Q^&6TMh_A>73$mdpf9&@D6zJj6m|VAHBcc<D%~u
zXt^KazZ=-_%t1KqTMq~U#Z$x2QGWXcnc+SIO(l8S-@YW|={u?a;P*cu<a>oeIyW7c
z$fK^H{3Ad^yU@Q_=$tt#<mvqAwbsVZ3^e%Vl?IiwDng;cvC0cFBY7eCW5E3Ks*qQO
zJlQM6%Jvif^ME}4er^@=kD_v4p?-<<E2#MUr*rj5u}`D(CGq1}`OB{XL3tWK%KIck
z&kH>yqfkY_-vIQ>Q~ojKC3gk*gZ)1rkf(D*hxpKs1M)$Cz6|Y{sEcz53;iE~@|1)8
zLHsq4X@ZC3>0Ht(^0<TiLHzF^i{DT3wEtH=rTp6<i$hKFbk3nX@}sC6iU<c97CfQx
zvLD|5{wcq6cCFVQw3l##-hR5$fBD>`c=7^x2)s#-;4IMm{nNfv5rSkVDIht*FF*xp
z^!=EgiKRo~pxmE_d3{kGVFWtI{yY3c#1)U=<<3?bkrxZW7N}F-yg|HPZu2TjiBZr4
pDA!Y-J3a*yiiae`z+pISfQP=H)<vA3vi_g?k|)0^pgh?Be*kluQF#CW

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c b/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
new file mode 100644
index 0000000000..6590dded23
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.c
@@ -0,0 +1,34 @@
+
+  const char features[] = {"\n"
+"C_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
+"1"
+#else
+"0"
+#endif
+"c_function_prototypes\n"
+"C_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+"1"
+#else
+"0"
+#endif
+"c_restrict\n"
+"C_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L
+"1"
+#else
+"0"
+#endif
+"c_static_assert\n"
+"C_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+"1"
+#else
+"0"
+#endif
+"c_variadic_macros\n"
+
+};
+
+int main(int argc, char** argv) { (void)argv; return features[argc]; }
diff --git a/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx b/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
new file mode 100644
index 0000000000..b93418c6ed
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/build/CMakeFiles/feature_tests.cxx
@@ -0,0 +1,405 @@
+
+  const char features[] = {"\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
+"1"
+#else
+"0"
+#endif
+"cxx_aggregate_default_initializers\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_alias_templates\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_alignas\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_alignof\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_attributes\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_attribute_deprecated\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_auto_type\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_binary_literals\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_constexpr\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_contextual_conversions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_decltype\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_decltype_auto\n"
+"CXX_FEATURE:"
+#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_decltype_incomplete_return_types\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_default_function_template_args\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_defaulted_functions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_defaulted_move_initializers\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_delegating_constructors\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_deleted_functions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_digit_separators\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_enum_forward_declarations\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_explicit_conversions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_extended_friend_declarations\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_extern_templates\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_final\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_func_identifier\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_generalized_initializers\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_generic_lambdas\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_inheriting_constructors\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_inline_namespaces\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_lambdas\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_lambda_init_captures\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_local_type_template_args\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_long_long_type\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_noexcept\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_nonstatic_member_init\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_nullptr\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_override\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_range_for\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_raw_string_literals\n"
+"CXX_FEATURE:"
+#if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_reference_qualified_functions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
+"1"
+#else
+"0"
+#endif
+"cxx_relaxed_constexpr\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_return_type_deduction\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_right_angle_brackets\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_rvalue_references\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_sizeof_member\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_static_assert\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_strong_enums\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus
+"1"
+#else
+"0"
+#endif
+"cxx_template_template_parameters\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_thread_local\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_trailing_return_types\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_unicode_literals\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_uniform_initialization\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_unrestricted_unions\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
+"1"
+#else
+"0"
+#endif
+"cxx_user_literals\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L
+"1"
+#else
+"0"
+#endif
+"cxx_variable_templates\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_variadic_macros\n"
+"CXX_FEATURE:"
+#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
+"1"
+#else
+"0"
+#endif
+"cxx_variadic_templates\n"
+
+};
+
+int main(int argc, char** argv) { (void)argv; return features[argc]; }
diff --git a/hpvm/projects/llvm-cbe/docs/index.html b/hpvm/projects/llvm-cbe/docs/index.html
new file mode 100644
index 0000000000..d2e6786317
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/docs/index.html
@@ -0,0 +1,6 @@
+<html>
+  <body>
+    <h1>SAMPLE PROJECT DOCUMENTATION</h1>
+    <p>This is just a placeholder</p>
+  </body>
+</html>
diff --git a/hpvm/projects/llvm-cbe/include/sample.h b/hpvm/projects/llvm-cbe/include/sample.h
new file mode 100644
index 0000000000..b3ce9ce292
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/include/sample.h
@@ -0,0 +1,8 @@
+/*
+ * File: sample.h
+ *
+ *      This is a sample header file that is global to the entire project.
+ *      It is located here so that everyone will find it.
+ */
+extern int compute_sample (int a);
+
diff --git a/hpvm/projects/llvm-cbe/lib/CMakeLists.txt b/hpvm/projects/llvm-cbe/lib/CMakeLists.txt
new file mode 100644
index 0000000000..310cf4abc0
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(Target)
diff --git a/hpvm/projects/llvm-cbe/lib/Makefile b/hpvm/projects/llvm-cbe/lib/Makefile
new file mode 100644
index 0000000000..aa61a57134
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Makefile
@@ -0,0 +1,14 @@
+##===- projects/sample/lib/Makefile ------------------------*- Makefile -*-===##
+
+#
+# Relative path to the top of the source tree.
+#
+LEVEL := ../../..
+include $(LEVEL)/Makefile.config
+
+#
+# List all of the subdirectories that we will compile.
+#
+DIRS := Target
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
new file mode 100644
index 0000000000..46faa737d1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp
@@ -0,0 +1,5717 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This library converts LLVM code to C code, compilable by GCC and other C
+// compilers.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CBackend.h"
+#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/InstIterator.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/Host.h"
+#include "llvm/CodeGen/TargetLowering.h"
+#include "llvm/Config/config.h"
+#include "llvm/Transforms/Utils.h"
+
+#include <algorithm>
+#include <cstdio>
+
+#include <iostream>
+
+//#include "Graph.h"
+//#include "PHINodePass.h"
+
+//Jackson Korba 9/29/14
+#ifndef DEBUG_TYPE
+#define DEBUG_TYPE ""
+#endif
+//End Modification
+
+// Some ms header decided to define setjmp as _setjmp, undo this for this file
+// since we don't need it
+#ifdef setjmp
+#undef setjmp
+#endif
+using namespace llvm;
+
+extern "C" void LLVMInitializeCBackendTarget() {
+  // Register the target.
+  RegisterTargetMachine<CTargetMachine> X(TheCBackendTarget);
+}
+
+char CWriter::ID = 0;
+
+// extra (invalid) Ops tags for tracking unary ops as a special case of the available binary ops
+enum UnaryOps {
+  BinaryNeg = Instruction::OtherOpsEnd + 1,
+  BinaryNot,
+};
+
+static bool isEmptyType(Type *Ty) {
+    if (StructType *STy = dyn_cast<StructType>(Ty))
+        return STy->getNumElements() == 0 ||
+            std::all_of(STy->element_begin(), STy->element_end(), [](Type *T){ return isEmptyType(T); });
+    if (VectorType *VTy = dyn_cast<VectorType>(Ty))
+        return VTy->getNumElements() == 0 ||
+            isEmptyType(VTy->getElementType());
+    if (ArrayType *ATy = dyn_cast<ArrayType>(Ty))
+        return ATy->getNumElements() == 0 ||
+            isEmptyType(ATy->getElementType());
+    return Ty->isVoidTy();
+}
+
+bool CWriter::isEmptyType(Type *Ty) const {
+    return ::isEmptyType(Ty);
+}
+
+/// isAddressExposed - Return true if the specified value's name needs to
+/// have its address taken in order to get a C value of the correct type.
+/// This happens for global variables, byval parameters, and direct allocas.
+bool CWriter::isAddressExposed(Value *V) const {
+  if (Argument *A = dyn_cast<Argument>(V))
+    return ByValParams.count(A);
+  return isa<GlobalVariable>(V) || isDirectAlloca(V);
+}
+
+// isInlinableInst - Attempt to inline instructions into their uses to build
+// trees as much as possible.  To do this, we have to consistently decide
+// what is acceptable to inline, so that variable declarations don't get
+// printed and an extra copy of the expr is not emitted.
+//
+bool CWriter::isInlinableInst(Instruction &I) const {
+  // Always inline cmp instructions, even if they are shared by multiple
+  // expressions.  GCC generates horrible code if we don't.
+  if (isa<CmpInst>(I))
+    return true;
+
+  if (isa<GetElementPtrInst>(I)) {
+    for (User *U : I.users()) {
+      if (!(isa<LoadInst>(U) || isa<StoreInst>(U))) {
+        //DEBUG(errs() << "GEP user not a Load/Store!\n");
+        return false;
+      }
+    }
+    //DEBUG(errs() << "All users of GEP are loads/stores, mark it inlinable!\n");
+    return true;
+  }
+  // Must be an expression, must be used exactly once.  If it is dead, we
+  // emit it inline where it would go.
+  if (isEmptyType(I.getType()) || !I.hasOneUse() ||
+      I.isTerminator() || isa<CallInst>(I) || isa<PHINode>(I) ||
+      isa<LoadInst>(I) || isa<VAArgInst>(I) || isa<InsertElementInst>(I) ||
+      isa<InsertValueInst>(I))
+    // Don't inline a load across a store or other bad things!
+    return false;
+
+  // Must not be used in inline asm, extractelement, or shufflevector.
+  if (I.hasOneUse()) {
+    Instruction &User = cast<Instruction>(*I.user_back());
+    if (isInlineAsm(User))
+      return false;
+  }
+
+  // Only inline instruction it if it's use is in the same BB as the inst.
+  return I.getParent() == cast<Instruction>(I.user_back())->getParent();
+}
+
+// isDirectAlloca - Define fixed sized allocas in the entry block as direct
+// variables which are accessed with the & operator.  This causes GCC to
+// generate significantly better code than to emit alloca calls directly.
+//
+AllocaInst *CWriter::isDirectAlloca(Value *V) const {
+	//DEBUG(errs() << "Checking if " << *V << " is a direct alloca!\n");
+  AllocaInst *AI = dyn_cast<AllocaInst>(V);
+  if (!AI) return 0;
+  // Modification to inline fixed size array alloca!
+  if (AI->isArrayAllocation())
+    return AI;   // FIXME: we can also inline fixed size array allocas!
+  if (AI->getParent() != &AI->getParent()->getParent()->getEntryBlock())
+    return 0;
+  return AI;
+}
+
+// isInlineAsm - Check if the instruction is a call to an inline asm chunk.
+bool CWriter::isInlineAsm(Instruction& I) const {
+  if (CallInst *CI = dyn_cast<CallInst>(&I))
+    return isa<InlineAsm>(CI->getCalledValue());
+  return false;
+}
+
+bool CWriter::runOnFunction(Function &F) {
+ // Do not codegen any 'available_externally' functions at all, they have
+ // definitions outside the translation unit.
+ if (F.hasAvailableExternallyLinkage())
+   return false;
+
+  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
+  // Adding PDT pass to avoid code duplication
+  PDT = &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
+  // Adding Scalar Evolution Pass for loop induction variable
+  SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
+  //Adding Dominator Tree Pass
+  DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+  // Adding Assumption Cache
+  AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
+  // Adding IVUsers Pass for loop recongnition
+//  IU = &getAnalysis<IVUsersWrapperPass>().getIU();
+
+  BasicBlock* entry = &(F.getEntryBlock());
+  for (df_iterator<BasicBlock*> BI = df_begin(entry), BE = df_end(entry); BI!=BE; ++BI) { 
+    BasicBlock *BB = *BI;
+    if (Loop *L = LI->getLoopFor(&*BB)) {
+      if(simplifyLoop(L, DT, LI, SE, AC, nullptr, true)) {
+        //DEBUG(errs() << "Simplified loop!\n" << *L << "\n");
+      }
+    }
+  }
+  // Get rid of intrinsics we can't handle.
+  lowerIntrinsics(F);
+
+  // Output all floating point constants that cannot be printed accurately.
+  printFloatingPointConstants(F);
+
+  printFunction(F);
+
+  LI = NULL;
+
+  return true; // may have lowered an IntrinsicCall
+}
+
+static std::string CBEMangle(const std::string &S) {
+  std::string Result;
+
+  for (unsigned i = 0, e = S.size(); i != e; ++i)
+    if (isalnum(S[i]) || S[i] == '_') {
+      Result += S[i];
+    } else {
+      Result += '_';
+      Result += 'A'+(S[i]&15);
+      Result += 'A'+((S[i]>>4)&15);
+      Result += '_';
+    }
+  return Result;
+}
+
+raw_ostream &
+CWriter::printTypeString(raw_ostream &Out, Type *Ty, bool isSigned) {
+  if (StructType *ST = dyn_cast<StructType>(Ty)) {
+    assert(!isEmptyType(ST));
+    TypedefDeclTypes.insert(Ty);
+
+    if (!ST->isLiteral() && !ST->getName().empty())
+      return Out << "struct_" << CBEMangle(ST->getName());
+
+    unsigned &id = UnnamedStructIDs[ST];
+    if (id == 0)
+      id = ++NextAnonStructNumber;
+    return Out << "unnamed_" + utostr(id);
+  }
+
+  if (Ty->isPointerTy()) {
+    Out << "p";
+    return printTypeString(Out, Ty->getPointerElementType(), isSigned);
+  }
+
+  switch (Ty->getTypeID()) {
+  case Type::VoidTyID:   return Out << "void";
+  case Type::IntegerTyID: {
+    unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth();
+    if (NumBits == 1)
+      return Out << "bool";
+    else {
+      assert(NumBits <= 128 && "Bit widths > 128 not implemented yet");
+      return Out << (isSigned?"i":"u") << NumBits;
+    }
+  }
+  case Type::FloatTyID:    return Out << "f32";
+  case Type::DoubleTyID:   return Out << "f64";
+  case Type::X86_FP80TyID: return Out << "f80";
+  case Type::PPC_FP128TyID:
+  case Type::FP128TyID:    return Out << "f128";
+
+  case Type::X86_MMXTyID:
+    return Out << (isSigned ? "i32y2" : "u32y2");
+
+  case Type::VectorTyID: {
+    TypedefDeclTypes.insert(Ty);
+    VectorType *VTy = cast<VectorType>(Ty);
+    assert(VTy->getNumElements() != 0);
+    printTypeString(Out, VTy->getElementType(), isSigned);
+    return Out << "x" << VTy->getNumElements();
+  }
+
+  case Type::ArrayTyID: {
+    TypedefDeclTypes.insert(Ty);
+    ArrayType *ATy = cast<ArrayType>(Ty);
+    assert(ATy->getNumElements() != 0);
+    printTypeString(Out, ATy->getElementType(), isSigned);
+    return Out << "a" << ATy->getNumElements();
+  }
+
+  default:
+#ifndef NDEBUG
+    errs() << "Unknown primitive type: " << *Ty << "\n";
+#endif
+    llvm_unreachable(0);
+  }
+}
+
+std::string CWriter::getStructName(StructType *ST) {
+  assert(ST->getNumElements() != 0);
+  if (!ST->isLiteral() && !ST->getName().empty())
+    return "struct l_struct_" + CBEMangle(ST->getName().str());
+
+  unsigned &id = UnnamedStructIDs[ST];
+  if (id == 0)
+    id = ++NextAnonStructNumber;
+  return "struct l_unnamed_" + utostr(id);
+}
+
+std::string CWriter::getFunctionName(FunctionType *FT,
+				     std::pair<AttributeList, CallingConv::ID> PAL) {
+  unsigned &id = UnnamedFunctionIDs[std::make_pair(FT, PAL)];
+  if (id == 0)
+      id = ++NextFunctionNumber;
+  return "l_fptr_" + utostr(id);
+}
+
+std::string CWriter::getArrayName(ArrayType *AT) {
+    std::string astr;
+    raw_string_ostream ArrayInnards(astr);
+    // Arrays are wrapped in structs to allow them to have normal
+    // value semantics (avoiding the array "decay").
+    assert(!isEmptyType(AT));
+    printTypeName(ArrayInnards, AT->getElementType(), false);
+    return "struct l_array_" + utostr(AT->getNumElements()) + '_' + CBEMangle(ArrayInnards.str());
+}
+
+std::string CWriter::getVectorName(VectorType *VT, bool Aligned) {
+    std::string astr;
+    raw_string_ostream VectorInnards(astr);
+    // Vectors are handled like arrays
+    assert(!isEmptyType(VT));
+//    if (Aligned)
+//      Out << "__MSALIGN__(" << TD->getABITypeAlignment(VT) << ") ";
+    printTypeName(VectorInnards, VT->getElementType(), false);
+    return "struct l_vector_" + utostr(VT->getNumElements()) + '_' + CBEMangle(VectorInnards.str());
+}
+
+
+static const std::string getCmpPredicateName(CmpInst::Predicate P) {
+  switch (P) {
+  case FCmpInst::FCMP_FALSE: return "0";
+  case FCmpInst::FCMP_OEQ: return "oeq";
+  case FCmpInst::FCMP_OGT: return "ogt";
+  case FCmpInst::FCMP_OGE: return "oge";
+  case FCmpInst::FCMP_OLT: return "olt";
+  case FCmpInst::FCMP_OLE: return "ole";
+  case FCmpInst::FCMP_ONE: return "one";
+  case FCmpInst::FCMP_ORD: return "ord";
+  case FCmpInst::FCMP_UNO: return "uno";
+  case FCmpInst::FCMP_UEQ: return "ueq";
+  case FCmpInst::FCMP_UGT: return "ugt";
+  case FCmpInst::FCMP_UGE: return "uge";
+  case FCmpInst::FCMP_ULT: return "ult";
+  case FCmpInst::FCMP_ULE: return "ule";
+  case FCmpInst::FCMP_UNE: return "une";
+  case FCmpInst::FCMP_TRUE: return "1";
+  case ICmpInst::ICMP_EQ:  return "eq";
+  case ICmpInst::ICMP_NE:  return "ne";
+  case ICmpInst::ICMP_ULE: return "ule";
+  case ICmpInst::ICMP_SLE: return "sle";
+  case ICmpInst::ICMP_UGE: return "uge";
+  case ICmpInst::ICMP_SGE: return "sge";
+  case ICmpInst::ICMP_ULT: return "ult";
+  case ICmpInst::ICMP_SLT: return "slt";
+  case ICmpInst::ICMP_UGT: return "ugt";
+  case ICmpInst::ICMP_SGT: return "sgt";
+  default:
+#ifndef NDEBUG
+    errs() << "Invalid icmp predicate!" << P;
+#endif
+    llvm_unreachable(0);
+  }
+}
+
+
+raw_ostream &
+CWriter::printSimpleType(raw_ostream &Out, Type *Ty, bool isSigned) {
+  assert((Ty->isSingleValueType() || Ty->isVoidTy()) &&
+         "Invalid type for printSimpleType");
+  switch (Ty->getTypeID()) {
+  case Type::VoidTyID:   return Out << "void";
+  case Type::IntegerTyID: {
+    unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth();
+    if (NumBits == 1)
+      return Out << "bool";
+    else if (NumBits <= 8)
+      return Out << (isSigned?"char":"uchar");
+    else if (NumBits <= 16)
+      return Out << (isSigned?"short":"ushort");
+    else if (NumBits <= 32)
+      return Out << (isSigned?"int":"uint"); // !!FIX ME
+    else if (NumBits <= 64)
+      return Out << (isSigned?"long":"ulong");
+    else {
+      assert(NumBits <= 128 && "Bit widths > 128 not implemented yet");
+      return Out << (isSigned?"int128_t":"uint128_t");
+    }
+  }
+  case Type::FloatTyID:  return Out << "float";
+  case Type::DoubleTyID: return Out << "double";
+  // Lacking emulation of FP80 on PPC, etc., we assume whichever of these is
+  // present matches host 'long double'.
+  case Type::X86_FP80TyID:
+  case Type::PPC_FP128TyID:
+  case Type::FP128TyID:  return Out << "long double";
+
+  case Type::X86_MMXTyID:
+    return Out << (isSigned?"int":"uint") << " __attribute__((vector_size(8)))";
+
+  default:
+#ifndef NDEBUG
+    errs() << "Unknown primitive type: " << *Ty << "\n";
+#endif
+    llvm_unreachable(0);
+  }
+}
+
+// Pass the Type* and the variable name and this prints out the variable
+// declaration.
+//
+raw_ostream &CWriter::printTypeName(raw_ostream &Out, Type *Ty,
+				    bool isSigned,
+				    std::pair<AttributeList, CallingConv::ID> PAL) {
+  
+  if (Ty->isSingleValueType() || Ty->isVoidTy()) {
+    if (!Ty->isPointerTy() && !Ty->isVectorTy())
+      return printSimpleType(Out, Ty, isSigned);
+  }
+
+  if (isEmptyType(Ty))
+    return Out << "void";
+
+  switch (Ty->getTypeID()) {
+  case Type::FunctionTyID: {
+    FunctionType *FTy = cast<FunctionType>(Ty);
+    return Out << getFunctionName(FTy, PAL);
+  }
+  case Type::StructTyID: {
+    TypedefDeclTypes.insert(Ty);
+    return Out << getStructName(cast<StructType>(Ty));
+  }
+
+  case Type::PointerTyID: {
+    Type *ElTy = Ty->getPointerElementType();
+    return printTypeName(Out, ElTy, false) << '*';
+  }
+
+  case Type::ArrayTyID: {
+    TypedefDeclTypes.insert(Ty);
+    return Out << getArrayName(cast<ArrayType>(Ty));
+  }
+
+  case Type::VectorTyID: {
+    TypedefDeclTypes.insert(Ty);
+    return Out << getVectorName(cast<VectorType>(Ty), true);
+  }
+
+  default:
+#ifndef NDEBUG
+    errs() << "Unexpected type: " << *Ty << "\n";
+#endif
+    llvm_unreachable(0);
+  }
+}
+
+raw_ostream &CWriter::printTypeNameUnaligned(raw_ostream &Out, Type *Ty, bool isSigned) {
+  if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
+    // MSVC doesn't handle __declspec(align) on parameters,
+    // but we specify it for Vector (hoping the compiler will vectorize it)
+    // so we need to avoid it sometimes
+    TypedefDeclTypes.insert(VTy);
+    return Out << getVectorName(VTy, false);
+  }
+  return printTypeName(Out, Ty, isSigned);
+}
+
+raw_ostream &CWriter::printStructDeclaration(raw_ostream &Out, StructType *STy) {
+  if (STy->isPacked())
+    Out << "#ifdef _MSC_VER\n#pragma pack(push, 1)\n#endif\n";
+  Out << getStructName(STy) << " {\n";
+  unsigned Idx = 0;
+  for (StructType::element_iterator I = STy->element_begin(),
+         E = STy->element_end(); I != E; ++I, Idx++) {
+    Out << "  ";
+    bool empty = isEmptyType(*I);
+    if (empty)
+        Out << "/* "; // skip zero-sized types
+    printTypeName(Out, *I, false) << " field" << utostr(Idx);
+    if (empty)
+        Out << " */"; // skip zero-sized types
+    else
+        Out << ";\n";
+  }
+  Out << '}';
+  if (STy->isPacked())
+    Out << " __attribute__ ((packed))";
+  Out << ";\n";
+  if (STy->isPacked())
+    Out << "#ifdef _MSC_VER\n#pragma pack(pop)\n#endif\n";
+  return Out;
+}
+
+raw_ostream &CWriter::printFunctionDeclaration(raw_ostream &Out, FunctionType *Ty,
+					       std::pair<AttributeList, CallingConv::ID> PAL){
+					       
+  Out << "typedef ";
+  printFunctionProto(Out, Ty, PAL, getFunctionName(Ty, PAL), NULL, false);
+  return Out << ";\n";
+}
+
+raw_ostream &CWriter::printFunctionProto(raw_ostream &Out, FunctionType *FTy,
+					 std::pair<AttributeList, CallingConv::ID> Attrs,
+                                         const std::string &Name,
+					 Function::arg_iterator ArgList,
+                                         bool isKernel) {
+
+  // NOTE: AttributeSet is replaced by 'AttributeList' at function level in LLVM-9
+  AttributeList &PAL = Attrs.first;
+
+  if (PAL.hasAttribute(AttributeList::FunctionIndex, Attribute::NoReturn))
+    Out << "__noreturn ";
+  
+  if (isKernel)
+    Out << "__kernel \n";
+
+  // Should this function actually return a struct by-value?
+  bool isStructReturn = PAL.hasAttribute(1, Attribute::StructRet) ||
+                        PAL.hasAttribute(2, Attribute::StructRet);
+  // Get the return type for the function.
+  Type *RetTy;
+  if (!isStructReturn)
+    RetTy = FTy->getReturnType();
+  else {
+    // If this is a struct-return function, print the struct-return type.
+    RetTy = cast<PointerType>(FTy->getParamType(0))->getElementType();
+  }
+  printTypeName(Out, RetTy,
+    /*isSigned=*/PAL.hasAttribute(AttributeList::ReturnIndex, Attribute::SExt));
+
+  Out << "/* Processing Function: " << Name << ": " << Attrs.second << "*/\n";
+  switch (Attrs.second) {
+   case CallingConv::C:
+    break;
+   case CallingConv::X86_StdCall:
+    Out << " __stdcall";
+    break;
+   case CallingConv::X86_FastCall:
+    Out << " __fastcall";
+    break;
+   case CallingConv::X86_ThisCall:
+    Out << " __thiscall";
+    break;
+   default:
+//    assert(0 && "Encountered Unhandled Calling Convention");
+    break;
+  }
+  Out << ' ' << Name << '(';
+
+  unsigned Idx = 1;
+  bool PrintedArg = false;
+  FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
+
+  //Function::arg_iterator ArgName = ArgList ? ArgList->begin() : Function::arg_iterator();
+  // NOTE: ArgumentLists not supported in LLVM-9
+  Function::arg_iterator ArgName = ArgList ? ArgList : Function::arg_iterator();
+
+  // If this is a struct-return function, don't print the hidden
+  // struct-return argument.
+  // CHECK: Does this assumption hold true for LLVM-9 also?
+  if (isStructReturn) {
+    assert(I != E && "Invalid struct return function!");
+    ++I;
+    ++Idx;
+    // CHECK: very confused as to how next loop starts from first Function Param?
+    if (ArgList) ++ArgName;
+  }
+
+  for (; I != E; ++I) {
+    Type *ArgTy = *I;
+    if (PAL.hasAttribute(Idx, Attribute::ByVal)) {
+      assert(ArgTy->isPointerTy());
+      ArgTy = cast<PointerType>(ArgTy)->getElementType();
+    }
+    if (PrintedArg)
+      Out << ", ";
+
+    if (PointerType *PTy = dyn_cast<PointerType>(ArgTy)) {
+      unsigned AddrSpace = PTy->getAddressSpace();
+      //DEBUG(errs() << "AddrSpace for " << Idx << " = " << AddrSpace << "\n");
+      switch(AddrSpace) {
+        case GLOBAL_ADDRSPACE:
+          Out << "__global ";
+          break;
+        case SHARED_ADDRSPACE:
+          Out << "__local ";
+          break;
+        case CONSTANT_ADDRSPACE:
+          Out << "__constant ";
+          break;
+        case PRIVATE_ADDRSPACE:
+          Out << "__private ";
+          break;
+        default:
+          break;
+      }
+    }
+
+    printTypeNameUnaligned(Out, ArgTy,
+      /*isSigned=*/PAL.hasAttribute(Idx, Attribute::SExt));
+    PrintedArg = true;
+    bool noalias = false;
+		if (PAL.hasAttribute(Idx, Attribute::NoAlias)) {
+			noalias = true;
+		}
+		++Idx;
+    if (ArgList) {
+			
+      Out << ' ' << (noalias ? " restrict " : "")  << GetValueName(&*ArgName);
+      ++ArgName;
+    }
+  }
+
+  if (FTy->isVarArg()) {
+    if (!PrintedArg) {
+      Out << "int"; //dummy argument for empty vaarg functs
+      if (ArgList) Out << " vararg_dummy_arg";
+    }
+    Out << ", ...";
+  } else if (!PrintedArg) {
+    Out << "void";
+  }
+  Out << ")";
+  return Out;
+}
+
+raw_ostream &CWriter::printArrayDeclaration(raw_ostream &Out, ArrayType *ATy) {
+  assert(!isEmptyType(ATy));
+  // Arrays are wrapped in structs to allow them to have normal
+  // value semantics (avoiding the array "decay").
+  Out << getArrayName(ATy) << " {\n  ";
+  printTypeName(Out, ATy->getElementType());
+  Out << " array[" << utostr(ATy->getNumElements()) << "];\n};\n";
+  return Out;
+}
+
+raw_ostream &CWriter::printVectorDeclaration(raw_ostream &Out, VectorType *VTy) {
+  assert(!isEmptyType(VTy));
+  // Vectors are printed like arrays
+  Out << getVectorName(VTy, false) << " {\n  ";
+  printTypeName(Out, VTy->getElementType());
+  Out << " vector[" << utostr(VTy->getNumElements()) << "];\n} __attribute__((aligned(" << TD->getABITypeAlignment(VTy) << ")));\n";
+  return Out;
+}
+
+void CWriter::printConstantArray(ConstantArray *CPA, enum OperandContext Context) {
+  printConstant(cast<Constant>(CPA->getOperand(0)), Context);
+  for (unsigned i = 1, e = CPA->getNumOperands(); i != e; ++i) {
+    Out << ", ";
+    printConstant(cast<Constant>(CPA->getOperand(i)), Context);
+  }
+}
+
+void CWriter::printConstantVector(ConstantVector *CP, enum OperandContext Context) {
+  printConstant(cast<Constant>(CP->getOperand(0)), Context);
+  for (unsigned i = 1, e = CP->getNumOperands(); i != e; ++i) {
+    Out << ", ";
+    printConstant(cast<Constant>(CP->getOperand(i)), Context);
+  }
+}
+
+void CWriter::printConstantDataSequential(ConstantDataSequential *CDS, enum OperandContext Context) {
+  printConstant(CDS->getElementAsConstant(0), Context);
+  for (unsigned i = 1, e = CDS->getNumElements(); i != e; ++i) {
+    Out << ", ";
+    printConstant(CDS->getElementAsConstant(i), Context);
+  }
+}
+
+bool CWriter::printConstantString(Constant *C, enum OperandContext Context) {
+  // As a special case, print the array as a string if it is an array of
+  // ubytes or an array of sbytes with positive values.
+  ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C);
+  if (!CDS || !CDS->isCString()) return false;
+  if (Context != ContextStatic) return false; // TODO
+
+  Out << "{ \"";
+  // Keep track of whether the last number was a hexadecimal escape.
+  bool LastWasHex = false;
+
+  StringRef Bytes = CDS->getAsString();
+
+  // Do not include the last character, which we know is null
+  for (unsigned i = 0, e = Bytes.size() - 1; i < e; ++i) {
+    unsigned char C = Bytes[i];
+
+    // Print it out literally if it is a printable character.  The only thing
+    // to be careful about is when the last letter output was a hex escape
+    // code, in which case we have to be careful not to print out hex digits
+    // explicitly (the C compiler thinks it is a continuation of the previous
+    // character, sheesh...)
+    //
+    if (isprint(C) && (!LastWasHex || !isxdigit(C))) {
+      LastWasHex = false;
+      if (C == '"' || C == '\\')
+        Out << "\\" << (char)C;
+      else
+        Out << (char)C;
+    } else {
+      LastWasHex = false;
+      switch (C) {
+        case '\n': Out << "\\n"; break;
+        case '\t': Out << "\\t"; break;
+        case '\r': Out << "\\r"; break;
+        case '\v': Out << "\\v"; break;
+        case '\a': Out << "\\a"; break;
+        case '\"': Out << "\\\""; break;
+        case '\'': Out << "\\\'"; break;
+        default:
+          Out << "\\x";
+          Out << (char)(( C/16  < 10) ? ( C/16 +'0') : ( C/16 -10+'A'));
+          Out << (char)(((C&15) < 10) ? ((C&15)+'0') : ((C&15)-10+'A'));
+          LastWasHex = true;
+          break;
+      }
+    }
+  }
+  Out << "\" }";
+  return true;
+}
+
+
+// isFPCSafeToPrint - Returns true if we may assume that CFP may be written out
+// textually as a double (rather than as a reference to a stack-allocated
+// variable). We decide this by converting CFP to a string and back into a
+// double, and then checking whether the conversion results in a bit-equal
+// double to the original value of CFP. This depends on us and the target C
+// compiler agreeing on the conversion process (which is pretty likely since we
+// only deal in IEEE FP).
+//
+
+// TODO copied from CppBackend, new code should use raw_ostream
+static inline std::string ftostr(const APFloat& V) {
+  std::string Buf;
+  if (&V.getSemantics() == &APFloat::IEEEdouble()) {
+    raw_string_ostream(Buf) << V.convertToDouble();
+    return Buf;
+  } else if (&V.getSemantics() == &APFloat::IEEEsingle()) {
+    raw_string_ostream(Buf) << (double)V.convertToFloat();
+    return Buf;
+  }
+  return "<unknown format in ftostr>"; // error
+}
+
+static bool isFPCSafeToPrint(const ConstantFP *CFP) {
+  bool ignored;
+  // Do long doubles in hex for now.
+  if (CFP->getType() != Type::getFloatTy(CFP->getContext()) &&
+      CFP->getType() != Type::getDoubleTy(CFP->getContext()))
+    return false;
+  APFloat APF = APFloat(CFP->getValueAPF());  // copy
+  if (CFP->getType() == Type::getFloatTy(CFP->getContext()))
+    APF.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, &ignored);
+#if HAVE_PRINTF_A && ENABLE_CBE_PRINTF_A
+  char Buffer[100];
+  sprintf(Buffer, "%a", APF.convertToDouble());
+  if (!strncmp(Buffer, "0x", 2) ||
+      !strncmp(Buffer, "-0x", 3) ||
+      !strncmp(Buffer, "+0x", 3))
+    return APF.bitwiseIsEqual(APFloat(atof(Buffer)));
+  return false;
+#else
+  std::string StrVal = ftostr(APF);
+
+  while (StrVal[0] == ' ')
+    StrVal.erase(StrVal.begin());
+
+  // Check to make sure that the stringized number is not some string like "Inf"
+  // or NaN.  Check that the string matches the "[-+]?[0-9]" regex.
+  if ((StrVal[0] >= '0' && StrVal[0] <= '9') ||
+      ((StrVal[0] == '-' || StrVal[0] == '+') &&
+       (StrVal[1] >= '0' && StrVal[1] <= '9')))
+    // Reparse stringized version!
+    return APF.bitwiseIsEqual(APFloat(atof(StrVal.c_str())));
+  return false;
+#endif
+}
+
+/// Print out the casting for a cast operation. This does the double casting
+/// necessary for conversion to the destination type, if necessary.
+/// @brief Print a cast
+void CWriter::printCast(unsigned opc, Type *SrcTy, Type *DstTy) {
+  // Print the destination type cast
+  switch (opc) {
+    case Instruction::UIToFP:
+    case Instruction::SIToFP:
+    case Instruction::IntToPtr:
+    case Instruction::Trunc:
+    case Instruction::BitCast:
+    case Instruction::FPExt:
+    case Instruction::FPTrunc: // For these the DstTy sign doesn't matter
+      Out << '(';
+      printTypeName(Out, DstTy);
+      Out << ')';
+      break;
+    case Instruction::ZExt:
+    case Instruction::PtrToInt:
+    case Instruction::FPToUI: // For these, make sure we get an unsigned dest
+      Out << '(';
+      printSimpleType(Out, DstTy, false);
+      Out << ')';
+      break;
+    case Instruction::SExt:
+    case Instruction::FPToSI: // For these, make sure we get a signed dest
+      Out << '(';
+      printSimpleType(Out, DstTy, true);
+      Out << ')';
+      break;
+    default:
+      llvm_unreachable("Invalid cast opcode");
+  }
+
+  // Print the source type cast
+  switch (opc) {
+    case Instruction::UIToFP:
+    case Instruction::ZExt:
+      Out << '(';
+      printSimpleType(Out, SrcTy, false);
+      Out << ')';
+      break;
+    case Instruction::SIToFP:
+    case Instruction::SExt:
+      Out << '(';
+      printSimpleType(Out, SrcTy, true);
+      Out << ')';
+      break;
+    case Instruction::IntToPtr:
+    case Instruction::PtrToInt:
+      // Avoid "cast to pointer from integer of different size" warnings
+      Out << "(uintptr_t)";
+      break;
+    case Instruction::Trunc:
+    case Instruction::BitCast:
+    case Instruction::FPExt:
+    case Instruction::FPTrunc:
+    case Instruction::FPToSI:
+    case Instruction::FPToUI:
+      break; // These don't need a source cast.
+    default:
+      llvm_unreachable("Invalid cast opcode");
+  }
+}
+
+// printConstant - The LLVM Constant to C Constant converter.
+void CWriter::printConstant(Constant *CPV, enum OperandContext Context) {
+  if (ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
+    assert(CE->getType()->isIntegerTy() || CE->getType()->isFloatingPointTy() || CE->getType()->isPointerTy()); // TODO: VectorType are valid here, but not supported
+    GetElementPtrInst *GEPI;
+    switch (CE->getOpcode()) {
+    case Instruction::Trunc:
+    case Instruction::ZExt:
+    case Instruction::SExt:
+    case Instruction::FPTrunc:
+    case Instruction::FPExt:
+    case Instruction::UIToFP:
+    case Instruction::SIToFP:
+    case Instruction::FPToUI:
+    case Instruction::FPToSI:
+    case Instruction::PtrToInt:
+    case Instruction::IntToPtr:
+    case Instruction::BitCast:
+      Out << "(";
+      printCast(CE->getOpcode(), CE->getOperand(0)->getType(), CE->getType());
+      if (CE->getOpcode() == Instruction::SExt &&
+          CE->getOperand(0)->getType() == Type::getInt1Ty(CPV->getContext())) {
+        // Make sure we really sext from bool here by subtracting from 0
+        Out << "0-";
+      }
+      printConstant(CE->getOperand(0), ContextCasted);
+      if (CE->getType() == Type::getInt1Ty(CPV->getContext()) &&
+          (CE->getOpcode() == Instruction::Trunc ||
+           CE->getOpcode() == Instruction::FPToUI ||
+           CE->getOpcode() == Instruction::FPToSI ||
+           CE->getOpcode() == Instruction::PtrToInt)) {
+        // Make sure we really truncate to bool here by anding with 1
+        Out << "&1u";
+      }
+      Out << ')';
+      return;
+
+    case Instruction::GetElementPtr:
+      Out << "(";
+      //DEBUG(errs() << "\n----------\nCE: " << *CE << "\n");
+      GEPI = dyn_cast<GetElementPtrInst>(CE->getAsInstruction());
+      //DEBUG(errs() << "GEPI: " << *GEPI << "\n");
+      printGEPExpression(CE->getOperand(0), gep_type_begin(CPV), gep_type_end(CPV), CE->getOperand(0)->getType()->isArrayTy(), GEPI);
+      delete(GEPI);
+      //DEBUG(errs() << "Deleted GEPI!\n");
+      Out << ")";
+      return;
+    case Instruction::Select:
+      Out << '(';
+      printConstant(CE->getOperand(0), ContextCasted);
+      Out << '?';
+      printConstant(CE->getOperand(1), ContextNormal);
+      Out << ':';
+      printConstant(CE->getOperand(2), ContextNormal);
+      Out << ')';
+      return;
+    case Instruction::Add:
+    case Instruction::FAdd:
+    case Instruction::Sub:
+    case Instruction::FSub:
+    case Instruction::Mul:
+    case Instruction::FMul:
+    case Instruction::SDiv:
+    case Instruction::UDiv:
+    case Instruction::FDiv:
+    case Instruction::URem:
+    case Instruction::SRem:
+    case Instruction::FRem:
+    case Instruction::And:
+    case Instruction::Or:
+    case Instruction::Xor:
+    case Instruction::ICmp:
+    case Instruction::Shl:
+    case Instruction::LShr:
+    case Instruction::AShr:
+    {
+      Out << '(';
+      bool NeedsClosingParens = printConstExprCast(CE);
+      printConstantWithCast(CE->getOperand(0), CE->getOpcode());
+      switch (CE->getOpcode()) {
+      case Instruction::Add:
+      case Instruction::FAdd: Out << " + "; break;
+      case Instruction::Sub:
+      case Instruction::FSub: Out << " - "; break;
+      case Instruction::Mul:
+      case Instruction::FMul: Out << " * "; break;
+      case Instruction::URem:
+      case Instruction::SRem:
+      case Instruction::FRem: Out << " % "; break;
+      case Instruction::UDiv:
+      case Instruction::SDiv:
+      case Instruction::FDiv: Out << " / "; break;
+      case Instruction::And: Out << " & "; break;
+      case Instruction::Or:  Out << " | "; break;
+      case Instruction::Xor: Out << " ^ "; break;
+      case Instruction::Shl: Out << " << "; break;
+      case Instruction::LShr:
+      case Instruction::AShr: Out << " >> "; break;
+      case Instruction::ICmp:
+        switch (CE->getPredicate()) {
+          case ICmpInst::ICMP_EQ: Out << " == "; break;
+          case ICmpInst::ICMP_NE: Out << " != "; break;
+          case ICmpInst::ICMP_SLT:
+          case ICmpInst::ICMP_ULT: Out << " < "; break;
+          case ICmpInst::ICMP_SLE:
+          case ICmpInst::ICMP_ULE: Out << " <= "; break;
+          case ICmpInst::ICMP_SGT:
+          case ICmpInst::ICMP_UGT: Out << " > "; break;
+          case ICmpInst::ICMP_SGE:
+          case ICmpInst::ICMP_UGE: Out << " >= "; break;
+          default: llvm_unreachable("Illegal ICmp predicate");
+        }
+        break;
+      default: llvm_unreachable("Illegal opcode here!");
+      }
+      printConstantWithCast(CE->getOperand(1), CE->getOpcode());
+      if (NeedsClosingParens)
+        Out << "))";
+      Out << ')';
+      return;
+    }
+    case Instruction::FCmp: {
+      Out << '(';
+      bool NeedsClosingParens = printConstExprCast(CE);
+      if (CE->getPredicate() == FCmpInst::FCMP_FALSE)
+        Out << "0";
+      else if (CE->getPredicate() == FCmpInst::FCMP_TRUE)
+        Out << "1";
+      else {
+        Out << "llvm_fcmp_" << getCmpPredicateName((CmpInst::Predicate)CE->getPredicate()) << "(";
+        printConstant(CE->getOperand(0), ContextCasted);
+        Out << ", ";
+        printConstant(CE->getOperand(1), ContextCasted);
+        Out << ")";
+      }
+      if (NeedsClosingParens)
+        Out << "))";
+      Out << ')';
+      return;
+    }
+    default:
+#ifndef NDEBUG
+      errs() << "CWriter Error: Unhandled constant expression: "
+           << *CE << "\n";
+#endif
+      llvm_unreachable(0);
+    }
+  } else if (isa<UndefValue>(CPV) && CPV->getType()->isSingleValueType()) {
+    if (CPV->getType()->isVectorTy()) {
+      if (Context == ContextStatic) {
+        Out << "{}";
+        return;
+      }
+      VectorType *VT = cast<VectorType>(CPV->getType());
+      assert(!isEmptyType(VT));
+      CtorDeclTypes.insert(VT);
+      Out << "/*undef*/llvm_ctor_";
+      printTypeString(Out, VT, false);
+      Out << "(";
+      Constant *Zero = Constant::getNullValue(VT->getElementType());
+      unsigned NumElts = VT->getNumElements();
+      for (unsigned i = 0; i != NumElts; ++i) {
+        if (i) Out << ", ";
+        printConstant(Zero, ContextCasted);
+      }
+      Out << ")";
+
+    } else {
+      Constant *Zero = Constant::getNullValue(CPV->getType());
+      Out << "/*UNDEF*/";
+      return printConstant(Zero, Context);
+    }
+    return;
+  }
+
+  if (ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
+    Type* Ty = CI->getType();
+    unsigned ActiveBits = CI->getValue().getMinSignedBits();
+//    DEBUG(errs() << "Here: " << *CI << ", " << *Ty << ", " << ActiveBits << "\n");
+    Out << CI->getSExtValue();
+//    if (Ty == Type::getInt1Ty(CPV->getContext())) {
+//      Out << (CI->getZExtValue() ? '1' : '0');
+//    } else if (Context != ContextNormal &&
+//              ActiveBits < 64 &&
+//              Ty->getPrimitiveSizeInBits() < 64 &&
+//              ActiveBits < Ty->getPrimitiveSizeInBits()) {
+//      if (ActiveBits >= 32)
+//        Out << "(long)";
+//      Out << CI->getSExtValue(); // most likely a shorter representation
+////      if (ActiveBits >= 32)
+////        Out << ")";
+//    } else if (Ty->getPrimitiveSizeInBits() < 32 && Context == ContextNormal) {
+//      Out << "((";
+//      printSimpleType(Out, Ty, false) << ')';
+//      if (CI->isMinValue(true))
+//        Out << CI->getZExtValue() << 'u';
+//      else
+//        Out << CI->getSExtValue();
+//      Out << ')';
+//    } else if (Ty->getPrimitiveSizeInBits() <= 32) {
+//      Out << CI->getZExtValue() << 'u';
+//    } else if (Ty->getPrimitiveSizeInBits() <= 64) {
+//      Out << "(ulong)" << CI->getZExtValue();
+////      Out << "UINT64_C(" << CI->getZExtValue() << ")";
+////    } else if (Ty->getPrimitiveSizeInBits() <= 128) {
+////      const APInt &V = CI->getValue();
+////      const APInt &Vlo = V.getLoBits(64);
+////      const APInt &Vhi = V.getHiBits(64);
+////      Out << (Context == ContextStatic ? "UINT128_C" : "llvm_ctor_u128");
+////      Out << "(UINT64_C(" << Vhi.getZExtValue() << "), UINT64_C(" << Vlo.getZExtValue() << "))";
+//    }
+    return;
+  }
+
+  switch (CPV->getType()->getTypeID()) {
+  case Type::FloatTyID:
+  case Type::DoubleTyID:
+  case Type::X86_FP80TyID:
+  case Type::PPC_FP128TyID:
+  case Type::FP128TyID: {
+    ConstantFP *FPC = cast<ConstantFP>(CPV);
+    std::map<const ConstantFP*, unsigned>::iterator I = FPConstantMap.find(FPC);
+    if (I != FPConstantMap.end()) {
+      // Because of FP precision problems we must load from a stack allocated
+      // value that holds the value in hex.
+      Out << "(*(" << (FPC->getType() == Type::getFloatTy(CPV->getContext()) ?
+                       "float" :
+                       FPC->getType() == Type::getDoubleTy(CPV->getContext()) ?
+                       "double" :
+                       "long double")
+          << "*)&FPConstant" << I->second << ')';
+    } else {
+      double V;
+      if (FPC->getType() == Type::getFloatTy(CPV->getContext()))
+        V = FPC->getValueAPF().convertToFloat();
+      else if (FPC->getType() == Type::getDoubleTy(CPV->getContext()))
+        V = FPC->getValueAPF().convertToDouble();
+      else {
+        // Long double.  Convert the number to double, discarding precision.
+        // This is not awesome, but it at least makes the CBE output somewhat
+        // useful.
+        APFloat Tmp = FPC->getValueAPF();
+        bool LosesInfo;
+        Tmp.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &LosesInfo);
+        V = Tmp.convertToDouble();
+      }
+
+      if (std::isnan(V)) {
+        // The value is NaN
+
+        // FIXME the actual NaN bits should be emitted.
+        // The prefix for a quiet NaN is 0x7FF8. For a signalling NaN,
+        // it's 0x7ff4.
+        const unsigned long QuietNaN = 0x7ff8UL;
+        //const unsigned long SignalNaN = 0x7ff4UL;
+
+        // We need to grab the first part of the FP #
+        char Buffer[100];
+
+        uint64_t ll = DoubleToBits(V);
+        sprintf(Buffer, "0x%llx", static_cast<long long>(ll));
+
+        std::string Num(&Buffer[0], &Buffer[6]);
+        unsigned long Val = strtoul(Num.c_str(), 0, 16);
+
+        if (FPC->getType() == Type::getFloatTy(FPC->getContext()))
+          Out << "LLVM_NAN" << (Val == QuietNaN ? "" : "S") << "F(\""
+              << Buffer << "\") /*nan*/ ";
+        else
+          Out << "LLVM_NAN" << (Val == QuietNaN ? "" : "S") << "(\""
+              << Buffer << "\") /*nan*/ ";
+      } else if (std::isinf(V)) {
+        // The value is Inf
+        if (V < 0) Out << '-';
+        Out << "LLVM_INF" <<
+            (FPC->getType() == Type::getFloatTy(FPC->getContext()) ? "F" : "")
+            << " /*inf*/ ";
+      } else {
+        std::string Num;
+#if HAVE_PRINTF_A && ENABLE_CBE_PRINTF_A
+        // Print out the constant as a floating point number.
+        char Buffer[100];
+        sprintf(Buffer, "%a", V);
+        Num = Buffer;
+#else
+        Num = ftostr(FPC->getValueAPF());
+#endif
+       Out << Num;
+      }
+    }
+    break;
+  }
+
+  case Type::ArrayTyID: {
+    if (printConstantString(CPV, Context)) break;
+    ArrayType *AT = cast<ArrayType>(CPV->getType());
+    assert(AT->getNumElements() != 0 && !isEmptyType(AT));
+    if (Context != ContextStatic) {
+      CtorDeclTypes.insert(AT);
+      Out << "llvm_ctor_";
+      printTypeString(Out, AT, false);
+      Out << "(";
+      Context = ContextCasted;
+    } else {
+      Out << "{ { "; // Arrays are wrapped in struct types.
+    }
+    if (ConstantArray *CA = dyn_cast<ConstantArray>(CPV)) {
+      printConstantArray(CA, Context);
+    } else if (ConstantDataSequential *CDS =
+                 dyn_cast<ConstantDataSequential>(CPV)) {
+      printConstantDataSequential(CDS, Context);
+    } else {
+      assert(isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV));
+      Constant *CZ = Constant::getNullValue(AT->getElementType());
+      printConstant(CZ, Context);
+      for (unsigned i = 1, e = AT->getNumElements(); i != e; ++i) {
+        Out << ", ";
+        printConstant(CZ, Context);
+      }
+    }
+    Out << (Context == ContextStatic ? " } }" : ")"); // Arrays are wrapped in struct types.
+    break;
+  }
+
+  case Type::VectorTyID: {
+    VectorType *VT = cast<VectorType>(CPV->getType());
+    assert(VT->getNumElements() != 0 && !isEmptyType(VT));
+    if (Context != ContextStatic) {
+      CtorDeclTypes.insert(VT);
+      Out << "llvm_ctor_";
+      printTypeString(Out, VT, false);
+      Out << "(";
+      Context = ContextCasted;
+    } else {
+      Out << "{ ";
+    }
+    if (ConstantVector *CV = dyn_cast<ConstantVector>(CPV)) {
+      printConstantVector(CV, Context);
+    } else if (ConstantDataSequential *CDS =
+               dyn_cast<ConstantDataSequential>(CPV)) {
+      printConstantDataSequential(CDS, Context);
+    } else {
+      assert(isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV));
+      Constant *CZ = Constant::getNullValue(VT->getElementType());
+      printConstant(CZ, Context);
+      for (unsigned i = 1, e = VT->getNumElements(); i != e; ++i) {
+        Out << ", ";
+        printConstant(CZ, Context);
+      }
+    }
+    Out << (Context == ContextStatic ? " }" : ")");
+    break;
+  }
+
+  case Type::StructTyID: {
+    StructType *ST = cast<StructType>(CPV->getType());
+    assert(!isEmptyType(ST));
+    if (Context != ContextStatic) {
+      CtorDeclTypes.insert(ST);
+      Out << "llvm_ctor_";
+      printTypeString(Out, ST, false);
+      Out << "(";
+      Context = ContextCasted;
+    } else {
+      Out << "{ ";
+    }
+
+    if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
+      bool printed = false;
+      for (unsigned i = 0, e = ST->getNumElements(); i != e; ++i) {
+        Type *ElTy = ST->getElementType(i);
+        if (isEmptyType(ElTy)) continue;
+        if (printed) Out << ", ";
+        printConstant(Constant::getNullValue(ElTy), Context);
+        printed = true;
+      }
+      assert(printed);
+    } else {
+      bool printed = false;
+      for (unsigned i = 0, e = CPV->getNumOperands(); i != e; ++i) {
+        Constant *C = cast<Constant>(CPV->getOperand(i));
+        if (isEmptyType(C->getType())) continue;
+        if (printed) Out << ", ";
+        printConstant(C, Context);
+        printed = true;
+      }
+      assert(printed);
+    }
+    Out << (Context == ContextStatic ? " }" : ")");
+    break;
+  }
+
+  case Type::PointerTyID:
+    if (isa<ConstantPointerNull>(CPV)) {
+      Out << "((";
+      printTypeName(Out, CPV->getType()); // sign doesn't matter
+      Out << ")/*NULL*/0)";
+      break;
+    } else if (GlobalValue *GV = dyn_cast<GlobalValue>(CPV)) {
+      writeOperand(GV);
+      break;
+    }
+    // FALL THROUGH
+  default:
+#ifndef NDEBUG
+    errs() << "Unknown constant type: " << *CPV << "\n";
+#endif
+    llvm_unreachable(0);
+  }
+}
+
+// Some constant expressions need to be casted back to the original types
+// because their operands were casted to the expected type. This function takes
+// care of detecting that case and printing the cast for the ConstantExpr.
+bool CWriter::printConstExprCast(ConstantExpr* CE) {
+  bool NeedsExplicitCast = false;
+  Type *Ty = CE->getOperand(0)->getType();
+  bool TypeIsSigned = false;
+  switch (CE->getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
+    // We need to cast integer arithmetic so that it is always performed
+    // as unsigned, to avoid undefined behavior on overflow.
+  case Instruction::LShr:
+  case Instruction::URem:
+  case Instruction::UDiv: NeedsExplicitCast = true; break;
+  case Instruction::AShr:
+  case Instruction::SRem:
+  case Instruction::SDiv: NeedsExplicitCast = true; TypeIsSigned = true; break;
+  case Instruction::SExt:
+    Ty = CE->getType();
+    NeedsExplicitCast = true;
+    TypeIsSigned = true;
+    break;
+  case Instruction::ZExt:
+  case Instruction::Trunc:
+  case Instruction::FPTrunc:
+  case Instruction::FPExt:
+  case Instruction::UIToFP:
+  case Instruction::SIToFP:
+  case Instruction::FPToUI:
+  case Instruction::FPToSI:
+  case Instruction::PtrToInt:
+  case Instruction::IntToPtr:
+  case Instruction::BitCast:
+    Ty = CE->getType();
+    NeedsExplicitCast = true;
+    break;
+  default: break;
+  }
+  if (NeedsExplicitCast) {
+    Out << "((";
+      printTypeName(Out, Ty, TypeIsSigned); // not integer, sign doesn't matter
+    Out << ")(";
+  }
+  return NeedsExplicitCast;
+}
+
+//  Print a constant assuming that it is the operand for a given Opcode. The
+//  opcodes that care about sign need to cast their operands to the expected
+//  type before the operation proceeds. This function does the casting.
+void CWriter::printConstantWithCast(Constant* CPV, unsigned Opcode) {
+
+  // Extract the operand's type, we'll need it.
+  Type* OpTy = CPV->getType();
+  assert(OpTy->isIntegerTy() || OpTy->isFloatingPointTy()); // TODO: VectorType are valid here, but not supported
+
+  // Indicate whether to do the cast or not.
+  bool shouldCast;
+  bool typeIsSigned;
+  opcodeNeedsCast(Opcode, shouldCast, typeIsSigned);
+
+  // Write out the casted constant if we should, otherwise just write the
+  // operand.
+  if (shouldCast) {
+    Out << "((";
+    printSimpleType(Out, OpTy, typeIsSigned);
+    Out << ")";
+    printConstant(CPV, ContextCasted);
+    Out << ")";
+  } else
+    printConstant(CPV, ContextCasted);
+}
+
+std::string CWriter::GetValueName(Value *Operand) {
+	//DEBUG(errs() << "In getvaluename: " << *Operand << "\n");
+
+  // Resolve potential alias.
+  if (GlobalAlias *GA = dyn_cast<GlobalAlias>(Operand)) {
+    Operand = GA->getAliasee();
+  }
+
+  std::string Name = Operand->getName();
+  if (Name.empty()) { // Assign unique names to local temporaries.
+    unsigned &No = AnonValueNumbers[Operand];
+    if (No == 0)
+      No = ++NextAnonValueNumber;
+    Name = "tmp__" + utostr(No);
+  }
+
+  // Mangle globals with the standard mangler interface for LLC compatibility.
+  if (isa<GlobalValue>(Operand)) {
+    return CBEMangle(Name);
+  }
+
+  std::string VarName;
+  VarName.reserve(Name.capacity());
+
+  for (std::string::iterator I = Name.begin(), E = Name.end();
+       I != E; ++I) {
+    unsigned char ch = *I;
+
+    if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
+          (ch >= '0' && ch <= '9') || ch == '_' || ch == '.')) {
+      char buffer[5];
+      sprintf(buffer, "_%x_", ch);
+      VarName += buffer;
+    } else if (ch == '.') {
+      VarName += '_';
+    } else
+      VarName += ch;
+  }
+
+  return VarName;
+}
+
+/// writeInstComputationInline - Emit the computation for the specified
+/// instruction inline, with no destination provided.
+void CWriter::writeInstComputationInline(Instruction &I) {
+  // C can't handle non-power-of-two integer types
+  unsigned mask = 0;
+  Type *Ty = I.getType();
+  if (Ty->isIntegerTy()) {
+     IntegerType *ITy = static_cast<IntegerType*>(Ty);
+     if (!ITy->isPowerOf2ByteWidth())
+       mask = ITy->getBitMask();
+  }
+
+  // If this is a non-trivial bool computation, make sure to truncate down to
+  // a 1 bit value.  This is important because we want "add i1 x, y" to return
+  // "0" when x and y are true, not "2" for example.
+  // Also truncate odd bit sizes
+  if (mask)
+    Out << "((";
+
+  visit(&I);
+
+  if (mask)
+    Out << ")&" << mask << ")";
+}
+
+
+void CWriter::writeOperandInternal(Value *Operand, enum OperandContext Context) {
+  //DEBUG(errs() << "In write operand internal: " << *Operand << "\n"); 
+  if (Instruction *I = dyn_cast<Instruction>(Operand))
+    // Should we inline this instruction to build a tree?
+    if (isInlinableInst(*I) && !isDirectAlloca(I)) {
+      //DEBUG(errs() << "isInlinableInst & NOT isDirectAlloca\n" << "\n");
+      Out << '(';
+      writeInstComputationInline(*I);
+      Out << ')';
+      return;
+    }
+
+  Constant* CPV = dyn_cast<Constant>(Operand);
+
+  if (CPV && !isa<GlobalValue>(CPV))
+    printConstant(CPV, Context);
+  else
+    Out << GetValueName(Operand);
+}
+
+void CWriter::writeOperand(Value *Operand, enum OperandContext Context, bool arrayAccess) {
+  //DEBUG(errs() << "In write operand: " << *Operand << "; ArrayAccess = " << arrayAccess << "\n");
+  bool isAddressImplicit = isAddressExposed(Operand);
+  if (isAddressImplicit && !arrayAccess) {
+    DEBUG(errs() << "isAddressImplicit & NOT arrayAccess!\n");
+    Out << "(&";  // Global variables are referenced as their addresses by llvm
+  }
+  writeOperandInternal(Operand, Context);
+
+  if (isAddressImplicit && !arrayAccess)
+    Out << ')';
+}
+
+/// writeOperandDeref - Print the result of dereferencing the specified
+/// operand with '*'.  This is equivalent to printing '*' then using
+/// writeOperand, but avoids excess syntax in some cases.
+void CWriter::writeOperandDeref(Value *Operand) {
+  if (isAddressExposed(Operand)) {
+    // Already something with an address exposed.
+    writeOperandInternal(Operand);
+  } else {
+    Out << "*(";
+    writeOperand(Operand);
+    Out << ")";
+  }
+}
+
+// Some instructions need to have their result value casted back to the
+// original types because their operands were casted to the expected type.
+// This function takes care of detecting that case and printing the cast
+// for the Instruction.
+bool CWriter::writeInstructionCast(Instruction &I) {
+  Type *Ty = I.getOperand(0)->getType();
+  switch (I.getOpcode()) {
+  case Instruction::Add:
+  case Instruction::Sub:
+  case Instruction::Mul:
+    // We need to cast integer arithmetic so that it is always performed
+    // as unsigned, to avoid undefined behavior on overflow.
+  case Instruction::LShr:
+  case Instruction::URem:
+  case Instruction::UDiv:
+    Out << "((";
+    printSimpleType(Out, Ty, false);
+    Out << ")(";
+    return true;
+  case Instruction::AShr:
+  case Instruction::SRem:
+  case Instruction::SDiv:
+    Out << "((";
+    printSimpleType(Out, Ty, true);
+    Out << ")(";
+    return true;
+  default: break;
+  }
+  return false;
+}
+
+// Write the operand with a cast to another type based on the Opcode being used.
+// This will be used in cases where an instruction has specific type
+// requirements (usually signedness) for its operands.
+void CWriter::opcodeNeedsCast(unsigned Opcode,
+      // Indicate whether to do the cast or not.
+      bool &shouldCast,
+      // Indicate whether the cast should be to a signed type or not.
+      bool &castIsSigned) {
+
+  // Based on the Opcode for which this Operand is being written, determine
+  // the new type to which the operand should be casted by setting the value
+  // of OpTy. If we change OpTy, also set shouldCast to true.
+  switch (Opcode) {
+    default:
+      // for most instructions, it doesn't matter
+      shouldCast = false;
+      castIsSigned = false;
+      break;
+    case Instruction::Add:
+    case Instruction::Sub:
+    case Instruction::Mul:
+      // We need to cast integer arithmetic so that it is always performed
+      // as unsigned, to avoid undefined behavior on overflow.
+    case Instruction::LShr:
+    case Instruction::UDiv:
+    case Instruction::URem: // Cast to unsigned first
+      shouldCast = true;
+      castIsSigned = false;
+      break;
+    case Instruction::GetElementPtr:
+    case Instruction::AShr:
+    case Instruction::SDiv:
+    case Instruction::SRem: // Cast to signed first
+      shouldCast = true;
+      castIsSigned = true;
+      break;
+  }
+}
+
+void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) {
+//  DEBUG(errs() << "Here: " << *Operand << "\n");
+  // Write out the casted operand if we should, otherwise just write the
+  // operand.
+
+  // Extract the operand's type, we'll need it.
+//  bool shouldCast;
+//  bool castIsSigned;
+//  opcodeNeedsCast(Opcode, shouldCast, castIsSigned);
+//
+//  Type* OpTy = Operand->getType();
+//  if (shouldCast) {
+//    Out << "((";
+//    printSimpleType(Out, OpTy, castIsSigned);
+//    Out << ")";
+//    writeOperand(Operand, ContextCasted);
+//    Out << ")";
+//  } else
+    writeOperand(Operand, ContextNormal/*ContextCasted*/);
+}
+
+// Write the operand with a cast to another type based on the icmp predicate
+// being used.
+void CWriter::writeOperandWithCast(Value* Operand, ICmpInst &Cmp) {
+  // This has to do a cast to ensure the operand has the right signedness.
+  // Also, if the operand is a pointer, we make sure to cast to an integer when
+  // doing the comparison both for signedness and so that the C compiler doesn't
+  // optimize things like "p < NULL" to false (p may contain an integer value
+  // f.e.).
+  bool shouldCast = Cmp.isRelational();
+
+  // Write out the casted operand if we should, otherwise just write the
+  // operand.
+  if (!shouldCast) {
+    writeOperand(Operand);
+    return;
+  }
+
+  // Should this be a signed comparison?  If so, convert to signed.
+  bool castIsSigned = Cmp.isSigned();
+
+  // If the operand was a pointer, convert to a large integer type.
+  Type* OpTy = Operand->getType();
+  if (OpTy->isPointerTy())
+    OpTy = TD->getIntPtrType(Operand->getContext());
+
+  Out << "((";
+  printSimpleType(Out, OpTy, castIsSigned);
+  Out << ")";
+  writeOperand(Operand);
+  Out << ")";
+}
+
+// generateCompilerSpecificCode - This is where we add conditional compilation
+// directives to cater to specific compilers as need be.
+//
+static void generateCompilerSpecificCode(raw_ostream& Out,
+                                         const DataLayout *TD) {
+  // Alloca is hard to get, and we don't want to include stdlib.h here.
+  Out << "/* get a declaration for alloca */\n"
+      << "#if defined(__CYGWIN__) || defined(__MINGW32__)\n"
+      << "#define  alloca(x) __builtin_alloca((x))\n"
+      << "#define _alloca(x) __builtin_alloca((x))\n"
+      << "#elif defined(__APPLE__)\n"
+      << "extern void *__builtin_alloca(unsigned long);\n"
+      << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#define longjmp _longjmp\n"
+      << "#define setjmp _setjmp\n"
+      << "#elif defined(__sun__)\n"
+      << "#if defined(__sparcv9)\n"
+      << "extern void *__builtin_alloca(unsigned long);\n"
+      << "#else\n"
+      << "extern void *__builtin_alloca(unsigned int);\n"
+      << "#endif\n"
+      << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__arm__)\n"
+      << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#elif defined(_MSC_VER)\n"
+      << "#define alloca(x) _alloca(x)\n"
+      << "#else\n"
+      << "#include <alloca.h>\n"
+      << "#endif\n\n";
+
+  // On Mac OS X, "external weak" is spelled "__attribute__((weak_import))".
+  Out << "#if defined(__GNUC__) && defined(__APPLE_CC__)\n"
+      << "#define __EXTERNAL_WEAK__ __attribute__((weak_import))\n"
+      << "#elif defined(__GNUC__)\n"
+      << "#define __EXTERNAL_WEAK__ __attribute__((weak))\n"
+      << "#else\n"
+      << "#define __EXTERNAL_WEAK__\n"
+      << "#endif\n\n";
+
+  // For now, turn off the weak linkage attribute on Mac OS X. (See above.)
+  Out << "#if defined(__GNUC__) && defined(__APPLE_CC__)\n"
+      << "#define __ATTRIBUTE_WEAK__\n"
+      << "#elif defined(__GNUC__)\n"
+      << "#define __ATTRIBUTE_WEAK__ __attribute__((weak))\n"
+      << "#else\n"
+      << "#define __ATTRIBUTE_WEAK__\n"
+      << "#endif\n\n";
+
+  // Add hidden visibility support. FIXME: APPLE_CC?
+  Out << "#if defined(__GNUC__)\n"
+      << "#define __HIDDEN__ __attribute__((visibility(\"hidden\")))\n"
+      << "#endif\n\n";
+
+  // Define unaligned-load helper macro
+  Out << "#ifdef _MSC_VER\n";
+  Out << "#define __UNALIGNED_LOAD__(type, align, op) *((type __unaligned*)op)\n";
+  Out << "#else\n";
+  Out << "#define __UNALIGNED_LOAD__(type, align, op) ((struct { type data __attribute__((packed, aligned(align))); }*)op)->data\n";
+  Out << "#endif\n\n";
+
+  // Define unaligned-load helper macro
+  Out << "#ifdef _MSC_VER\n";
+  Out << "#define __MSALIGN__(X) __declspec(align(X))\n";
+  Out << "#else\n";
+  Out << "#define __MSALIGN__(X)\n";
+  Out << "#endif\n\n";
+
+  // Define compatibility macros to help msvc look more like gcc/clang
+  Out << "#ifdef _MSC_VER\n";
+  Out << "#define __builtin_unreachable() __assume(0)\n";
+  Out << "#define __noreturn __declspec(noreturn)\n";
+  Out << "#else\n";
+  Out << "#define __noreturn __attribute__((noreturn))\n";
+  Out << "#define __forceinline __attribute__((always_inline)) inline\n";
+  Out << "#endif\n\n";
+
+  // Define NaN and Inf as GCC builtins if using GCC
+  // From the GCC documentation:
+  //
+  //   double __builtin_nan (const char *str)
+  //
+  // This is an implementation of the ISO C99 function nan.
+  //
+  // Since ISO C99 defines this function in terms of strtod, which we do
+  // not implement, a description of the parsing is in order. The string is
+  // parsed as by strtol; that is, the base is recognized by leading 0 or
+  // 0x prefixes. The number parsed is placed in the significand such that
+  // the least significant bit of the number is at the least significant
+  // bit of the significand. The number is truncated to fit the significand
+  // field provided. The significand is forced to be a quiet NaN.
+  //
+  // This function, if given a string literal, is evaluated early enough
+  // that it is considered a compile-time constant.
+  //
+  //   float __builtin_nanf (const char *str)
+  //
+  // Similar to __builtin_nan, except the return type is float.
+  //
+  //   double __builtin_inf (void)
+  //
+  // Similar to __builtin_huge_val, except a warning is generated if the
+  // target floating-point format does not support infinities. This
+  // function is suitable for implementing the ISO C99 macro INFINITY.
+  //
+  //   float __builtin_inff (void)
+  //
+  // Similar to __builtin_inf, except the return type is float.
+  Out << "#ifdef __GNUC__\n"
+      << "#define LLVM_NAN(NanStr)   __builtin_nan(NanStr)   /* Double */\n"
+      << "#define LLVM_NANF(NanStr)  __builtin_nanf(NanStr)  /* Float */\n"
+      //<< "#define LLVM_NANS(NanStr)  __builtin_nans(NanStr)  /* Double */\n"
+      //<< "#define LLVM_NANSF(NanStr) __builtin_nansf(NanStr) /* Float */\n"
+      << "#define LLVM_INF           __builtin_inf()         /* Double */\n"
+      << "#define LLVM_INFF          __builtin_inff()        /* Float */\n"
+      << "#define LLVM_PREFETCH(addr,rw,locality) "
+                              "__builtin_prefetch(addr,rw,locality)\n"
+      << "#define __ATTRIBUTE_CTOR__ __attribute__((constructor))\n"
+      << "#define __ATTRIBUTE_DTOR__ __attribute__((destructor))\n"
+      << "#else\n"
+      << "#define LLVM_NAN(NanStr)   ((double)NAN)           /* Double */\n"
+      << "#define LLVM_NANF(NanStr)  ((float)NAN))           /* Float */\n"
+      //<< "#define LLVM_NANS(NanStr)  ((double)NAN)           /* Double */\n"
+      //<< "#define LLVM_NANSF(NanStr) ((single)NAN)           /* Float */\n"
+      << "#define LLVM_INF           ((double)INFINITY)      /* Double */\n"
+      << "#define LLVM_INFF          ((float)INFINITY)       /* Float */\n"
+      << "#define LLVM_PREFETCH(addr,rw,locality)            /* PREFETCH */\n"
+      << "#define __ATTRIBUTE_CTOR__ \"__attribute__((constructor)) not supported on this compiler\"\n"
+      << "#define __ATTRIBUTE_DTOR__ \"__attribute__((destructor)) not supported on this compiler\"\n"
+      << "#endif\n\n";
+
+  Out << "#if !defined(__GNUC__) || __GNUC__ < 4 /* Old GCC's, or compilers not GCC */ \n"
+      << "#define __builtin_stack_save() 0   /* not implemented */\n"
+      << "#define __builtin_stack_restore(X) /* noop */\n"
+      << "#endif\n\n";
+
+  // Output typedefs for 128-bit integers
+  Out << "#if defined(__GNUC__) && defined(__LP64__) /* 128-bit integer types */\n"
+      << "typedef int __attribute__((mode(TI))) int128_t;\n"
+      << "typedef unsigned __attribute__((mode(TI))) uint128_t;\n"
+      << "#define UINT128_C(hi, lo) (((uint128_t)(hi) << 64) | (uint128_t)(lo))\n"
+      << "static __forceinline uint128_t llvm_ctor_u128(ulong hi, ulong lo) {"
+      << " return UINT128_C(hi, lo); }\n"
+      << "static __forceinline bool llvm_icmp_eq_u128(uint128_t l, uint128_t r) {"
+      << " return l == r; }\n"
+      << "static __forceinline bool llvm_icmp_ne_u128(uint128_t l, uint128_t r) {"
+      << " return l != r; }\n"
+      << "static __forceinline bool llvm_icmp_ule_u128(uint128_t l, uint128_t r) {"
+      << " return l <= r; }\n"
+      << "static __forceinline bool llvm_icmp_sle_i128(int128_t l, int128_t r) {"
+      << " return l <= r; }\n"
+      << "static __forceinline bool llvm_icmp_uge_u128(uint128_t l, uint128_t r) {"
+      << " return l >= r; }\n"
+      << "static __forceinline bool llvm_icmp_sge_i128(int128_t l, int128_t r) {"
+      << " return l >= r; }\n"
+      << "static __forceinline bool llvm_icmp_ult_u128(uint128_t l, uint128_t r) {"
+      << " return l < r; }\n"
+      << "static __forceinline bool llvm_icmp_slt_i128(int128_t l, int128_t r) {"
+      << " return l < r; }\n"
+      << "static __forceinline bool llvm_icmp_ugt_u128(uint128_t l, uint128_t r) {"
+      << " return l > r; }\n"
+      << "static __forceinline bool llvm_icmp_sgt_i128(int128_t l, int128_t r) {"
+      << " return l > r; }\n"
+
+      << "#else /* manual 128-bit types */\n"
+      // TODO: field order should be reversed for big-endian
+      << "typedef struct { ulong lo; ulong hi; } uint128_t;\n"
+      << "typedef uint128_t int128_t;\n"
+      << "#define UINT128_C(hi, lo) {(lo), (hi)}\n" // only use in Static context
+      << "static __forceinline uint128_t llvm_ctor_u128(ulong hi, ulong lo) {"
+      << " uint128_t r; r.lo = lo; r.hi = hi; return r; }\n"
+      << "static __forceinline bool llvm_icmp_eq_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi == r.hi && l.lo == r.lo; }\n"
+      << "static __forceinline bool llvm_icmp_ne_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi != r.hi || l.lo != r.lo; }\n"
+      << "static __forceinline bool llvm_icmp_ule_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi < r.hi ? 1 : (l.hi == r.hi ? l.lo <= l.lo : 0); }\n"
+      << "static __forceinline bool llvm_icmp_sle_i128(int128_t l, int128_t r) {"
+      << " return (long)l.hi < (long)r.hi ? 1 : (l.hi == r.hi ? (long)l.lo <= (long)l.lo : 0); }\n"
+      << "static __forceinline bool llvm_icmp_uge_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi > r.hi ? 1 : (l.hi == r.hi ? l.lo >= l.hi : 0); }\n"
+      << "static __forceinline bool llvm_icmp_sge_i128(int128_t l, int128_t r) {"
+      << " return (long)l.hi > (long)r.hi ? 1 : (l.hi == r.hi ? (long)l.lo >= (long)l.lo : 0); }\n"
+      << "static __forceinline bool llvm_icmp_ult_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi < r.hi ? 1 : (l.hi == r.hi ? l.lo < l.hi : 0); }\n"
+      << "static __forceinline bool llvm_icmp_slt_i128(int128_t l, int128_t r) {"
+      << " return (long)l.hi < (long)r.hi ? 1 : (l.hi == r.hi ? (long)l.lo < (long)l.lo : 0); }\n"
+      << "static __forceinline bool llvm_icmp_ugt_u128(uint128_t l, uint128_t r) {"
+      << " return l.hi > r.hi ? 1 : (l.hi == r.hi ? l.lo > l.hi : 0); }\n"
+      << "static __forceinline bool llvm_icmp_sgt_i128(int128_t l, int128_t r) {"
+      << " return (long)l.hi > (long)r.hi ? 1 : (l.hi == r.hi ? (long)l.lo > (long)l.lo : 0); }\n"
+      << "#define __emulate_i128\n"
+      << "#endif\n\n";
+
+  // We output GCC specific attributes to preserve 'linkonce'ness on globals.
+  // If we aren't being compiled with GCC, just drop these attributes.
+  Out << "#ifdef _MSC_VER  /* Can only support \"linkonce\" vars with GCC */\n"
+      << "#define __attribute__(X)\n"
+      << "#endif\n\n";
+}
+
+/// FindStaticTors - Given a static ctor/dtor list, unpack its contents into
+/// the StaticTors set.
+static void FindStaticTors(GlobalVariable *GV, std::set<Function*> &StaticTors){
+  ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
+  if (!InitList) return;
+
+  for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i)
+    if (ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(i))){
+      if (CS->getNumOperands() != 2) return;  // Not array of 2-element structs.
+
+      if (CS->getOperand(1)->isNullValue())
+        return;  // Found a null terminator, exit printing.
+      Constant *FP = CS->getOperand(1);
+      if (ConstantExpr *CE = dyn_cast<ConstantExpr>(FP))
+        if (CE->isCast())
+          FP = CE->getOperand(0);
+      if (Function *F = dyn_cast<Function>(FP))
+        StaticTors.insert(F);
+    }
+}
+
+enum SpecialGlobalClass {
+  NotSpecial = 0,
+  GlobalCtors, GlobalDtors,
+  NotPrinted
+};
+
+/// getGlobalVariableClass - If this is a global that is specially recognized
+/// by LLVM, return a code that indicates how we should handle it.
+static SpecialGlobalClass getGlobalVariableClass(GlobalVariable *GV) {
+  // If this is a global ctors/dtors list, handle it now.
+  if (GV->hasAppendingLinkage() && GV->use_empty()) {
+    if (GV->getName() == "llvm.global_ctors")
+      return GlobalCtors;
+    else if (GV->getName() == "llvm.global_dtors")
+      return GlobalDtors;
+  }
+
+  // Otherwise, if it is other metadata, don't print it.  This catches things
+  // like debug information.
+  if (StringRef(GV->getSection()) == "llvm.metadata")
+  {
+    //DEBUG(errs() << "Printing Metada!\n" << *GV << "\n");
+    return NotPrinted;
+  }
+  return NotSpecial;
+}
+
+// PrintEscapedString - Print each character of the specified string, escaping
+// it if it is not printable or if it is an escape char.
+static void PrintEscapedString(const char *Str, unsigned Length,
+                               raw_ostream &Out) {
+  for (unsigned i = 0; i != Length; ++i) {
+    unsigned char C = Str[i];
+    if (isprint(C) && C != '\\' && C != '"')
+      Out << C;
+    else if (C == '\\')
+      Out << "\\\\";
+    else if (C == '\"')
+      Out << "\\\"";
+    else if (C == '\t')
+      Out << "\\t";
+    else
+      Out << "\\x" << hexdigit(C >> 4) << hexdigit(C & 0x0F);
+  }
+}
+
+// PrintEscapedString - Print each character of the specified string, escaping
+// it if it is not printable or if it is an escape char.
+static void PrintEscapedString(const std::string &Str, raw_ostream &Out) {
+  PrintEscapedString(Str.c_str(), Str.size(), Out);
+}
+
+bool CWriter::doInitialization(Module &M) {
+  TheModule = &M;
+
+  TD = new DataLayout(&M);
+  IL = new IntrinsicLowering(*TD);
+  // CHECK: Looking at lib/CodeGen/IntrinsicsLowering.cpp this func not supported
+  // This func creates defs which are created once each call is referenced anyway
+  //IL->AddPrototypes(M);
+
+#if 0
+  std::string Triple = TheModule->getTargetTriple();
+  if (Triple.empty())
+    Triple = llvm::sys::getDefaultTargetTriple();
+
+  std::string E;
+  if (const Target *Match = TargetRegistry::lookupTarget(Triple, E))
+    TAsm = Match->createMCAsmInfo(Triple);
+#endif
+  TAsm = new CBEMCAsmInfo();
+  MRI  = new MCRegisterInfo();
+  TCtx = new MCContext(TAsm, MRI, NULL);
+  return false;
+}
+
+bool CWriter::doFinalization(Module &M) {
+  // Output all code to the file
+  std::string methods = Out.str();
+  _Out.clear();
+  generateHeader(M);
+  std::string header = Out.str();
+  _Out.clear();
+  FileOut << header << methods;
+
+  // Free memory...
+  delete IL;
+  delete TD;
+  delete TCtx;
+  delete TAsm;
+  delete MRI;
+  delete MOFI;
+  FPConstantMap.clear();
+  ByValParams.clear();
+  AnonValueNumbers.clear();
+  UnnamedStructIDs.clear();
+  UnnamedFunctionIDs.clear();
+  TypedefDeclTypes.clear();
+  SelectDeclTypes.clear();
+  CmpDeclTypes.clear();
+  CastOpDeclTypes.clear();
+  InlineOpDeclTypes.clear();
+  CtorDeclTypes.clear();
+  prototypesToGen.clear();
+
+  // reset all state
+  FPCounter = 0;
+  OpaqueCounter = 0;
+  NextAnonValueNumber = 0;
+  NextAnonStructNumber = 0;
+  NextFunctionNumber = 0;
+  return true; // may have lowered an IntrinsicCall
+}
+
+void CWriter::generateHeader(Module &M) {
+  // Keep track of which functions are static ctors/dtors so they can have
+  // an attribute added to their prototypes.
+  std::set<Function*> StaticCtors, StaticDtors;
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end();
+       I != E; ++I) {
+    switch (getGlobalVariableClass(&*I)) {
+    default: break;
+    case GlobalCtors:
+      FindStaticTors(&*I, StaticCtors);
+      break;
+    case GlobalDtors:
+      FindStaticTors(&*I, StaticDtors);
+      break;
+    }
+  }
+
+  // get declaration for alloca
+//  Out << "/* Provide Declarations */\n";
+//  Out << "#include <stdarg.h>\n";      // Varargs support
+//  Out << "#include <setjmp.h>\n";      // Unwind support
+//  Out << "#include <limits.h>\n";      // With overflow intrinsics support.
+//  Out << "#include <stdint.h>\n";      // Sized integer support
+//  Out << "#include <math.h>\n";        // definitions for some math functions and numeric constants
+//  Out << "#include <APInt-C.h>\n";     // Implementations of many llvm intrinsics
+//  // Provide a definition for `bool' if not compiling with a C++ compiler.
+//  Out << "#ifndef __cplusplus\ntypedef unsigned char bool;\n#endif\n";
+//  Out << "\n";
+
+//  generateCompilerSpecificCode(Out, TD);
+
+  Out << "\n\n/* Support for floating point constants */\n"
+      << "typedef ulong ConstantDoubleTy;\n"
+      << "typedef uint ConstantFloatTy;\n"
+      << "typedef struct { ulong f1; ushort f2; "
+         "ushort pad[3]; } ConstantFP80Ty;\n"
+      // This is used for both kinds of 128-bit long double; meaning differs.
+      << "typedef struct { ulong f1; ulong f2; }"
+         " ConstantFP128Ty;\n"
+      << "\n\n/* Global Declarations */\n"
+      << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n";
+
+  // First output all the declarations for the program, because C requires
+  // Functions & globals to be declared before they are used.
+  if (!M.getModuleInlineAsm().empty()) {
+    Out << "\n/* Module asm statements */\n"
+        << "__asm__ (";
+
+    // Split the string into lines, to make it easier to read the .ll file.
+    std::string Asm = M.getModuleInlineAsm();
+    size_t CurPos = 0;
+    size_t NewLine = Asm.find_first_of('\n', CurPos);
+    while (NewLine != std::string::npos) {
+      // We found a newline, print the portion of the asm string from the
+      // last newline up to this newline.
+      Out << "\"";
+      PrintEscapedString(std::string(Asm.begin()+CurPos, Asm.begin()+NewLine),
+                         Out);
+      Out << "\\n\"\n";
+      CurPos = NewLine+1;
+      NewLine = Asm.find_first_of('\n', CurPos);
+    }
+    Out << "\"";
+    PrintEscapedString(std::string(Asm.begin()+CurPos, Asm.end()), Out);
+    Out << "\");\n"
+        << "/* End Module asm statements */\n";
+  }
+
+  // collect any remaining types
+  raw_null_ostream NullOut;
+  for (Module::global_iterator I = M.global_begin(), E = M.global_end();
+       I != E; ++I) {
+    // Ignore special globals, such as debug info.
+    if (getGlobalVariableClass(&*I))
+      continue;
+    printTypeName(NullOut, I->getType()->getElementType(), false);
+  }
+  printModuleTypes(Out);
+
+  // Global variable declarations...
+  if (!M.global_empty()) {
+    Out << "\n/* External Global Variable Declarations */\n";
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end();
+         I != E; ++I) {
+      if (!I->isDeclaration() || isEmptyType(I->getType()->getPointerElementType()))
+        continue;
+
+      if (I->hasDLLImportStorageClass())
+        Out << "__declspec(dllimport) ";
+      else if (I->hasDLLExportStorageClass())
+        Out << "__declspec(dllexport) ";
+
+      if (I->hasExternalLinkage() || I->hasExternalWeakLinkage() ||
+          I->hasCommonLinkage())
+        Out << "extern ";
+      else
+        continue; // Internal Global
+
+      // Thread Local Storage
+      if (I->isThreadLocal())
+        Out << "__thread ";
+
+      Type *ElTy = I->getType()->getElementType();
+      unsigned Alignment = I->getAlignment();
+      bool IsOveraligned = Alignment &&
+        Alignment > TD->getABITypeAlignment(ElTy);
+//      if (IsOveraligned)
+//        Out << "__MSALIGN__(" << Alignment << ") ";
+      printTypeName(Out, ElTy, false) << ' ' << GetValueName(&*I);
+      if (IsOveraligned)
+        Out << " __attribute__((aligned(" << Alignment << ")))";
+
+      if (I->hasExternalWeakLinkage())
+         Out << " __EXTERNAL_WEAK__";
+      Out << ";\n";
+    }
+  }
+
+  // Function declarations
+  Out << "\n/* Function Declarations */\n";
+
+  // Store the intrinsics which will be declared/defined below.
+  SmallVector<Function*, 16> intrinsicsToDefine;
+
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+    // Don't print declarations for intrinsic functions.
+    // Store the used intrinsics, which need to be explicitly defined.
+    if (I->isIntrinsic()) {
+      switch (I->getIntrinsicID()) {
+        default:
+          continue;
+        case Intrinsic::uadd_with_overflow:
+        case Intrinsic::sadd_with_overflow:
+        case Intrinsic::usub_with_overflow:
+        case Intrinsic::ssub_with_overflow:
+        case Intrinsic::umul_with_overflow:
+        case Intrinsic::smul_with_overflow:
+        case Intrinsic::bswap:
+        case Intrinsic::ceil:
+        case Intrinsic::ctlz:
+        case Intrinsic::ctpop:
+        case Intrinsic::cttz:
+        case Intrinsic::fabs:
+        case Intrinsic::floor:
+        case Intrinsic::fma:
+        case Intrinsic::fmuladd:
+        case Intrinsic::pow:
+        case Intrinsic::powi:
+        case Intrinsic::rint:
+        case Intrinsic::sqrt:
+        case Intrinsic::trunc:
+          intrinsicsToDefine.push_back(&*I);
+          continue;
+      }
+    }
+
+    // Skip a few functions that have already been defined in headers
+    if (I->getName() == "setjmp" ||
+        I->getName() == "longjmp" ||
+        I->getName() == "_setjmp" ||
+        I->getName() == "siglongjmp" ||
+        I->getName() == "sigsetjmp" ||
+        I->getName() == "pow" ||
+        I->getName() == "powf" ||
+        I->getName() == "sqrt" ||
+        I->getName() == "sqrtf" ||
+        I->getName() == "trunc" ||
+        I->getName() == "truncf" ||
+        I->getName() == "rint" ||
+        I->getName() == "rintf" ||
+        I->getName() == "floor" ||
+        I->getName() == "floorf" ||
+        I->getName() == "ceil" ||
+        I->getName() == "ceilf" ||
+        I->getName() == "alloca" ||
+        I->getName() == "_alloca" ||
+        I->getName() == "_chkstk" ||
+        I->getName() == "__chkstk" ||
+        I->getName() == "___chkstk_ms")
+      continue;
+
+    if (I->hasDLLImportStorageClass())
+      Out << "__declspec(dllimport) ";
+    else if (I->hasDLLExportStorageClass())
+      Out << "__declspec(dllexport) ";
+
+    if (I->hasLocalLinkage())
+      Out << "static ";
+    if (I->hasExternalWeakLinkage())
+      Out << "extern ";
+    printFunctionProto(Out, &*I);
+    if (I->hasWeakLinkage() || I->hasLinkOnceLinkage())
+      Out << " __ATTRIBUTE_WEAK__";
+    if (I->hasExternalWeakLinkage())
+      Out << " __EXTERNAL_WEAK__";
+    if (StaticCtors.count(&*I))
+      Out << " __ATTRIBUTE_CTOR__";
+    if (StaticDtors.count(&*I))
+      Out << " __ATTRIBUTE_DTOR__";
+    if (I->hasHiddenVisibility())
+      Out << " __HIDDEN__";
+
+    if (I->hasName() && I->getName()[0] == 1)
+      Out << " __asm__ (\"" << I->getName().substr(1) << "\")";
+
+    Out << ";\n";
+  }
+
+  // Output the global variable definitions and contents...
+  if (!M.global_empty()) {
+    Out << "\n\n/* Global Variable Definitions and Initialization */\n";
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end();
+         I != E; ++I) {
+      declareOneGlobalVariable(&*I);
+    }
+  }
+
+  // Alias declarations...
+  if (!M.alias_empty()) {
+    Out << "\n/* External Alias Declarations */\n";
+    for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end();
+         I != E; ++I) {
+      assert(!I->isDeclaration() && !isEmptyType(I->getType()->getPointerElementType()));
+      if (I->hasLocalLinkage())
+        continue; // Internal Global
+
+      if (I->hasDLLImportStorageClass())
+        Out << "__declspec(dllimport) ";
+      else if (I->hasDLLExportStorageClass())
+        Out << "__declspec(dllexport) ";
+
+      // Thread Local Storage
+      if (I->isThreadLocal())
+        Out << "__thread ";
+
+      Type *ElTy = I->getType()->getElementType();
+      unsigned Alignment = I->getAlignment();
+      bool IsOveraligned = Alignment &&
+        Alignment > TD->getABITypeAlignment(ElTy);
+//      if (IsOveraligned)
+//        Out << "__MSALIGN__(" << Alignment << ") ";
+      // GetValueName would resolve the alias, which is not what we want,
+      // so use getName directly instead (assuming that the Alias has a name...)
+      printTypeName(Out, ElTy, false) << " *" << I->getName();
+      if (IsOveraligned)
+        Out << " __attribute__((aligned(" << Alignment << ")))";
+
+      if (I->hasExternalWeakLinkage())
+         Out << " __EXTERNAL_WEAK__";
+      Out << " = ";
+      writeOperand(I->getAliasee(), ContextStatic);
+      Out << ";\n";
+    }
+  }
+
+  Out << "\n\n/* LLVM Intrinsic Builtin Function Bodies */\n";
+
+  // Emit some helper functions for dealing with FCMP instruction's
+  // predicates
+  Out << "static __forceinline int llvm_fcmp_ord(double X, double Y) { ";
+  Out << "return X == X && Y == Y; }\n";
+  Out << "static __forceinline int llvm_fcmp_uno(double X, double Y) { ";
+  Out << "return X != X || Y != Y; }\n";
+  Out << "static __forceinline int llvm_fcmp_ueq(double X, double Y) { ";
+  Out << "return X == Y || llvm_fcmp_uno(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_une(double X, double Y) { ";
+  Out << "return X != Y; }\n";
+  Out << "static __forceinline int llvm_fcmp_ult(double X, double Y) { ";
+  Out << "return X <  Y || llvm_fcmp_uno(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_ugt(double X, double Y) { ";
+  Out << "return X >  Y || llvm_fcmp_uno(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_ule(double X, double Y) { ";
+  Out << "return X <= Y || llvm_fcmp_uno(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_uge(double X, double Y) { ";
+  Out << "return X >= Y || llvm_fcmp_uno(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_oeq(double X, double Y) { ";
+  Out << "return X == Y ; }\n";
+  Out << "static __forceinline int llvm_fcmp_one(double X, double Y) { ";
+  Out << "return X != Y && llvm_fcmp_ord(X, Y); }\n";
+  Out << "static __forceinline int llvm_fcmp_olt(double X, double Y) { ";
+  Out << "return X <  Y ; }\n";
+  Out << "static __forceinline int llvm_fcmp_ogt(double X, double Y) { ";
+  Out << "return X >  Y ; }\n";
+  Out << "static __forceinline int llvm_fcmp_ole(double X, double Y) { ";
+  Out << "return X <= Y ; }\n";
+  Out << "static __forceinline int llvm_fcmp_oge(double X, double Y) { ";
+  Out << "return X >= Y ; }\n";
+  Out << "static __forceinline int llvm_fcmp_0(double X, double Y) { ";
+  Out << "return 0; }\n";
+  Out << "static __forceinline int llvm_fcmp_1(double X, double Y) { ";
+  Out << "return 1; }\n";
+
+  // Loop over all select operations
+  for (std::set<Type*>::iterator it = SelectDeclTypes.begin(), end = SelectDeclTypes.end();
+       it != end; ++it) {
+    // static __forceinline Rty llvm_select_u8x4(<bool x 4> condition, <u8 x 4> iftrue, <u8 x 4> ifnot) {
+    //   Rty r = {
+    //     condition[0] ? iftrue[0] : ifnot[0],
+    //     condition[1] ? iftrue[1] : ifnot[1],
+    //     condition[2] ? iftrue[2] : ifnot[2],
+    //     condition[3] ? iftrue[3] : ifnot[3]
+    //   };
+    //   return r;
+    // }
+    Out << "static __forceinline ";
+    printTypeNameUnaligned(Out, *it, false);
+    Out << " llvm_select_";
+    printTypeString(Out, *it, false);
+    Out << "(";
+    if (isa<VectorType>(*it))
+      printTypeNameUnaligned(Out, VectorType::get(Type::getInt1Ty((*it)->getContext()), (*it)->getVectorNumElements()), false);
+    else
+      Out << "bool";
+    Out << " condition, ";
+    printTypeNameUnaligned(Out, *it, false);
+    Out << " iftrue, ";
+    printTypeNameUnaligned(Out, *it, false);
+    Out << " ifnot) {\n  ";
+    printTypeNameUnaligned(Out, *it, false);
+    Out << " r;\n";
+    if (isa<VectorType>(*it)) {
+      unsigned n, l = (*it)->getVectorNumElements();
+      for (n = 0; n < l; n++) {
+        Out << "  r.vector[" << n << "] = condition.vector[" << n << "] ? iftrue.vector[" << n << "] : ifnot.vector[" << n << "];\n";
+      }
+    }
+    else {
+      Out << "  r = condition ? iftrue : ifnot;\n";
+    }
+    Out << "  return r;\n}\n";
+  }
+
+  // Loop over all compare operations
+  for (std::set< std::pair<CmpInst::Predicate, VectorType*> >::iterator it = CmpDeclTypes.begin(), end = CmpDeclTypes.end();
+       it != end; ++it) {
+    // static __forceinline <bool x 4> llvm_icmp_ge_u8x4(<u8 x 4> l, <u8 x 4> r) {
+    //   Rty c = {
+    //     l[0] >= r[0],
+    //     l[1] >= r[1],
+    //     l[2] >= r[2],
+    //     l[3] >= r[3],
+    //   };
+    //   return c;
+    // }
+    unsigned n, l = (*it).second->getVectorNumElements();
+    VectorType *RTy = VectorType::get(Type::getInt1Ty((*it).second->getContext()), l);
+    bool isSigned = CmpInst::isSigned((*it).first);
+    Out << "static __forceinline ";
+    printTypeName(Out, RTy, isSigned);
+    if (CmpInst::isFPPredicate((*it).first))
+      Out << " llvm_fcmp_";
+    else
+      Out << " llvm_icmp_";
+    Out << getCmpPredicateName((*it).first) << "_";
+    printTypeString(Out, (*it).second, isSigned);
+    Out << "(";
+    printTypeNameUnaligned(Out, (*it).second, isSigned);
+    Out << " l, ";
+    printTypeNameUnaligned(Out, (*it).second, isSigned);
+    Out << " r) {\n  ";
+    printTypeName(Out, RTy, isSigned);
+    Out << " c;\n";
+    for (n = 0; n < l; n++) {
+      Out << "  c.vector[" << n << "] = ";
+      if (CmpInst::isFPPredicate((*it).first)) {
+        Out << "llvm_fcmp_ " << getCmpPredicateName((*it).first) << "(l.vector[" << n << "], r.vector[" << n << "]);\n";
+      } else {
+        Out << "l.vector[" << n << "]";
+        switch ((*it).first) {
+        case CmpInst::ICMP_EQ:  Out << " == "; break;
+        case CmpInst::ICMP_NE:  Out << " != "; break;
+        case CmpInst::ICMP_ULE:
+        case CmpInst::ICMP_SLE: Out << " <= "; break;
+        case CmpInst::ICMP_UGE:
+        case CmpInst::ICMP_SGE: Out << " >= "; break;
+        case CmpInst::ICMP_ULT:
+        case CmpInst::ICMP_SLT: Out << " < "; break;
+        case CmpInst::ICMP_UGT:
+        case CmpInst::ICMP_SGT: Out << " > "; break;
+        default:
+#ifndef NDEBUG
+          errs() << "Invalid icmp predicate!" << (*it).first;
+#endif
+          llvm_unreachable(0);
+        }
+        Out << "r.vector[" << n << "];\n";
+      }
+    }
+    Out << "  return c;\n}\n";
+  }
+
+  // Loop over all (vector) cast operations
+  for (std::set<std::pair<CastInst::CastOps, std::pair<Type*, Type*>>>::iterator it = CastOpDeclTypes.begin(), end = CastOpDeclTypes.end();
+       it != end; ++it) {
+    // static __forceinline <u32 x 4> llvm_ZExt_u8x4_u32x4(<u8 x 4> in) { // Src->isVector == Dst->isVector
+    //   Rty out = {
+    //     in[0],
+    //     in[1],
+    //     in[2],
+    //     in[3]
+    //   };
+    //   return out;
+    // }
+    // static __forceinline u32 llvm_BitCast_u8x4_u32(<u8 x 4> in) { // Src->bitsSize == Dst->bitsSize
+    //   union {
+    //     <u8 x 4> in;
+    //     u32 out;
+    //   } cast;
+    //   cast.in = in;
+    //   return cast.out;
+    // }
+    CastInst::CastOps opcode = (*it).first;
+    Type *SrcTy = (*it).second.first;
+    Type *DstTy = (*it).second.second;
+    bool SrcSigned, DstSigned;
+    switch (opcode) {
+    default:
+      SrcSigned = false;
+      DstSigned = false;
+    case Instruction::SIToFP:
+      SrcSigned = true;
+      DstSigned = false;
+    case Instruction::FPToSI:
+      SrcSigned = false;
+      DstSigned = true;
+    case Instruction::SExt:
+      SrcSigned = true;
+      DstSigned = true;
+    }
+
+    Out << "static __forceinline ";
+    printTypeName(Out, DstTy, DstSigned);
+    Out << " llvm_" << Instruction::getOpcodeName(opcode) << "_";
+    printTypeString(Out, SrcTy, false);
+    Out << "_";
+    printTypeString(Out, DstTy, false);
+    Out << "(";
+    printTypeNameUnaligned(Out, SrcTy, SrcSigned);
+    Out << " in) {\n";
+    if (opcode == Instruction::BitCast) {
+      Out << "  union {\n    ";
+      printTypeName(Out, SrcTy, SrcSigned);
+      Out << " in;\n    ";
+      printTypeName(Out, DstTy, DstSigned);
+      Out << " out;\n  } cast;\n";
+      Out << "  cast.in = in;\n  return cast.out;\n}\n";
+    } else if (isa<VectorType>(DstTy)) {
+      Out << "  ";
+      printTypeName(Out, DstTy, DstSigned);
+      Out << " out;\n";
+      unsigned n, l = DstTy->getVectorNumElements();
+      assert(SrcTy->getVectorNumElements() == l);
+      for (n = 0; n < l; n++) {
+        Out << "  out.vector[" << n << "] = in.vector[" << n << "];\n";
+      }
+      Out << "  return out;\n}\n";
+    } else {
+      Out << "#ifndef __emulate_i128\n";
+      // easy case first: compiler supports i128 natively
+      Out << "  return in;\n";
+      Out << "#else\n";
+      Out << "  ";
+      printTypeName(Out, DstTy, DstSigned);
+      Out << " out;\n";
+      Out << "  LLVM";
+      switch (opcode) {
+      case Instruction::UIToFP: Out << "UItoFP"; break;
+      case Instruction::SIToFP: Out << "SItoFP"; break;
+      case Instruction::Trunc: Out << "Trunc"; break;
+      //case Instruction::FPExt:
+      //case Instruction::FPTrunc:
+      case Instruction::ZExt: Out << "ZExt"; break;
+      case Instruction::FPToUI: Out << "FPtoUI"; break;
+      case Instruction::SExt: Out << "SExt"; break;
+      case Instruction::FPToSI: Out << "FPtoSI"; break;
+      default:
+        llvm_unreachable("Invalid cast opcode for i128");
+      }
+      Out << "(" << SrcTy->getPrimitiveSizeInBits() << ", &in, "
+                 << DstTy->getPrimitiveSizeInBits() << ", &out);\n";
+      Out << "  return out;\n";
+      Out << "#endif\n";
+      Out << "}\n";
+    }
+  }
+
+  // Loop over all simple vector operations
+  for (std::set<std::pair<unsigned, Type*>>::iterator it = InlineOpDeclTypes.begin(), end = InlineOpDeclTypes.end();
+       it != end; ++it) {
+    // static __forceinline <u32 x 4> llvm_BinOp_u32x4(<u32 x 4> a, <u32 x 4> b) {
+    //   Rty r = {
+    //      a[0] OP b[0],
+    //      a[1] OP b[1],
+    //      a[2] OP b[2],
+    //      a[3] OP b[3],
+    //   };
+    //   return r;
+    // }
+    unsigned opcode = (*it).first;
+    Type *OpTy = (*it).second;
+    Type *ElemTy = isa<VectorType>(OpTy) ? OpTy->getVectorElementType() : OpTy;
+    bool shouldCast;
+    bool isSigned;
+    opcodeNeedsCast(opcode, shouldCast, isSigned);
+
+    Out << "static __forceinline ";
+    printTypeName(Out, OpTy);
+    if (opcode == BinaryNeg) {
+      Out << " llvm_neg_";
+      printTypeString(Out, OpTy, false);
+      Out << "(";
+      printTypeNameUnaligned(Out, OpTy, isSigned);
+      Out << " a) {\n  ";
+    } else if (opcode == BinaryNot) {
+      Out << " llvm_not_";
+      printTypeString(Out, OpTy, false);
+      Out << "(";
+      printTypeNameUnaligned(Out, OpTy, isSigned);
+      Out << " a) {\n  ";
+    } else {
+      Out << " llvm_" << Instruction::getOpcodeName(opcode) << "_";
+      printTypeString(Out, OpTy, false);
+      Out << "(";
+      printTypeNameUnaligned(Out, OpTy, isSigned);
+      Out << " a, ";
+      printTypeNameUnaligned(Out, OpTy, isSigned);
+      Out << " b) {\n  ";
+    }
+
+    printTypeName(Out, OpTy);
+    // C can't handle non-power-of-two integer types
+    unsigned mask = 0;
+    if (ElemTy->isIntegerTy()) {
+       IntegerType *ITy = static_cast<IntegerType*>(ElemTy);
+       if (!ITy->isPowerOf2ByteWidth())
+         mask = ITy->getBitMask();
+    }
+
+    if (isa<VectorType>(OpTy)) {
+      Out << " r;\n";
+      unsigned n, l = OpTy->getVectorNumElements();
+      for (n = 0; n < l; n++) {
+        Out << "  r.vector[" << n << "] = ";
+        if (mask)
+          Out << "(";
+        if (opcode == BinaryNeg) {
+          Out << "-a.vector[" << n << "]";
+        } else if (opcode == BinaryNot) {
+          Out << "~a.vector[" << n << "]";
+        } else if (opcode == Instruction::FRem) {
+          // Output a call to fmod/fmodf instead of emitting a%b
+          if (ElemTy->isFloatTy())
+            Out << "fmodf(a.vector[" << n << "], b.vector[" << n << "])";
+          else if (ElemTy->isDoubleTy())
+            Out << "fmod(a.vector[" << n << "], b.vector[" << n << "])";
+          else  // all 3 flavors of long double
+            Out << "fmodl(a.vector[" << n << "], b.vector[" << n << "])";
+        } else {
+          Out << "a.vector[" << n << "]";
+          switch (opcode) {
+          case Instruction::Add:
+          case Instruction::FAdd: Out << " + "; break;
+          case Instruction::Sub:
+          case Instruction::FSub: Out << " - "; break;
+          case Instruction::Mul:
+          case Instruction::FMul: Out << " * "; break;
+          case Instruction::URem:
+          case Instruction::SRem:
+          case Instruction::FRem: Out << " % "; break;
+          case Instruction::UDiv:
+          case Instruction::SDiv:
+          case Instruction::FDiv: Out << " / "; break;
+          case Instruction::And:  Out << " & "; break;
+          case Instruction::Or:   Out << " | "; break;
+          case Instruction::Xor:  Out << " ^ "; break;
+          case Instruction::Shl : Out << " << "; break;
+          case Instruction::LShr:
+          case Instruction::AShr: Out << " >> "; break;
+          default:
+#ifndef NDEBUG
+             errs() << "Invalid operator type!" << opcode;
+#endif
+             llvm_unreachable(0);
+          }
+          Out << "b.vector[" << n << "]";
+        }
+        if (mask)
+          Out << ") & " << mask;
+        Out << ";\n";
+      }
+
+    } else if (OpTy->getPrimitiveSizeInBits() > 64) {
+      Out << " r;\n";
+      Out << "#ifndef __emulate_i128\n";
+      // easy case first: compiler supports i128 natively
+      Out << "  r = ";
+      if (opcode == BinaryNeg) {
+        Out << "-a;\n";
+      } else if (opcode == BinaryNot) {
+        Out << "~a;\n";
+      } else {
+        Out << "a";
+        switch (opcode) {
+        case Instruction::Add: Out << " + "; break;
+        case Instruction::Sub: Out << " - "; break;
+        case Instruction::Mul: Out << " * "; break;
+        case Instruction::URem:
+        case Instruction::SRem: Out << " % "; break;
+        case Instruction::UDiv:
+        case Instruction::SDiv: Out << " / "; break;
+        case Instruction::And:  Out << " & "; break;
+        case Instruction::Or:   Out << " | "; break;
+        case Instruction::Xor:  Out << " ^ "; break;
+        case Instruction::Shl:  Out << " << "; break;
+        case Instruction::LShr:
+        case Instruction::AShr: Out << " >> "; break;
+        default:
+#ifndef NDEBUG
+           errs() << "Invalid operator type!" << opcode;
+#endif
+           llvm_unreachable(0);
+        }
+        Out << "b;\n";
+      }
+      Out << "#else\n";
+      // emulated twos-complement i128 math
+      if (opcode == BinaryNeg) {
+        Out << "  r.hi = ~a.hi;\n";
+        Out << "  r.lo = ~a.lo + 1;\n";
+        Out << "  if (r.lo == 0) r.hi += 1;\n"; // overflow: carry the one
+      } else if (opcode == BinaryNot) {
+        Out << "  r.hi = ~a.hi;\n";
+        Out << "  r.lo = ~a.lo;\n";
+      } else if (opcode == Instruction::And) {
+        Out << "  r.hi = a.hi & b.hi;\n";
+        Out << "  r.lo = a.lo & b.lo;\n";
+      } else if (opcode == Instruction::Or) {
+        Out << "  r.hi = a.hi | b.hi;\n";
+        Out << "  r.lo = a.lo | b.lo;\n";
+      } else if (opcode == Instruction::Xor) {
+        Out << "  r.hi = a.hi ^ b.hi;\n";
+        Out << "  r.lo = a.lo ^ b.lo;\n";
+      } else if (opcode == Instruction::Shl) { // reminder: undef behavior if b >= 128
+        Out << "  if (b.lo >= 64) {\n";
+        Out << "    r.hi = (a.lo << (b.lo - 64));\n";
+        Out << "    r.lo = 0;\n";
+        Out << "  } else if (b.lo == 0) {\n";
+        Out << "    r.hi = a.hi;\n";
+        Out << "    r.lo = a.lo;\n";
+        Out << "  } else {\n";
+        Out << "    r.hi = (a.hi << b.lo) | (a.lo >> (64 - b.lo));\n";
+        Out << "    r.lo = a.lo << b.lo;\n";
+        Out << "  }\n";
+      } else {
+        // everything that hasn't been manually implemented above
+        Out << "  LLVM";
+        switch (opcode) {
+        //case BinaryNeg: Out << "Neg"; break;
+        //case BinaryNot: Out << "FlipAllBits"; break;
+        case Instruction::Add: Out << "Add"; break;
+        case Instruction::Sub: Out << "Sub"; break;
+        case Instruction::Mul: Out << "Mul"; break;
+        case Instruction::URem: Out << "URem"; break;
+        case Instruction::SRem: Out << "SRem"; break;
+        case Instruction::UDiv: Out << "UDiv"; break;
+        case Instruction::SDiv: Out << "SDiv"; break;
+        //case Instruction::And:  Out << "And"; break;
+        //case Instruction::Or:   Out << "Or"; break;
+        //case Instruction::Xor:  Out << "Xor"; break;
+        //case Instruction::Shl: Out << "Shl"; break;
+        case Instruction::LShr: Out << "LShr"; break;
+        case Instruction::AShr: Out << "AShr"; break;
+        default:
+#ifndef NDEBUG
+           errs() << "Invalid operator type!" << opcode;
+#endif
+           llvm_unreachable(0);
+        }
+        Out << "(16, &a, &b, &r);\n";
+      }
+      Out << "#endif\n";
+
+    } else {
+      Out << " r = ";
+      if (mask)
+        Out << "(";
+      if (opcode == BinaryNeg) {
+        Out << "-a";
+      } else if (opcode == BinaryNot) {
+        Out << "~a";
+      } else if (opcode == Instruction::FRem) {
+        // Output a call to fmod/fmodf instead of emitting a%b
+        if (ElemTy->isFloatTy())
+          Out << "fmodf(a, b)";
+        else if (ElemTy->isDoubleTy())
+          Out << "fmod(a, b)";
+        else  // all 3 flavors of long double
+          Out << "fmodl(a, b)";
+      } else {
+        Out << "a";
+        switch (opcode) {
+        case Instruction::Add:
+        case Instruction::FAdd: Out << " + "; break;
+        case Instruction::Sub:
+        case Instruction::FSub: Out << " - "; break;
+        case Instruction::Mul:
+        case Instruction::FMul: Out << " * "; break;
+        case Instruction::URem:
+        case Instruction::SRem:
+        case Instruction::FRem: Out << " % "; break;
+        case Instruction::UDiv:
+        case Instruction::SDiv:
+        case Instruction::FDiv: Out << " / "; break;
+        case Instruction::And:  Out << " & "; break;
+        case Instruction::Or:   Out << " | "; break;
+        case Instruction::Xor:  Out << " ^ "; break;
+        case Instruction::Shl : Out << " << "; break;
+        case Instruction::LShr:
+        case Instruction::AShr: Out << " >> "; break;
+        default:
+#ifndef NDEBUG
+           errs() << "Invalid operator type!" << opcode;
+#endif
+           llvm_unreachable(0);
+        }
+        Out << "b";
+        if (mask)
+          Out << ") & " << mask;
+      }
+      Out << ";\n";
+    }
+    Out << "  return r;\n}\n";
+  }
+
+  // Loop over all inline constructors
+  for (std::set<Type*>::iterator it = CtorDeclTypes.begin(), end = CtorDeclTypes.end();
+       it != end; ++it) {
+    // static __forceinline <u32 x 4> llvm_ctor_u32x4(u32 x1, u32 x2, u32 x3, u32 x4) {
+    //   Rty r = {
+    //     x1, x2, x3, x4
+    //   };
+    //   return r;
+    // }
+    Out << "static __forceinline ";
+    printTypeName(Out, *it);
+    Out << " llvm_ctor_";
+    printTypeString(Out, *it, false);
+    Out << "(";
+    StructType *STy = dyn_cast<StructType>(*it);
+    ArrayType *ATy = dyn_cast<ArrayType>(*it);
+    VectorType *VTy = dyn_cast<VectorType>(*it);
+    unsigned e = (STy ? STy->getNumElements() : (ATy ? ATy->getNumElements() : VTy->getNumElements()));
+    bool printed = false;
+    for (unsigned i = 0; i != e; ++i) {
+        Type *ElTy = STy ? STy->getElementType(i) : (*it)->getSequentialElementType();
+        if (isEmptyType(ElTy))
+          Out << " /* ";
+        else if (printed)
+          Out << ", ";
+        printTypeNameUnaligned(Out, ElTy);
+        Out << " x" << i;
+        if (isEmptyType(ElTy))
+          Out << " */";
+        else
+          printed = true;
+    }
+    Out << ") {\n  ";
+    printTypeName(Out, *it);
+    Out << " r;";
+    for (unsigned i = 0; i != e; ++i) {
+        Type *ElTy = STy ? STy->getElementType(i) : (*it)->getSequentialElementType();
+        if (isEmptyType(ElTy))
+          continue;
+        if (STy)
+          Out << "\n  r.field" << i << " = x" << i << ";";
+        else if (ATy)
+          Out << "\n  r.array[" << i << "] = x" << i << ";";
+        else if (VTy)
+          Out << "\n  r.vector[" << i << "] = x" << i << ";";
+        else
+          assert(0);
+    }
+    Out << "\n  return r;\n}\n";
+  }
+
+  // Emit definitions of the intrinsics.
+  for (SmallVector<Function*, 16>::iterator
+       I = intrinsicsToDefine.begin(),
+       E = intrinsicsToDefine.end(); I != E; ++I) {
+    printIntrinsicDefinition(**I, Out);
+  }
+
+  if (!M.empty())
+    Out << "\n\n/* Function Bodies */\n";
+}
+
+void CWriter::declareOneGlobalVariable(GlobalVariable* I) {
+  if (I->isDeclaration() || isEmptyType(I->getType()->getPointerElementType()))
+    return;
+
+  // Ignore special globals, such as debug info.
+  if (getGlobalVariableClass(&*I))
+    return;
+
+  if (I->hasDLLImportStorageClass())
+    Out << "__declspec(dllimport) ";
+  else if (I->hasDLLExportStorageClass())
+    Out << "__declspec(dllexport) ";
+
+  if (I->hasLocalLinkage())
+    Out << "static ";
+
+  // Thread Local Storage
+  if (I->isThreadLocal())
+    Out << "__thread ";
+
+  Type *ElTy = I->getType()->getElementType();
+  unsigned Alignment = I->getAlignment();
+  bool IsOveraligned = Alignment &&
+    Alignment > TD->getABITypeAlignment(ElTy);
+//  if (IsOveraligned)
+//    Out << "__MSALIGN__(" << Alignment << ") ";
+  printTypeName(Out, ElTy, false) << ' ' << GetValueName(I);
+  if (IsOveraligned)
+    Out << " __attribute__((aligned(" << Alignment << ")))";
+
+  if (I->hasLinkOnceLinkage())
+    Out << " __attribute__((common))";
+  else if (I->hasWeakLinkage())
+    Out << " __ATTRIBUTE_WEAK__";
+  else if (I->hasCommonLinkage())
+    Out << " __ATTRIBUTE_WEAK__";
+
+  if (I->hasHiddenVisibility())
+    Out << " __HIDDEN__";
+
+  // If the initializer is not null, emit the initializer.  If it is null,
+  // we try to avoid emitting large amounts of zeros.  The problem with
+  // this, however, occurs when the variable has weak linkage.  In this
+  // case, the assembler will complain about the variable being both weak
+  // and common, so we disable this optimization.
+  // FIXME common linkage should avoid this problem.
+  if (!I->getInitializer()->isNullValue()) {
+    Out << " = " ;
+    writeOperand(I->getInitializer(), ContextStatic);
+  } else if (I->hasWeakLinkage()) {
+    // We have to specify an initializer, but it doesn't have to be
+    // complete.  If the value is an aggregate, print out { 0 }, and let
+    // the compiler figure out the rest of the zeros.
+    Out << " = " ;
+    if (I->getInitializer()->getType()->isStructTy() ||
+        I->getInitializer()->getType()->isVectorTy()) {
+      Out << "{ 0 }";
+    } else if (I->getInitializer()->getType()->isArrayTy()) {
+      // As with structs and vectors, but with an extra set of braces
+      // because arrays are wrapped in structs.
+      Out << "{ { 0 } }";
+    } else {
+      // Just print it out normally.
+      writeOperand(I->getInitializer(), ContextStatic);
+    }
+  }
+  Out << ";\n";
+}
+
+/// Output all floating point constants that cannot be printed accurately...
+void CWriter::printFloatingPointConstants(Function &F) {
+  // Scan the module for floating point constants.  If any FP constant is used
+  // in the function, we want to redirect it here so that we do not depend on
+  // the precision of the printed form, unless the printed form preserves
+  // precision.
+  //
+  for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I)
+      for (Instruction::op_iterator I_Op = I->op_begin(), E_Op = I->op_end(); I_Op != E_Op; ++I_Op)
+          if (const Constant *C = dyn_cast<Constant>(I_Op))
+            printFloatingPointConstants(C);
+  Out << '\n';
+}
+
+void CWriter::printFloatingPointConstants(const Constant *C) {
+  // If this is a constant expression, recursively check for constant fp values.
+  if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
+    for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
+      printFloatingPointConstants(CE->getOperand(i));
+    return;
+  }
+
+  // Otherwise, check for a FP constant that we need to print.
+  const ConstantFP *FPC = dyn_cast<ConstantFP>(C);
+  if (FPC == 0 ||
+      // Do not put in FPConstantMap if safe.
+      isFPCSafeToPrint(FPC) ||
+      // Already printed this constant?
+      FPConstantMap.count(FPC))
+    return;
+
+  FPConstantMap[FPC] = FPCounter;  // Number the FP constants
+
+  if (FPC->getType() == Type::getDoubleTy(FPC->getContext())) {
+    double Val = FPC->getValueAPF().convertToDouble();
+    uint64_t i = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
+    Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
+    << " = 0x" << utohexstr(i)
+    << "ULL;    /* " << Val << " */\n";
+  } else if (FPC->getType() == Type::getFloatTy(FPC->getContext())) {
+    float Val = FPC->getValueAPF().convertToFloat();
+    uint32_t i = (uint32_t)FPC->getValueAPF().bitcastToAPInt().
+    getZExtValue();
+    Out << "static const ConstantFloatTy FPConstant" << FPCounter++
+    << " = 0x" << utohexstr(i)
+    << "U;    /* " << Val << " */\n";
+  } else if (FPC->getType() == Type::getX86_FP80Ty(FPC->getContext())) {
+    // api needed to prevent premature destruction
+    const APInt api = FPC->getValueAPF().bitcastToAPInt();
+    const uint64_t *p = api.getRawData();
+    Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
+    << " = { 0x" << utohexstr(p[0])
+    << "ULL, 0x" << utohexstr((uint16_t)p[1]) << ",{0,0,0}"
+    << "}; /* Long double constant */\n";
+  } else if (FPC->getType() == Type::getPPC_FP128Ty(FPC->getContext()) ||
+             FPC->getType() == Type::getFP128Ty(FPC->getContext())) {
+    const APInt api = FPC->getValueAPF().bitcastToAPInt();
+    const uint64_t *p = api.getRawData();
+    Out << "static const ConstantFP128Ty FPConstant" << FPCounter++
+    << " = { 0x"
+    << utohexstr(p[0]) << ", 0x" << utohexstr(p[1])
+    << "}; /* Long double constant */\n";
+
+  } else {
+    llvm_unreachable("Unknown float type!");
+  }
+}
+
+
+/// printSymbolTable - Run through symbol table looking for type names.  If a
+/// type name is found, emit its declaration...
+///
+void CWriter::printModuleTypes(raw_ostream &Out) {
+  Out << "/* Helper union for bitcasts */\n";
+  Out << "typedef union {\n";
+  Out << "  uint Int32;\n";
+  Out << "  ulong Int64;\n";
+  Out << "  float Float;\n";
+  Out << "  double Double;\n";
+  Out << "} llvmBitCastUnion;\n";
+
+  // Keep track of which types have been printed so far.
+  std::set<Type*> TypesPrinted;
+
+  // Loop over all structures then push them into the stack so they are
+  // printed in the correct order.
+  Out << "\n/* Types Declarations */\n";
+
+  // forward-declare all structs here first
+
+  {
+    std::set<Type*> TypesPrinted;
+    for (auto it = TypedefDeclTypes.begin(), end = TypedefDeclTypes.end(); it != end; ++it) {
+      forwardDeclareStructs(Out, *it, TypesPrinted);
+    }
+  }
+
+  // forward-declare all function pointer typedefs (Issue #2)
+
+  {
+    std::set<Type*> TypesPrinted;
+    for (auto it = TypedefDeclTypes.begin(), end = TypedefDeclTypes.end(); it != end; ++it) {
+      forwardDeclareFunctionTypedefs(Out, *it, TypesPrinted);
+    }
+  }
+
+
+  Out << "\n/* Types Definitions */\n";
+
+  for (auto it = TypedefDeclTypes.begin(), end = TypedefDeclTypes.end(); it != end; ++it) {
+    printContainedTypes(Out, *it, TypesPrinted);
+  }
+
+  Out << "\n/* Function definitions */\n";
+
+  // Question: Is UnnamedFunctionIDs ever non-empty?
+  for (DenseMap<std::pair<FunctionType*,
+	 std::pair<AttributeList, CallingConv::ID> >, unsigned>::iterator
+       I = UnnamedFunctionIDs.begin(), E = UnnamedFunctionIDs.end();
+       I != E; ++I) {
+    
+    Out << '\n';
+    std::pair<FunctionType*, std::pair<AttributeList, CallingConv::ID> > F = I->first;
+    if (F.second.first == AttributeList() && F.second.second == CallingConv::C)
+        if (!TypesPrinted.insert(F.first).second) continue; // already printed this above
+
+    // FIXME: Removing apparently unused function call - need to check
+    printFunctionDeclaration(Out, F.first, F.second);
+  }
+
+  // We may have collected some intrinsic prototypes to emit.
+  // Emit them now, before the function that uses them is emitted
+  for (std::vector<Function*>::iterator
+       I = prototypesToGen.begin(), E = prototypesToGen.end();
+       I != E; ++I) {
+    Out << '\n';
+    Function *F = *I;
+    printFunctionProto(Out, F);
+    Out << ";\n";
+  }
+}
+
+void CWriter::forwardDeclareStructs(raw_ostream &Out, Type *Ty, std::set<Type*> &TypesPrinted) {
+  if (!TypesPrinted.insert(Ty).second) return;
+  if (isEmptyType(Ty)) return;
+
+  for (auto I = Ty->subtype_begin(); I != Ty->subtype_end(); ++I) {
+    forwardDeclareStructs(Out, *I, TypesPrinted);
+  }
+
+  if (StructType *ST = dyn_cast<StructType>(Ty)) {
+    Out << getStructName(ST) << ";\n";
+  }
+}
+
+void CWriter::forwardDeclareFunctionTypedefs(raw_ostream &Out, Type *Ty, std::set<Type*> &TypesPrinted) {
+  if (!TypesPrinted.insert(Ty).second) return;
+  if (isEmptyType(Ty)) return;
+
+  for (auto I = Ty->subtype_begin(); I != Ty->subtype_end(); ++I) {
+    forwardDeclareFunctionTypedefs(Out, *I, TypesPrinted);
+  }
+
+  if (FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
+    printFunctionDeclaration(Out, FT);
+  }
+}
+
+// Push the struct onto the stack and recursively push all structs
+// this one depends on.
+//
+void CWriter::printContainedTypes(raw_ostream &Out, Type *Ty,
+                                    std::set<Type*> &TypesPrinted) {
+  // Check to see if we have already printed this struct.
+  if (!TypesPrinted.insert(Ty).second) return;
+  // Skip empty structs
+  if (isEmptyType(Ty)) return;
+
+  // Print all contained types first.
+  for (Type::subtype_iterator I = Ty->subtype_begin(),
+       E = Ty->subtype_end(); I != E; ++I)
+    printContainedTypes(Out, *I, TypesPrinted);
+
+  if (StructType *ST = dyn_cast<StructType>(Ty)) {
+    // Print structure type out.
+    printStructDeclaration(Out, ST);
+  } else if (ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
+    // Print array type out.
+    printArrayDeclaration(Out, AT);
+  } else if (VectorType *VT = dyn_cast<VectorType>(Ty)) {
+    // Print vector type out.
+    printVectorDeclaration(Out, VT);
+  }
+}
+
+static inline bool isFPIntBitCast(Instruction &I) {
+  if (!isa<BitCastInst>(I))
+    return false;
+  Type *SrcTy = I.getOperand(0)->getType();
+  Type *DstTy = I.getType();
+  return (SrcTy->isFloatingPointTy() && DstTy->isIntegerTy()) ||
+         (DstTy->isFloatingPointTy() && SrcTy->isIntegerTy());
+}
+
+void CWriter::printFunction(Function &F) {
+  bool isKernel = false;
+  
+  if (NamedMDNode * KernelMD = F.getParent()->getNamedMetadata("opencl.kernels")) {
+    for (auto iter : KernelMD->operands()) {
+//      DEBUG( errs() << "Kernel Metadata: " << *iter << "\n");
+      const MDOperand *KernelMDOp = iter->operands().begin();
+      Metadata *KMD = KernelMDOp->get();
+      if(ValueAsMetadata *KMDVAM = dyn_cast<ValueAsMetadata>(KMD)){
+        Value *KMDVal = KMDVAM->getValue();
+        Function *KMDFunc = dyn_cast<Function>(KMDVal);
+        if(KMDFunc == &F) {
+          //DEBUG(errs() << "-->Kernel Func: " << KMDFunc->getName() << "\n");
+          isKernel = true;
+        }
+      }
+    }
+  }
+
+  /// isStructReturn - Should this function actually return a struct by-value?
+  bool isStructReturn = F.hasStructRetAttr();
+
+  assert(!F.isDeclaration());
+  if (F.hasDLLImportStorageClass()) Out << "__declspec(dllimport) ";
+  if (F.hasDLLExportStorageClass()) Out << "__declspec(dllexport) ";
+  if (F.hasLocalLinkage()) Out << "static ";
+  printFunctionProto(Out, F.getFunctionType(),
+		     std::make_pair(F.getAttributes(), F.getCallingConv()),
+		     GetValueName(&F),
+		     F.arg_begin(), // NOTE: replacing ArgumentList (LLVM-4) with arg iterator
+		     //&F.getArgumentList(),
+		     isKernel);
+  
+  Out << " {\n";
+
+  // If this is a struct return function, handle the result with magic.
+  if (isStructReturn) {
+    Type *StructTy =
+      cast<PointerType>(F.arg_begin()->getType())->getElementType();
+    Out << "  ";
+    printTypeName(Out, StructTy, false) << " StructReturn;  /* Struct return temporary */\n";
+
+    Out << "  ";
+    printTypeName(Out, F.arg_begin()->getType(), false);
+    Out << GetValueName(&*F.arg_begin()) << " = &StructReturn;\n";
+  }
+
+  bool PrintedVar = false;
+
+  // print local variable information for the function
+  for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
+    if (AllocaInst *AI = isDirectAlloca(&*I)) {
+			//DEBUG(errs() << "Processing alloca inst: " << *AI << "\n");
+      unsigned Alignment = AI->getAlignment();
+      bool IsOveraligned = Alignment &&
+        Alignment > TD->getABITypeAlignment(AI->getAllocatedType());
+      Out << "  ";
+//      if (IsOveraligned)
+//        Out << "__MSALIGN__(" << Alignment << ") ";
+      printTypeName(Out, AI->getAllocatedType(), false) << ' ';
+      Out << GetValueName(AI);
+      if (IsOveraligned)
+        Out << " __attribute__((aligned(" << Alignment << ")))";
+      if (AI->isArrayAllocation()) {
+				//DEBUG(errs() << "Alloca is an array allocation!\n");
+        unsigned arraySize = dyn_cast<ConstantInt>(AI->getArraySize())->getZExtValue();
+        Out << "[" << arraySize << "]";
+      }
+      Out << ";    /* Address-exposed local */\n";
+      PrintedVar = true;
+    } else if (!isEmptyType(I->getType()) &&
+               !isInlinableInst(*I)) {
+      Out << "  ";
+      printTypeName(Out, I->getType(), false) << ' ' << GetValueName(&*I);
+      Out << ";\n";
+
+      if (isa<PHINode>(*I)) {  // Print out PHI node temporaries as well...
+        Out << "  ";
+        printTypeName(Out, I->getType(), false) << ' ' << (GetValueName(&*I)+"__PHI_TEMPORARY");
+        Out << ";\n";
+      }
+      PrintedVar = true;
+    }
+    // We need a temporary for the BitCast to use so it can pluck a value out
+    // of a union to do the BitCast. This is separate from the need for a
+    // variable to hold the result of the BitCast.
+    if (isFPIntBitCast(*I)) {
+      Out << "  llvmBitCastUnion " << GetValueName(&*I)
+          << "__BITCAST_TEMPORARY;\n";
+      PrintedVar = true;
+    }
+  }
+
+  if (PrintedVar)
+    Out << '\n';
+
+  // print the basic blocks
+//  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
+  
+  std::set<BasicBlock*> VisitSet;
+  BasicBlock* entry = &(F.getEntryBlock());
+  // starting printing from entry, then CFG traversal will print the reachable blocks.
+  printBBorLoop(entry);
+//  for (df_iterator<BasicBlock*> BI = df_begin(entry), BE = df_end(entry); BI!=BE; ++BI) { 
+//    BasicBlock *BB = *BI;
+//    printBBorLoop(BB);
+//    if(VisitedBlocks.find(BB) == VisitedBlocks.end()) {
+//      VisitedBlocks.insert(BB);
+//      if (Loop *L = LI->getLoopFor(&*BB)) {
+//        if (L->getHeader() == &*BB && L->getParentLoop() == 0)
+//          printLoop(L);
+//      } else {
+//        printBasicBlock(&*BB);
+//      }
+//    }
+//  }
+
+  Out << "}\n\n";
+}
+
+
+bool CWriter::extractIndVarChain(Instruction *Inst, std::stack<Instruction*> *IndVarChain, Instruction *Branch, unsigned indent) {
+  //Traverse def-use chain of induction variable to make sure that
+  //it ends at the branch. Keep stack of all instructions leading there.
+  for(User *U : Inst->users()) {
+//    DEBUG(errs() << std::string(indent, '-'));
+//    DEBUG(errs() << "->Found user: " << *U << "\n");
+    if(Instruction *UInst = dyn_cast<Instruction>(U)) {
+      if(UInst == Branch) {
+//        DEBUG(errs() << "Found correct path, returning!\n");
+        return true;
+      }
+      else if (isa<PHINode>(UInst)) {
+//        DEBUG(errs() << "Reached a PHI Node => Wrong path! Returning!\n");
+        continue;
+      }
+      else {
+        IndVarChain->push(UInst);
+        if(extractIndVarChain(UInst, IndVarChain, Branch, indent+2)) {
+          return true;
+        }
+        else {
+//          DEBUG(errs() << "Wrong path, popping: " << *(IndVarChain->top()) << "\n");
+          IndVarChain->pop();
+        }
+      }
+    }
+  }
+
+  return false;
+}
+
+bool CWriter::findLoopBranch(BranchInst **LBranch, BasicBlock* CurBlock, BasicBlock* LHeader, std::set<BasicBlock*>*visitSet) {
+  bool result = false;
+//  DEBUG(errs() << "Finding loop branch in " << CurBlock->getName() << "!\n");
+  if(BranchInst *LBranchTemp = dyn_cast<BranchInst>(CurBlock->getTerminator())) {
+//    DEBUG(errs() << "Branch: " << *LBranchTemp << "\n");
+    if(LBranchTemp->isConditional()) {
+      if(LBranchTemp->getSuccessor(0) == LHeader || LBranchTemp->getSuccessor(1) == LHeader) {
+        *LBranch = LBranchTemp;
+//        DEBUG(errs() << "Found Loop branch: " << **LBranch << "\n");
+        result = true;
+      } else {
+        BasicBlock* NextBlock1 = LBranchTemp->getSuccessor(0);
+        BasicBlock* NextBlock2 = LBranchTemp->getSuccessor(1);
+        if(visitSet->find(NextBlock1) == visitSet->end()) {
+//          DEBUG(errs() << "Visiting unvisited node: " << NextBlock1->getName() << "\n");
+          visitSet->insert(NextBlock1);
+          result |= findLoopBranch(LBranch, NextBlock1, LHeader, visitSet);
+        }
+        if(visitSet->find(NextBlock2) == visitSet->end()) {
+//          DEBUG(errs() << "Visiting unvisited node: " << NextBlock2->getName() << "\n");
+          visitSet->insert(NextBlock2);
+          result |= findLoopBranch(LBranch, NextBlock2, LHeader, visitSet);
+        }
+      }
+
+    } else {
+      if(LBranchTemp->getSuccessor(0) == LHeader) {
+        *LBranch = LBranchTemp;
+//        DEBUG(errs() << "Found Loop branch: " << **LBranch << "\n");
+        result = true;
+      } else {
+        BasicBlock *NextBlock = LBranchTemp->getSuccessor(0);
+        if(visitSet->find(NextBlock) == visitSet->end()) {
+//          DEBUG(errs() << "Visiting unvisited node: " << NextBlock->getName() << "\n");
+          visitSet->insert(NextBlock);
+          result |= findLoopBranch(LBranch, NextBlock, LHeader, visitSet);
+        }
+      }
+    }
+  }
+  return result; 
+}
+
+bool CWriter::traverseUseDefChain(Instruction *I, PHINode *PI) {
+//  DEBUG(errs() << "traversing: " << *I << "\n");
+  bool result = false;
+  if(PHINode *PHI = dyn_cast<PHINode>(I)) {
+    if (PI == PHI) {
+//      DEBUG(errs() << "returning true\n");
+      result = true;
+
+    } else {
+//      DEBUG(errs() << "returning false\n");
+      return false;
+    }
+  } else {
+    for (Use &U : I->operands()) {
+      if(Instruction *UInst = dyn_cast<Instruction>(U)) {
+        result |= traverseUseDefChain(UInst, PI);
+      }  
+    }
+  }
+  return result;
+}
+
+void CWriter::printLoop(Loop *L) {
+  
+  PredicatedScalarEvolution PSE(*SE, *L);
+  Out << "\n\n/* Processing Loop Block: " << L->getName() << " */\n";
+
+//  if(simplifyLoop(L, DT, LI, SE, AC, true)) {
+//    DEBUG(errs() << "Simplified loop!\n" << *L << "\n");
+//  }
+
+  PHINode *InductionVariable;
+//  auto *LoopLatch = L->getLoopLatch();
+  auto *ExitingBlock = L->getExitingBlock();
+//  DEBUG(errs() << "Exiting Block: " << ExitingBlock->getName() << "\n");
+  auto *ExitingBranch = ExitingBlock->getTerminator();
+//  DEBUG(errs() << "Exiting Branch: " << *ExitingBranch << "\n");
+  InductionDescriptor ID;
+  if (L->getLoopPreheader()==nullptr) {
+//    DEBUG(errs() << "Loop has no preheader!\n");
+  }
+//  DEBUG(errs() << "Looking for induction variables\n");
+//  if (PHINode *IndVar = L->getCanonicalInductionVariable()) {
+//    InductionVariable = IndVar;
+//    DEBUG(errs() << "Found canonical induction variable:\n" << *IndVar << "\n");
+//  }
+  bool found = false;
+  for (auto I = L->getHeader()->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PHI = cast<PHINode>(I);
+//    DEBUG(errs() << "Phi Node: " << *PHI << "\n");
+    if(InductionDescriptor::isInductionPHI(PHI,L,PSE,ID)) {
+//      DEBUG(errs() << "Found induction: " << *PHI << "\n");
+      InductionVariable = PHI;
+      found = true;
+      break;
+    }
+  }
+
+  if(!found) {
+    llvm_unreachable("Couldn't find induction Variable in loop!\n");
+  }
+
+  LInductionVars.insert(InductionVariable);
+  LoopIndVarsMap.insert(std::pair<Loop*, PHINode*>(L,InductionVariable));
+  Value *StartValue = ID.getStartValue();
+  const SCEV *Step = ID.getStep();
+//  unsigned IterationCount = SE->getSmallConstantMaxTripCount(L); 
+//  DEBUG(errs() << "StartValue: " << *StartValue << "\nStep: " << *Step << "\nIterationCount: " << IterationCount << "\n");
+
+  std::string IVOp;
+  
+  if (const SCEVConstant *stepConst = dyn_cast<SCEVConstant>(Step)) {
+    if(stepConst->getAPInt().isNonNegative()) {
+      IVOp = " + ";  
+    }
+  }
+
+  Value *IV = dyn_cast<Value>(InductionVariable);
+  std::string IVName = GetValueName(IV);
+  
+  std::string BranchPredicate;
+  ICmpInst *BranchCondition = dyn_cast<ICmpInst>(dyn_cast<BranchInst>(ExitingBranch)->getCondition());
+  switch(BranchCondition->getPredicate()) {
+    case ICmpInst::ICMP_EQ:  BranchPredicate = " != "; break;
+    case ICmpInst::ICMP_NE:  BranchPredicate = " == "; break;
+    case ICmpInst::ICMP_ULE:
+    case ICmpInst::ICMP_SLE: BranchPredicate = " > "; break;
+    case ICmpInst::ICMP_UGE:
+    case ICmpInst::ICMP_SGE: BranchPredicate = " < "; break;
+    case ICmpInst::ICMP_ULT:
+    case ICmpInst::ICMP_SLT: BranchPredicate = " >= "; break;
+    case ICmpInst::ICMP_UGT:
+    case ICmpInst::ICMP_SGT: BranchPredicate = " <= "; break;
+    default: llvm_unreachable("Illegal ICmp predicate");
+  }
+
+//  DEBUG(errs() << "Branch Condition: " << *BranchCondition << "\n");
+  
+  std::string compLHS, compRHS;
+  Value *CondOp1 = BranchCondition->getOperand(0);
+//  DEBUG(errs() << "CondOp1: " << *CondOp1 << "\n");
+  if (Constant *constOp1 = dyn_cast<Constant>(CondOp1)) {
+//    DEBUG(errs() << "Condition Operand is a constant, inserting it as is.\n");
+    compLHS = (constOp1->getUniqueInteger()).toString(10,1);
+  } else {
+//    DEBUG(errs() << "Condition Operand is not a constant, ");
+    if(traverseUseDefChain(dyn_cast<Instruction>(CondOp1), InductionVariable)) {
+//      DEBUG(errs() << "it is the IV.\n");
+      compLHS = GetValueName(IV);
+    } else {
+//      DEBUG(errs() << "it is another variable.\n");
+      compLHS = GetValueName(CondOp1);
+    }
+  }
+  Value *CondOp2 = BranchCondition->getOperand(1);
+//  DEBUG(errs() << "CondOp2: " << *CondOp2 << "\n");
+  if (Constant *constOp2 = dyn_cast<Constant>(CondOp2)) {
+//    DEBUG(errs() << "Condition Operand is a constant, inserting it as is.\n");
+    compRHS = (constOp2->getUniqueInteger()).toString(10,1);
+  } else {
+//    DEBUG(errs() << "Condition Operand is not a constant.\n");
+    if(traverseUseDefChain(dyn_cast<Instruction>(CondOp2), InductionVariable)) {
+//      DEBUG(errs() << "It is the IV.\n");
+      compRHS = GetValueName(IV);
+    } else {
+//      DEBUG(errs() << "It is another variable.\n");
+      compRHS = GetValueName(CondOp2);
+    }
+  }
+
+  std::string startStr; 
+    if (Constant *startConst = dyn_cast<Constant>(StartValue)) {
+      startStr = (startConst->getUniqueInteger()).toString(10,1);
+    } else {
+      startStr = GetValueName(StartValue);
+    }
+
+
+//  DEBUG(errs() << "  for ( " << IVName << " = " << startStr << "; " 
+//    << compLHS << BranchPredicate << compRHS << "; " 
+//    << IVName << " = " << IVName << IVOp << *Step << ") {\n");
+  
+  Out << "\n  for ( " << IVName << " = " << startStr << "; " 
+    << compLHS << BranchPredicate << compRHS << "; " 
+    << IVName << " = " << IVName << IVOp << *Step << ") {\n";
+  
+//  //Stack for keeping track of induction variable chain
+//  std::stack<Instruction*> IndVarChain;
+//  Value *LBound, *IV, *InitialCondition;
+//  BasicBlock *LHeader = L->getHeader();
+//  std::string LCondition, IndVarIncrement, IndVarInit;
+//  DEBUG(errs() << "Printing loop header: ");
+//  DEBUG(errs() << LHeader->getName()<<"\n");
+//  BranchInst *LBranch = nullptr;
+//  BasicBlock *CurBlock = LHeader;
+//  std::set<BasicBlock*> *visitSet = new std::set<BasicBlock*>();
+//  visitSet->insert(CurBlock);
+//  //  if(findLoopBranch(&LBranch, CurBlock, LHeader, visitSet)) {
+//  //        DEBUG(errs() << "Found Loop branch: " << *LBranch << "\n");
+//  //  }
+//  if(LBranch = dyn_cast<BranchInst>(L->getExitingBlock()->getTerminator())) {
+//    DEBUG(errs() << "Printing loop branch: ");
+//    DEBUG(errs() << *(LBranch)<<"\n");
+//    if(ICmpInst *LCmp= dyn_cast<ICmpInst>(LBranch->getOperand(0))) {
+//      DEBUG(errs() << "Printing loop compare instruction: ");
+//      DEBUG(errs() << *(LCmp)<<"\n");
+//      if (PHINode *LIndVar = L->getCanonicalInductionVariable()) {
+//        LInductionVars.insert(LIndVar);
+//        //Loop has a canonical induction variable
+//        DEBUG(errs() << "Loop has canonical induction variable!\n");
+//        DEBUG(errs() << "Printing loop induction variable:\n");
+//        DEBUG(errs() << *(LIndVar)<<"\n");
+//        IndVarChain.push(dyn_cast<Instruction>(LIndVar));
+//        if(extractIndVarChain(dyn_cast<Instruction>(LIndVar), &IndVarChain, LBranch, 1)) {
+//          IV = dyn_cast<Value>(LIndVar);
+//          DEBUG(errs() << "Found Correct Path!\n");
+//          DEBUG(errs() << "Loop Induction Variable: " << *IV << "\n");
+//          // DEBUG(errs() << "Printing stack contents:\n");
+//          // while(!IndVarChain.empty()) {
+//          //   DEBUG(errs() << *(IndVarChain.top()) << "\n");
+//          //   IndVarChain.pop();
+//          // }
+//        }
+//      } else {
+//        DEBUG(errs() << "Loop does not have canonical induction variable, need to find one!\n");
+//        BasicBlock::iterator i,e;
+//        for(i = LHeader->begin(), e = LHeader->end(); i!=e; ++i) {
+//          if(PHINode *PNode = dyn_cast<PHINode>(&*i)) {
+//            DEBUG(errs() << "PHI Node: \n" << *PNode << "\n");
+//            IndVarChain.push(dyn_cast<Instruction>(PNode));
+//            if(extractIndVarChain(dyn_cast<Instruction>(PNode), &IndVarChain, LBranch, 1)) {
+//              IV = dyn_cast<Value>(PNode);
+//              DEBUG(errs() << "Found Correct Path!\n");
+//              DEBUG(errs() << "Loop Induction Variable: " << *IV << "\n");
+//              LInductionVars.insert(PNode);
+//              break;
+//            } else {
+//              IndVarChain.pop();
+//            }
+//          }
+//        }
+//        if(i==e)
+//          llvm_unreachable("No Induction Variable Found!! Something isn't right!\n");
+//      }
+//
+//      PHINode *IVPHI = dyn_cast<PHINode>(IV);
+//      for(BasicBlock *BB : IVPHI->blocks()) {
+//        if(L->contains(BB)) {
+//          DEBUG(errs() << "This is the IV increment: " << *IVPHI->getIncomingValueForBlock(BB) << "\n");
+//          auto *Increment = dyn_cast<Instruction>(IVPHI->getIncomingValueForBlock(BB));
+//
+//          DEBUG(errs() << "OU1: " << *(Increment->getOperandUse(1)) << "\n");
+//
+//          for(auto &U : Increment->uses()) {
+//            DEBUG(errs() << "Uses: " << *U << "\n");
+//          }
+//        } else {
+//          DEBUG(errs() << "This is the IV initial condition: " << *IVPHI->getIncomingValueForBlock(BB) << "\n");
+//          InitialCondition = IVPHI->getIncomingValueForBlock(BB);
+//          if(Constant *IndVarInitConst = dyn_cast<Constant>(InitialCondition)) {
+//            IndVarInit = (IndVarInitConst->getUniqueInteger()).toString(10,1);
+//          } 
+//          else {
+//            IndVarInit = GetValueName(InitialCondition);
+//          }
+//        }
+//      }
+//
+//      llvm_unreachable("HERE!");
+//
+//      while (!IndVarChain.empty()) {
+//        //Now that we have all the instructions acting on the induction variable, need to
+//        //extract the following: 1) Loop Bound, 2) initial condition, 3) increment
+//        Instruction *StackTop = IndVarChain.top();
+//        IndVarChain.pop();
+//        if(StackTop == dyn_cast<Instruction>(LCmp)) {
+//          //First instruction in the stack is going to be the cmpinst. Use it to extract bound 
+//          DEBUG(errs() << "Extracting Bounds from cmpinst!\n");
+//          for (Use &U : StackTop->operands()) {
+//            Value *v = U.get();
+//            if(v!=IndVarChain.top()) {
+//              DEBUG(errs() << *v << "\n");
+//              LBound = v;
+//            }
+//          }
+//          DEBUG(errs() << "Extracting cmp condition\n");
+//          switch(LCmp->getPredicate()) {
+//            case ICmpInst::ICMP_EQ:  LCondition = " == "; break;
+//            case ICmpInst::ICMP_NE:  LCondition = " != "; break;
+//            case ICmpInst::ICMP_ULE:
+//            case ICmpInst::ICMP_SLE: LCondition = " <= "; break;
+//            case ICmpInst::ICMP_UGE:
+//            case ICmpInst::ICMP_SGE: LCondition = " >= "; break;
+//            case ICmpInst::ICMP_ULT:
+//            case ICmpInst::ICMP_SLT: LCondition = " < "; break;
+//            case ICmpInst::ICMP_UGT:
+//            case ICmpInst::ICMP_SGT: LCondition = " > "; break;
+//            default: llvm_unreachable("Illegal ICmp predicate");
+//          }
+//        }
+//        else if(BinaryOperator *STBinOp = dyn_cast<BinaryOperator>(StackTop)) {
+//          // Next instructions are going to be arithmetic ops performed on the induction variable 
+//          switch(STBinOp->getOpcode()) { 
+//            case Instruction::Add:
+//            case Instruction::FAdd: IndVarIncrement += " + "; break;
+//            case Instruction::Sub:
+//            case Instruction::FSub: IndVarIncrement += " - "; break;
+//            case Instruction::Mul:
+//            case Instruction::FMul: IndVarIncrement += " * "; break;
+//            case Instruction::URem:
+//            case Instruction::SRem:
+//            case Instruction::FRem: IndVarIncrement += " % "; break;
+//            case Instruction::UDiv:
+//            case Instruction::SDiv:
+//            case Instruction::FDiv: IndVarIncrement += " / "; break;
+//            case Instruction::And: IndVarIncrement +=  " & "; break;
+//            case Instruction::Or: IndVarIncrement +=   " | "; break;
+//            case Instruction::Xor: IndVarIncrement +=  " ^ "; break;
+//            case Instruction::Shl : IndVarIncrement += " << "; break;
+//            case Instruction::LShr:
+//            case Instruction::AShr: IndVarIncrement += " >> "; break;
+//            default:
+//                                    DEBUG(errs() << "Invalid operator type!" << *STBinOp);
+//                                    llvm_unreachable(0);
+//          }
+//          DEBUG(errs() << "Extracting induction variable increment!\n");
+//          for (Use &U : StackTop->operands()) {
+//            Value *v = U.get();
+//            if(v!=IndVarChain.top()) {
+//              DEBUG(errs() << *v << "\n");
+//              if(Constant *LBoundConst = dyn_cast<Constant>(v)) {
+//                IndVarIncrement += (LBoundConst->getUniqueInteger()).toString(10,1);
+//              } 
+//              else {
+//                IndVarIncrement += v->getName();
+//              }
+//            }
+//          }
+//        }
+//        else if(StackTop == dyn_cast<Instruction>(IV)) {
+//          //Last instruction is going to be the induction variable phi node 
+//          DEBUG(errs() << "Extract initial condition from Phi node\n");
+//          PHINode *PN = dyn_cast<PHINode>(StackTop);
+//          for (BasicBlock* BB : PN->blocks()) {
+//            DEBUG(errs() << BB->getName()<< "\n");
+//            if(!L->contains(BB)) {
+//              DEBUG(errs() << "Found entry point to loop, reading initial condition\n");
+//              InitialCondition = PN->getIncomingValueForBlock(BB);
+//              if(Constant *IndVarInitConst = dyn_cast<Constant>(InitialCondition)) {
+//                IndVarInit = (IndVarInitConst->getUniqueInteger()).toString(10,1);
+//              } 
+//              else {
+//                IndVarInit = GetValueName(InitialCondition);
+//              }
+//              break;
+//            }
+//          }
+//          Out << "\n  for ( " << GetValueName(IV) << " = " << IndVarInit << "; " << GetValueName(IV) << LCondition << GetValueName(LBound) << "; " 
+//            << GetValueName(IV) << " = " << GetValueName(IV) << IndVarIncrement << ") {\n";
+//        }
+//      }
+//    }
+//  } else {
+//    llvm_unreachable("Unable to find loop branch!\n");
+//  }
+
+
+  BasicBlock *BB = L->getHeader();
+//  printBBorLoop(BB);
+  printBasicBlock(BB);
+//  Loop *BBLoop = LI->getLoopFor(BB);
+//  if (BBLoop == L)
+//    printBasicBlock(BB);
+//  else if (BB == BBLoop->getHeader() && BBLoop->getParentLoop() == L)
+//    printLoop(BBLoop);
+
+  //  Out << "  do {     /* Syntactic loop '" << L->getHeader()->getName()
+  //    << "' to make GCC happy */\n";
+  //  for (unsigned i = 0, e = L->getBlocks().size(); i != e; ++i) {
+  //    BasicBlock *BB = L->getBlocks()[i];
+  //    Loop *BBLoop = LI->getLoopFor(BB);
+  //    if (BBLoop == L)
+  //      printBasicBlock(BB);
+  //    else if (BB == BBLoop->getHeader() && BBLoop->getParentLoop() == L)
+  //      printLoop(BBLoop);
+  //  }
+  //  Out << "  } \n";
+}
+
+void CWriter::printBasicBlock(BasicBlock *BB) {
+  //DEBUG(errs() << "\n\nProcessing Basic Block: " << BB->getName() << "\n");
+  Out << "\n\n/* Processing Basic Block: " << BB->getName() << " */\n";
+
+  // Don't print the label for the basic block if there are no uses, or if
+  // the only terminator use is the predecessor basic block's terminator.
+  // We have to scan the use list because PHI nodes use basic blocks too but
+  // do not require a label to be generated.
+  //
+  bool NeedsLabel = false;
+  for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
+    if (isGotoCodeNecessary(*PI, BB)) {
+      NeedsLabel = true;
+      break;
+    }
+
+//  if (NeedsLabel) Out << "/* " << GetValueName(BB) << ": */\n";
+  Out << "/* " << GetValueName(BB) << ": */\n";
+
+  // Output all of the instructions in the basic block...
+  for (BasicBlock::iterator II = BB->begin(), E = --BB->end(); II != E;
+      ++II) {
+    Instruction *I = &*II;
+    //DEBUG(errs() << "*********Processing: " << *I << "\n");
+    bool skip = false;
+    for(Use &U : I->operands()) {
+      Value *v = U.get();
+      if(PHINode *PN = dyn_cast<PHINode>(v)) {
+        if (LInductionVars.find(PN) != LInductionVars.end()) {
+          bool UserPHI = false;
+          bool UserCMP = false;
+          bool UserOTHER = false;
+////          DEBUG(errs() << "Instruction uses induction variable\n");
+          for (User *IUser : I->users()) {
+            if (Instruction *UserInst = dyn_cast<Instruction>(IUser)) {
+//              DEBUG(errs() << "User: " << *UserInst << "\n");
+              if (dyn_cast<PHINode>(UserInst)) {
+                UserPHI = true;
+              } else if (dyn_cast<ICmpInst>(UserInst)) {
+                UserCMP = true;
+              } else {
+                UserOTHER = true;
+              }
+//              skip = true;
+//              break;
+            }
+          }
+          if (UserPHI && UserCMP && !UserOTHER) {
+            skip = true;
+          }
+        }
+      }
+      if (skip)
+        break;
+    }
+    if(skip){ 
+//      DEBUG(errs() << "Skipping instruction that increments Induction Variable!\n");
+      Out << "/* Skipped induction variable use: " << *I << " */\n";
+      continue;
+    }
+    if(PHINode *PN = dyn_cast<PHINode>(I)) {
+      if (LInductionVars.find(PN) != LInductionVars.end()) { 
+//        DEBUG(errs() << "Skipping PHINode for Induction Variable!\n");
+        Out << "/* PHINode of induction variable was here */\n";
+        continue;
+      }
+    }
+    if (!isInlinableInst(*II) && !isDirectAlloca(&*II)) {
+      if (!isEmptyType(II->getType()) &&
+          !isInlineAsm(*II))
+        outputLValue(&*II);
+      else
+        Out << "  ";
+      writeInstComputationInline(*II);
+      Out << ";\n";
+    } else {
+      //DEBUG(errs() << "Skipping inlinable or direct alloca!\n");
+    }
+  }
+
+  // Don't emit prefix or suffix for the terminator.
+  visit(*BB->getTerminator());
+}
+
+
+// Specific Instruction type classes... note that all of the casts are
+// necessary because we use the instruction classes as opaque types...
+//
+void CWriter::visitReturnInst(ReturnInst &I) {
+  // If this is a struct return function, return the temporary struct.
+  bool isStructReturn = I.getParent()->getParent()->hasStructRetAttr();
+
+  if (isStructReturn) {
+    Out << "  return StructReturn;\n";
+    return;
+  }
+
+  // Don't output a void return if this is the last basic block in the function
+  // unless that would make the basic block empty
+  if (I.getNumOperands() == 0 &&
+      &*--I.getParent()->getParent()->end() == I.getParent() &&
+      &*I.getParent()->begin() != &I) {
+    return;
+  }
+
+  Out << "  return";
+  if (I.getNumOperands()) {
+    Out << ' ';
+    writeOperand(I.getOperand(0), ContextCasted);
+  }
+  Out << ";\n";
+}
+
+void CWriter::visitSwitchInst(SwitchInst &SI) {
+  Value* Cond = SI.getCondition();
+  unsigned NumBits = cast<IntegerType>(Cond->getType())->getBitWidth();
+
+  if (SI.getNumCases() == 0) { // unconditional branch
+    printPHICopiesForSuccessor (SI.getParent(), SI.getDefaultDest(), 2);
+    printBranchToBlock(SI.getParent(), SI.getDefaultDest(), 2);
+    Out << "\n";
+
+  } else if (NumBits <= 64) { // model as a switch statement
+    Out << "  switch (";
+    writeOperand(Cond);
+    Out << ") {\n  default:\n";
+    printPHICopiesForSuccessor (SI.getParent(), SI.getDefaultDest(), 2);
+    printBranchToBlock(SI.getParent(), SI.getDefaultDest(), 2);
+
+    // Skip the first item since that's the default case.
+
+    //for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
+    //for (auto i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
+    
+    // CHECK: Needs much testing
+    for (auto Case : SI.cases()) {
+      ConstantInt* CaseVal = Case.getCaseValue();
+      BasicBlock* Succ = Case.getCaseSuccessor();
+      Out << "  case ";
+      writeOperand(CaseVal);
+      Out << ":\n";
+      printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
+      if (isGotoCodeNecessary(SI.getParent(), Succ))
+        printBranchToBlock(SI.getParent(), Succ, 2);
+      else
+        Out << "    break;\n";
+    }
+    Out << "  }\n";
+
+  } else { // model as a series of if statements
+    Out << "  ";
+    //    for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
+    // CHECK: Needs much testing
+    for (auto Case : SI.cases()) {
+      Out << "if (";
+      ConstantInt* CaseVal = Case.getCaseValue();
+      BasicBlock* Succ = Case.getCaseSuccessor();
+      ICmpInst *icmp = new ICmpInst(CmpInst::ICMP_EQ, Cond, CaseVal);
+      visitICmpInst(*icmp);
+      delete icmp;
+      Out << ") {\n";
+      printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
+      printBranchToBlock(SI.getParent(), Succ, 2);
+      Out << "  } else ";
+    }
+    Out << "{\n";
+    printPHICopiesForSuccessor (SI.getParent(), SI.getDefaultDest(), 2);
+    printBranchToBlock(SI.getParent(), SI.getDefaultDest(), 2);
+    Out << "  }\n";
+  }
+  Out << "\n";
+}
+
+void CWriter::visitIndirectBrInst(IndirectBrInst &IBI) {
+  Out << "  goto *(void*)(";
+  writeOperand(IBI.getOperand(0));
+  Out << ");\n";
+}
+
+void CWriter::visitUnreachableInst(UnreachableInst &I) {
+  Out << "  __builtin_unreachable();\n\n";
+}
+
+bool CWriter::isGotoCodeNecessary(BasicBlock *From, BasicBlock *To) {
+  /// FIXME: This should be reenabled, but loop reordering safe!!
+  return true;
+
+  if (std::next(Function::iterator(From)) != Function::iterator(To))
+    return true;  // Not the direct successor, we need a goto.
+
+  //isa<SwitchInst>(From->getTerminator())
+
+  if (LI->getLoopFor(From) != LI->getLoopFor(To))
+    return true;
+  return false;
+}
+
+void CWriter::printPHICopiesForSuccessor (BasicBlock *CurBlock,
+    BasicBlock *Successor,
+    unsigned Indent) {
+  Out << "/* Printing PHIs for " << CurBlock->getName() << "->" << Successor->getName() << " */\n";
+  for (BasicBlock::iterator I = Successor->begin(); isa<PHINode>(I); ++I) {
+    PHINode *PN = cast<PHINode>(I);
+    if(LInductionVars.find(PN) == LInductionVars.end()) {
+			Out << "/* Printing phi node: " << *PN << " */\n";
+      // Now we have to do the printing.
+      Value *IV = PN->getIncomingValueForBlock(CurBlock);
+      if (!isa<UndefValue>(IV) && !isEmptyType(IV->getType())) {
+        Out << std::string(Indent, ' ');
+        Out << "  " << GetValueName(&*I) << "__PHI_TEMPORARY = ";
+        writeOperand(IV, ContextCasted);
+        Out << ";   /* for PHI node */\n";
+      }
+    } else {
+			Out << "/* Skipping phi node: " << *PN << " */\n";
+		}
+  }
+}
+
+void CWriter::printBranchToBlock(BasicBlock *CurBB, BasicBlock *Succ,
+    unsigned Indent) {
+  if (isGotoCodeNecessary(CurBB, Succ)) {
+    Out << std::string(Indent, ' ') << "  goto ";
+    writeOperand(Succ);
+    Out << ";\n";
+  }
+}
+
+void CWriter::printBBorLoop (BasicBlock *BB) {
+  //DEBUG(errs() << "\nPrinting: " << BB->getName() << "\n");
+  Out << "\n/* Printing: " << BB->getName() << " */\n";
+  if(VisitedBlocks.find(BB)!=VisitedBlocks.end() && ReplicateBlocks.find(BB)==ReplicateBlocks.end()) {
+    //DEBUG(errs() << "This BB has already been printed and is not marked for replication! exiting!\n");
+    Out << "/* This BB has already been printed and is not marked for replication! exiting! */\n";
+  } else if(!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    //DEBUG(errs() << "Reached block that is top of stack, return instead!\n");
+    Out << "/* " << BB->getName() << " is top of stack, return instead! */\n";
+//    ImmPostDommBlocks.pop();
+  } else {
+    VisitedBlocks.insert(BB);
+    if(Loop *LL = LI->getLoopFor(BB)) {
+      if (LL->getHeader() == BB)
+        printLoop(LL);
+      else 
+        printBasicBlock(BB);
+    } else {
+      printBasicBlock(BB);
+    }
+  }
+
+}
+
+bool CWriter::compareBlocks(BasicBlock *CurrBlock, BasicBlock *CompBlock, BasicBlock *ImmPostDomm) {
+  CompVisitedBlocks.insert(CurrBlock);
+  //DEBUG(errs() << "--Comparing " << CurrBlock->getName() << " with " << CompBlock->getName() << "\n");
+  if (CurrBlock == ImmPostDomm) {
+    //DEBUG(errs() << "----Reached Post Dominator, returning false!\n");
+    return false;
+  } else if (CurrBlock == CompBlock) {
+    //DEBUG(errs() << "----Found a match! " << CurrBlock->getName() << " == " << CompBlock->getName() << "\n");
+    return true;
+  } else {
+    bool res = false;
+    for (auto succ: successors(CurrBlock)) {
+      if (CompVisitedBlocks.find(succ) == CompVisitedBlocks.end()) {
+        //DEBUG(errs() << "----Visiting successor " << succ->getName() << " of " << CurrBlock->getName() << "\n");
+        res = res || compareBlocks(succ, CompBlock, ImmPostDomm);
+      } else {
+        //DEBUG(errs() << "----Skipping successor " << succ->getName() << " of " << CurrBlock->getName() << "\n");
+      }
+    }
+    return res;
+  }
+}
+
+bool CWriter::findMatch(BasicBlock *CurrBlock, BasicBlock *CompBlock, BasicBlock *ImmPostDomm) {
+  if (CompBlock == ImmPostDomm) {
+    //DEBUG(errs() << "Reached PostDomm; returning!\n");
+    return false;
+  }
+  FindVisitedBlocks.insert(CompBlock);
+  //DEBUG(errs() << "Finding match between " << CompBlock->getName() << " & " << CurrBlock->getName() << "\n");
+  bool compareResult = compareBlocks(CurrBlock, CompBlock, ImmPostDomm);
+  CompVisitedBlocks.clear();
+  if (compareResult){
+    //DEBUG(errs() << "Match found, marking " << CompBlock->getName() << " for replication!\n");
+    // Flag for replication
+    ReplicateBlocks.insert(CompBlock);
+    return true;
+  } else {
+    bool res = false;
+    for (auto succ: successors(CompBlock)) {
+      if(FindVisitedBlocks.find(succ) == FindVisitedBlocks.end()) {
+      //DEBUG(errs() << "Visiting successor " << succ->getName() << " of " << CompBlock->getName() << "\n");
+      res = res || findMatch(CurrBlock, succ, ImmPostDomm);
+      if (res == true) break;
+      } else {
+        //DEBUG(errs() << "Skipping successor " << succ->getName() << " of " << CompBlock->getName() << "\n");
+      }
+    }
+    return res;
+  }
+}
+// Branch instruction printing - Avoid printing out a branch to a basic block
+// that immediately succeeds the current one.
+//
+void CWriter::visitBranchInst(BranchInst &I) {
+  //DEBUG(errs() << "Visiting Branch Instruction: " << I <<"\n");
+  Out << "\n/* Branch: " << I << " */\n";
+
+  if (I.isConditional()) {
+    BasicBlock *BB0 = I.getSuccessor(0);
+    BasicBlock *BB1 = I.getSuccessor(1);
+    BasicBlock *ImmPostDomm = PDT->findNearestCommonDominator(BB0,BB1);
+
+    // Iterate over all BBs in then & else to find a matching BB
+    // If found, mark it for replication
+    if (ImmPostDomm != BB1 && ImmPostDomm != BB0) {
+      findMatch(BB0, BB1, ImmPostDomm);
+      FindVisitedBlocks.clear();
+      //llvm_unreachable("here!");
+    }
+    if(Loop *L = LI->getLoopFor(I.getParent())) {
+      if(L == LI->getLoopFor(BB0) && !(L == LI->getLoopFor(BB1))) {
+        //DEBUG(errs() << "This is a loop branch!\n");
+        Out << "/* This is a loop branch! */\n";
+        //BB0 is in the loop. Print it if it hsn't been printed
+        if(VisitedBlocks.find(BB0) != VisitedBlocks.end()) {
+          //DEBUG(errs() << "Branching back to header: " << BB0->getName() << "\n");
+          //DEBUG(errs() << "This is the end of the loop, closing!\n");
+          Out << "/* Branching back to header: " << BB0->getName() << " */\n";
+          Out << "/* Closing loop! */\n";
+          //BB0 is the loop header. CLose the loop then print BB1.
+          printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+          Out << " }\n";
+          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+          printBBorLoop(BB1);
+//          if (!ImmPostDommBlocks.empty())  
+//            DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+//          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB1) {
+//            ImmPostDommBlocks.pop();
+//            DEBUG(errs() << BB1->getName() << ": skipping the print and popping from stack!\n");
+//          } else {
+//            printBBorLoop(BB1);
+//          }
+          //          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+          //          printBBorLoop(BB1);
+        } else {
+          //DEBUG(errs() << "Not branching to header! Branching to: " << BB0->getName() << "\n");
+          //BB0 is not the loop header. That means we are entering loop body
+//          printVBBorLoop(BB0);
+//          DEBUG(errs() << "Here!\n");
+//          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+//          if (!ImmPostDommBlocks.empty())  
+//            DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+//          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB1) {
+//            ImmPostDommBlocks.pop();
+//            DEBUG(errs() << BB1->getName() << ": skipping the print and popping from stack!\n");
+//          } else {
+//            printBBorLoop(BB1);
+//          }
+
+          llvm_unreachable("loop branch unhandled!\n");
+        }
+      } else if(L == LI->getLoopFor(BB1) && !(L == LI->getLoopFor(BB0))) {
+        //DEBUG(errs() << "This is a loop branch!\n");
+        Out << "/* This is a loop branch! */\n";
+        if(VisitedBlocks.find(BB1) != VisitedBlocks.end()) {
+          //DEBUG(errs() << "Branching back to header: " << BB1->getName() << "\n");
+          //DEBUG(errs() << "This is the end of the loop, closing!\n");
+          Out << "/* Branching back to header: " << BB1->getName() << " */\n";
+          Out << "/* Closing loop! */\n";
+          //BB0 is the loop header. CLose the loop then print BB1.
+          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+          Out << " }\n";
+          printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+          printBBorLoop(BB0);
+//          if (!ImmPostDommBlocks.empty())  
+//            DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+//          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB0) {
+//            ImmPostDommBlocks.pop();
+//            DEBUG(errs() << BB0->getName() << ": skipping the print and popping from stack!\n");
+//          } else {
+//            printBBorLoop(BB0);
+//          }
+          //          printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+          //          printBBorLoop(BB0);
+        } else {
+          //DEBUG(errs() << "Not branching to header! Branching to: " << BB1->getName() << "\n");
+          //BB1 is not the loop header. That means we are entering loop body
+//          printBBorLoop(BB1);
+//          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+//          if (!ImmPostDommBlocks.empty())  
+//            DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+//          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB0) {
+//            ImmPostDommBlocks.pop();
+//            DEBUG(errs() << BB0->getName() << ": skipping the print and popping from stack!\n");
+//          } else {
+//            printBBorLoop(BB1);
+//          }
+          llvm_unreachable("loop branch unhandled!\n");
+        }
+      } else {
+        //DEBUG(errs() << "This is a conditional statement within a loop!\n");
+        Out << "/* This is a conditional statement within a loop! */\n";
+				//DEBUG(errs() << ImmPostDomm->getName() << " is the immediate post dominator of " << BB0->getName() << " and " << BB1->getName() << "\n");
+//    if(ImmPostDommBlocks.empty() || (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() != ImmPostDomm)) {
+      if(VisitedBlocks.find(ImmPostDomm) != VisitedBlocks.end()) {
+        //DEBUG(errs() << "Not pushing " << ImmPostDomm->getName() << " because it has already been visited!\n");
+      } else {
+        //DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+        ImmPostDommBlocks.push(ImmPostDomm);
+      }
+
+        bool noElse = false;
+//        DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+//        ImmPostDommBlocks.push(ImmPostDomm);
+        if(BB1 == ImmPostDomm) {
+//          DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+//          ImmPostDommBlocks.push(ImmPostDomm);
+//        } else {
+          noElse = true;
+        }
+        Out << "  if (";
+        writeOperand(I.getCondition(), ContextCasted);
+        Out << ") { /* " << I << "*/\n";
+        printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+//        printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+        printBBorLoop(BB0);
+        //DEBUG(errs() << "Back to handling " << I.getParent()->getName() << ": " << I << "\n");
+        Out << "/* Back to handling " << I.getParent()->getName() << ": " << I << " */\n";
+        if (!noElse) {
+          //DEBUG(errs() << "Printing else!\n");
+          Out << "  } else { /*" << I << "*/\n";
+          printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+          ElseBlocks.push(BB1);
+          ElseBranches.push(&I);
+          printBBorLoop(BB1);
+          //DEBUG(errs() << "Back to handling " << I.getParent()->getName() << ": " << I << "\n");
+          //DEBUG(errs() << "Check to see if else block is closed!\n");
+          Out << "/* Back to handling " << I.getParent()->getName() << ": " << I << " */\n" ;
+          Out << "/* Check to see if else block is closed! */\n" ;
+          if(!ElseBlocks.empty() && ElseBlocks.top() == BB1) {
+            //DEBUG(errs() << "Else block not closed, need to close braces!\n");
+            Out << "/* Else block not closed, need to close braces! */\n" ;
+            Out << "} /* closing " << *(ElseBranches.top()) << " */\n";
+            ElseBranches.pop();
+            ElseBlocks.pop();
+          }
+          if(!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == ImmPostDomm) {
+            //DEBUG(errs() << "Will now pop post dom them handle it!\n");
+            ImmPostDommBlocks.pop();
+            printBBorLoop(ImmPostDomm);
+          } else {
+            //DEBUG(errs() << "*!*!*!*!*!*!Not sure what is happening here!*!*!*!*!*!*!\n");
+          }
+          //          Out << "  } /* closing " << I << "*/\n";
+        } else {
+      //DEBUG(errs() << "No else block. Adding one for phis, then moving to " << BB1->getName() << "!\n");
+      Out << "/* (3913) No else block. Adding one for phis, then moving to " << BB1->getName() << "! */\n";
+      Out << "  } /* closing " << I << "*/\n";
+        //DEBUG(errs() << "Will now pop post dom them handle it!\n");
+        ImmPostDommBlocks.pop();
+			Out << "else {\n";
+      printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+      Out << "}\n";
+          printBBorLoop(BB1);
+        }
+      }
+      //        Out << "  if (";
+      //        writeOperand(I.getCondition(), ContextCasted);
+      //        Out << ") {\n";
+      //        printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+      //        printBBorLoop(BB0);
+      //        Out << "  } else {\n";
+      //        printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+      //        printBBorLoop(BB1);
+      //        Out << "  }\n";
+    } else {
+      //DEBUG(errs() << "This is a conditional statement!\n");
+    //DEBUG(errs() << ImmPostDomm->getName() << " is the immediate post dominator of " << BB0->getName() << " and " << BB1->getName() << "\n");
+//    if(ImmPostDommBlocks.empty() || (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() != ImmPostDomm)) {
+      if(VisitedBlocks.find(ImmPostDomm) != VisitedBlocks.end()) {
+        //DEBUG(errs() << "Not pushing " << ImmPostDomm->getName() << " because it has already been visited!\n");
+      } else {
+        //DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+        ImmPostDommBlocks.push(ImmPostDomm);
+      }
+      bool noElse = false;
+      //      DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+      //      ImmPostDommBlocks.push(ImmPostDomm);
+      if(BB1 == ImmPostDomm) {
+        //        DEBUG(errs() << "Pushing " << ImmPostDomm->getName() << " onto stack!\n");
+        //        ImmPostDommBlocks.push(ImmPostDomm);
+        //      } else {
+        noElse = true;
+    }
+    Out << "  if (";
+    writeOperand(I.getCondition(), ContextCasted);
+    Out << ") { /* " << I << "*/\n";
+    printPHICopiesForSuccessor (I.getParent(), BB0, 2);
+    printBBorLoop(BB0);
+    //DEBUG(errs() << "Back to handling " << I.getParent()->getName() << ": " << I << "\n");
+    Out << "/* Back to handling " << I.getParent()->getName() << ": " << I << " */\n" ;
+    if (!noElse) {
+      //DEBUG(errs() << "Printing else!\n");
+      Out << "/* Printing else! */\n" ;
+      Out << "  } else { /*" << I << "*/\n";
+      printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+      ElseBlocks.push(BB1);
+      ElseBranches.push(&I);
+      printBBorLoop(BB1);
+      //DEBUG(errs() << "Back to handling " << I.getParent()->getName() << ": " << I << "\n");
+      //DEBUG(errs() << "Check to see if else block is closed!\n");
+      Out << "/* Back to handling " << I.getParent()->getName() << ": " << I << " */\n";
+      Out << "/* Check to see if else block is closed! */\n";
+      if(!ElseBlocks.empty() && ElseBlocks.top() == BB1) {
+        //DEBUG(errs() << "Else block not closed, need to close braces!\n");
+        Out << "/* Else block not closed, need to close braces! */\n";
+        Out << "} /* closing " << *(ElseBranches.top()) << " */\n";
+        ElseBranches.pop();
+        ElseBlocks.pop();
+      }
+      if(!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == ImmPostDomm) {
+        //DEBUG(errs() << "Will now pop post dom them handle it!\n");
+        ImmPostDommBlocks.pop();
+        printBBorLoop(ImmPostDomm);
+      } else {
+        //DEBUG(errs() << "*!*!*!*!*!*!Not sure what is happening here!*!*!*!*!*!*!\n");
+      }
+      //        Out << "  }\n";
+    } else {
+      //DEBUG(errs() << "No else block. Adding one for phis, then moving to " << BB1->getName() << "!\n");
+      Out << "/* (3985) No else block. Adding one for phis, then moving to " << BB1->getName() << "! */\n";
+      Out << "  } /* closing " << I << "*/\n";
+        //DEBUG(errs() << "Will now pop post dom them handle it!\n");
+        ImmPostDommBlocks.pop();
+			Out << "else {\n";
+      printPHICopiesForSuccessor (I.getParent(), BB1, 2);
+      Out << "}\n";
+			printBBorLoop(BB1);
+    }
+
+    //      DEBUG(errs() << "Now need to print exit block!\n");
+    //      if(!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == ImmPostDomm) {
+    //        DEBUG(errs() << "Top is still ImmPostDomm!\n");
+    //        ImmPostDommBlocks.pop();
+    //      } else {
+    //        DEBUG(errs() << "Printing " << ImmPostDomm->getName() << "\n");
+    //        printBBorLoop(ImmPostDomm);
+    //      }
+    }
+  } else {
+    //DEBUG(errs() << "This is an unconditional branch!\n");
+    //    printPHICopiesForSuccessor (I.getParent(), I.getSuccessor(0), 0);
+    BasicBlock *BB = I.getSuccessor(0); 
+    //    if(Loop *L = LI->getLoopFor(I.getParent())) {
+    //      if(L == LI->getLoopFor(BB)) {
+    //        DEBUG(errs() << "This is a loop branch!\n");
+    //        if(VisitedBlocks.find(BB) != VisitedBlocks.end()) {
+    //          DEBUG(errs() << "Branching back to header: " << BB->getName() << "\n");
+    //          //BB0 is the loop header. CLose the loop then print BB1.
+    //          printPHICopiesForSuccessor (I.getParent(), BB, 2);
+    //          Out << " }\n";
+    //        } else {
+    //          DEBUG(errs() << "Not branching to header! Branching to: " << BB->getName() << "\n");
+    //          printPHICopiesForSuccessor (I.getParent(), BB, 2);
+    //          if (!ImmPostDommBlocks.empty())  
+    //            DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+    //          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    //            ImmPostDommBlocks.pop();
+    //            DEBUG(errs() << "Popping " << BB->getName() << " from the stack and returning!\n");
+    ////            if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    ////              DEBUG(errs() << BB->getName() << "is still in the stack, skipping the print for now!\n");
+    ////            } else {
+    ////              DEBUG(errs() << "Printing " << BB->getName() << " now!\n");
+    ////              printBBorLoop(BB);
+    ////            }
+    //          } else {
+    //            printBBorLoop(BB);
+    //          }
+    //          //BB0 is not the loop hearder. Case not handled!
+    //        }
+    //      } else {
+    //        DEBUG(errs()<<"This is not a loop branch!\n");
+    //        printPHICopiesForSuccessor (I.getParent(), BB, 2);
+    //        if (!ImmPostDommBlocks.empty())  
+    //          DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+    //        if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    //          ImmPostDommBlocks.pop();
+    //          DEBUG(errs() << "Popping " << BB->getName() << " from the stack and returning!\n");
+    ////          if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    ////            DEBUG(errs() << BB->getName() << "is still in the stack, skipping the print for now!\n");
+    ////          } else {
+    ////            DEBUG(errs() << "Printing " << BB->getName() << " now!\n");
+    ////            printBBorLoop(BB);
+    ////          }
+    //        } else {
+    //          printBBorLoop(BB);
+    //        }
+    //      }
+    //      llvm_unreachable("Unhandled unconditional branch!");
+    //    } else {
+    printPHICopiesForSuccessor (I.getParent(), BB, 2);
+    if (!ElseBlocks.empty() && I.getParent() == ElseBlocks.top()) {
+      //DEBUG(errs() << "Branch marks end of else block, need to close braces!\n");
+      Out << "/* Branch marks end of else block, need to close braces! */\n";
+      Out << "} /* closing " << *(ElseBranches.top()) << " */\n";
+      ElseBranches.pop();
+      ElseBlocks.pop();
+    }
+    printBBorLoop(BB);
+    //      if (!ImmPostDommBlocks.empty())  
+    //        DEBUG(errs() <<  ImmPostDommBlocks.top()->getName() << " is the top of the stack!\n");
+    //      if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    //        ImmPostDommBlocks.pop();
+    //        DEBUG(errs() << "Popping " << BB->getName() << " from the stack and returning!\n");
+    ////        if (!ImmPostDommBlocks.empty() && ImmPostDommBlocks.top() == BB) {
+    ////          DEBUG(errs() << BB->getName() << "is still in the stack, skipping the print for now!\n");
+    ////        } else {
+    ////          DEBUG(errs() << "Printing " << BB->getName() << " now!\n");
+    ////          printBBorLoop(BB);
+    ////        }
+    //      } else {
+    //        printBBorLoop(BB);
+    //      }
+    // VisitedBlocks.insert(BB);
+    // if(Loop *LL = LI->getLoopFor(BB)) {
+    //   if (LL->getHeader() == BB)
+    //     printLoop(LL);
+    // } else {
+    //   printBasicBlock(BB);
+    // }
+    //    }
+  }
+  Out << "\n";
+
+
+  //    if (isGotoCodeNecessary(I.getParent(), I.getSuccessor(0))) {
+  //      Out << "  if (";
+  //      writeOperand(I.getCondition(), ContextCasted);
+  //      Out << ") {\n";
+  //
+  //      printPHICopiesForSuccessor (I.getParent(), I.getSuccessor(0), 2);
+  //      printBranchToBlock(I.getParent(), I.getSuccessor(0), 2);
+  //
+  //      if (isGotoCodeNecessary(I.getParent(), I.getSuccessor(1))) {
+  //        Out << "  } else {\n";
+  //        printPHICopiesForSuccessor (I.getParent(), I.getSuccessor(1), 2);
+  //        printBranchToBlock(I.getParent(), I.getSuccessor(1), 2);
+  //      }
+  //    } else {
+  //      // First goto not necessary, assume second one is...
+  //      Out << "  if (!";
+  //      writeOperand(I.getCondition(), ContextCasted);
+  //      Out << ") {\n";
+  //
+  //      printPHICopiesForSuccessor (I.getParent(), I.getSuccessor(1), 2);
+  //      printBranchToBlock(I.getParent(), I.getSuccessor(1), 2);
+  //    }
+  //
+}
+
+// PHI nodes get copied into temporary values at the end of predecessor basic
+// blocks.  We now need to copy these temporary values into the REAL value for
+// the PHI.
+void CWriter::visitPHINode(PHINode &I) {
+  if (LInductionVars.find(&I) == LInductionVars.end()) {
+    writeOperand(&I);
+    Out << "__PHI_TEMPORARY";
+  } 
+  else { 
+    //    DEBUG(errs() << "Skipping PHI node for induction variable!\n"); 
+  }
+}
+
+
+// NOTE: Moving LLVM-4 Binary Op functions here
+bool isNeg(const Value *V) {
+  if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
+    if (Bop->getOpcode() == Instruction::Sub)
+      if (Constant *C = dyn_cast<Constant>(Bop->getOperand(0)))
+        return C->isNegativeZeroValue();
+  return false;
+}
+
+bool isFNeg(const Value *V, bool IgnoreZeroSign) {
+  if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
+    if (Bop->getOpcode() == Instruction::FSub)
+      if (Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
+        if (!IgnoreZeroSign)
+          IgnoreZeroSign = cast<Instruction>(V)->hasNoSignedZeros();
+        return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
+      }
+  return false;
+}
+
+
+Value *getNegArgument(Value *BinOp) {
+  return cast<BinaryOperator>(BinOp)->getOperand(1);
+}
+
+const Value *getNegArgument(const Value *BinOp) {
+  return getNegArgument(const_cast<Value*>(BinOp));
+}
+
+Value *getFNegArgument(Value *BinOp) {
+  return cast<BinaryOperator>(BinOp)->getOperand(1);
+}
+
+const Value *getFNegArgument(const Value *BinOp) {
+  return getFNegArgument(const_cast<Value*>(BinOp));
+}
+
+static inline bool isConstantAllOnes(const Value *V) {
+  if (const Constant *C = dyn_cast<Constant>(V))
+    return C->isAllOnesValue();
+  return false;
+}
+
+bool isNot(const Value *V) {
+  if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
+    return (Bop->getOpcode() == Instruction::Xor &&
+            (isConstantAllOnes(Bop->getOperand(1)) ||
+             isConstantAllOnes(Bop->getOperand(0))));
+  return false;
+}
+
+
+Value *getNotArgument(Value *BinOp) {
+  assert(isNot(BinOp) && "getNotArgument on non-'not' instruction!");
+  BinaryOperator *BO = cast<BinaryOperator>(BinOp);
+  Value *Op0 = BO->getOperand(0);
+  Value *Op1 = BO->getOperand(1);
+  if (isConstantAllOnes(Op0)) return Op1;
+
+  assert(isConstantAllOnes(Op1));
+  return Op0;
+}
+
+const Value *getNotArgument(const Value *BinOp) {
+  return getNotArgument(const_cast<Value*>(BinOp));
+}
+
+
+
+
+
+
+void CWriter::visitBinaryOperator(BinaryOperator &I) {
+  // binary instructions, shift instructions, setCond instructions.
+  assert(!I.getType()->isPointerTy());
+  //  DEBUG(errs() << "visiting binary operator!\n" );
+
+  //  // We must cast the results of binary operations which might be promoted.
+  //  bool needsCast = false;
+  //  if ((I.getType() == Type::getInt8Ty(I.getContext())) ||
+  //      (I.getType() == Type::getInt16Ty(I.getContext()))
+  //      || (I.getType() == Type::getFloatTy(I.getContext()))) {
+  //    // types too small to work with directly
+  //    needsCast = true;
+  //  } else if (I.getType()->getPrimitiveSizeInBits() > 64) {
+  //    // types too big to work with directly
+  //    needsCast = true;
+  //  }
+  //  bool shouldCast;
+  //  bool castIsSigned;
+  //  opcodeNeedsCast(I.getOpcode(), shouldCast, castIsSigned);
+  //
+  //  if (I.getType()->isVectorTy() || needsCast || shouldCast) {
+  //
+  //   DEBUG(
+  //       if(needsCast) errs() << "****Needs Cast: \n" << I << "\n";
+  //       else if(shouldCast) errs() << "****Should Cast: \n" << I << "\n";
+  //       else if(I.getType()->isVectorTy()) errs() << "****Is Vector Type: \n" << I << "\n";
+  //       );
+  //
+  //    Type *VTy = I.getOperand(0)->getType();
+  //    unsigned opcode;
+  //    if (BinaryOperator::isNeg(&I)) {
+  //      opcode = BinaryNeg;
+  //      Out << "llvm_neg_";
+  //      printTypeString(Out, VTy, false);
+  //      Out << "(";
+  //      writeOperand(BinaryOperator::getNegArgument(&I), ContextCasted);
+  //    } else if (BinaryOperator::isFNeg(&I)) {
+  //      opcode = BinaryNeg;
+  //      Out << "llvm_neg_";
+  //      printTypeString(Out, VTy, false);
+  //      Out << "(";
+  //      writeOperand(BinaryOperator::getFNegArgument(&I), ContextCasted);
+  //    } else if (BinaryOperator::isNot(&I)) {
+  //      opcode = BinaryNot;
+  //      Out << "llvm_not_";
+  //      printTypeString(Out, VTy, false);
+  //      Out << "(";
+  //      writeOperand(BinaryOperator::getNotArgument(&I), ContextCasted);
+  //    } else {
+  //      opcode = I.getOpcode();
+  //      Out << "llvm_" << Instruction::getOpcodeName(opcode) << "_";
+  //      printTypeString(Out, VTy, false);
+  //      Out << "(";
+  //      writeOperand(I.getOperand(0), ContextCasted);
+  //      Out << ", ";
+  //      writeOperand(I.getOperand(1), ContextCasted);
+  //    }
+  //    Out << ")";
+  //    InlineOpDeclTypes.insert(std::pair<unsigned, Type*>(opcode, VTy));
+  //    return;
+  //  }
+
+  // If this is a negation operation, print it out as such.  For FP, we don't
+  // want to print "-0.0 - X".
+
+  //if (BinaryOperator::isNeg(&I)) {
+  if (isNeg(&I)) {
+    Out << "-(";
+    writeOperand(getNegArgument(&I));
+    Out << ")";
+  }
+  //else if (BinaryOperator::isFNeg(&I)) {
+  else if (isFNeg(&I, true)) {
+    Out << "-(";
+    writeOperand(getFNegArgument(&I));
+    Out << ")";
+  } else if (isNot(&I)) {
+    Out << "~(";
+    writeOperand(getNotArgument(&I));
+    Out << ")";
+  } else if (I.getOpcode() == Instruction::FRem) {
+    // Output a call to fmod/fmodf instead of emitting a%b
+    if (I.getType() == Type::getFloatTy(I.getContext()))
+      Out << "fmodf(";
+    else if (I.getType() == Type::getDoubleTy(I.getContext()))
+      Out << "fmod(";
+    else  // all 3 flavors of long double
+      Out << "fmodl(";
+    writeOperand(I.getOperand(0), ContextCasted);
+    Out << ", ";
+    writeOperand(I.getOperand(1), ContextCasted);
+    Out << ")";
+  } else {
+
+    // Write out the cast of the instruction's value back to the proper type
+    // if necessary.
+    //    bool NeedsClosingParens = writeInstructionCast(I);
+
+    // Certain instructions require the operand to be forced to a specific type
+    // so we use writeOperandWithCast here instead of writeOperand. Similarly
+    // below for operand 1
+    writeOperandWithCast(I.getOperand(0), I.getOpcode());
+
+    switch (I.getOpcode()) {
+      case Instruction::Add:
+      case Instruction::FAdd: Out << " + "; break;
+      case Instruction::Sub:
+      case Instruction::FSub: Out << " - "; break;
+      case Instruction::Mul:
+      case Instruction::FMul: Out << " * "; break;
+      case Instruction::URem:
+      case Instruction::SRem:
+      case Instruction::FRem: Out << " % "; break;
+      case Instruction::UDiv:
+      case Instruction::SDiv:
+      case Instruction::FDiv: Out << " / "; break;
+      case Instruction::And:  Out << " & "; break;
+      case Instruction::Or:   Out << " | "; break;
+      case Instruction::Xor:  Out << " ^ "; break;
+      case Instruction::Shl : Out << " << "; break;
+      case Instruction::LShr:
+      case Instruction::AShr: Out << " >> "; break;
+      default:
+#ifndef NDEBUG
+                              errs() << "Invalid operator type!" << I;
+#endif
+                              llvm_unreachable(0);
+    }
+
+    writeOperandWithCast(I.getOperand(1), I.getOpcode());
+    //    if (NeedsClosingParens)
+    //      Out << "))";
+  }
+}
+
+void CWriter::visitICmpInst(ICmpInst &I) {
+  if (I.getType()->isVectorTy()
+      || I.getOperand(0)->getType()->getPrimitiveSizeInBits() > 64) {
+    Out << "llvm_icmp_" << getCmpPredicateName(I.getPredicate()) << "_";
+    printTypeString(Out, I.getOperand(0)->getType(), I.isSigned());
+    Out << "(";
+    writeOperand(I.getOperand(0), ContextCasted);
+    Out << ", ";
+    writeOperand(I.getOperand(1), ContextCasted);
+    Out << ")";
+    if (VectorType *VTy = dyn_cast<VectorType>(I.getOperand(0)->getType())) {
+      CmpDeclTypes.insert(std::pair<CmpInst::Predicate, VectorType*>(I.getPredicate(), VTy));
+      TypedefDeclTypes.insert(I.getType()); // insert type not necessarily visible above
+    }
+    return;
+  }
+
+  // Write out the cast of the instruction's value back to the proper type
+  // if necessary.
+  bool NeedsClosingParens = writeInstructionCast(I);
+
+  // Certain icmp predicate require the operand to be forced to a specific type
+  // so we use writeOperandWithCast here instead of writeOperand. Similarly
+  // below for operand 1
+  writeOperandWithCast(I.getOperand(0), I);
+
+  switch (I.getPredicate()) {
+    case ICmpInst::ICMP_EQ:  Out << " == "; break;
+    case ICmpInst::ICMP_NE:  Out << " != "; break;
+    case ICmpInst::ICMP_ULE:
+    case ICmpInst::ICMP_SLE: Out << " <= "; break;
+    case ICmpInst::ICMP_UGE:
+    case ICmpInst::ICMP_SGE: Out << " >= "; break;
+    case ICmpInst::ICMP_ULT:
+    case ICmpInst::ICMP_SLT: Out << " < "; break;
+    case ICmpInst::ICMP_UGT:
+    case ICmpInst::ICMP_SGT: Out << " > "; break;
+    default:
+#ifndef NDEBUG
+                             errs() << "Invalid icmp predicate!" << I;
+#endif
+                             llvm_unreachable(0);
+  }
+
+  writeOperandWithCast(I.getOperand(1), I);
+  if (NeedsClosingParens)
+    Out << "))";
+}
+
+void CWriter::visitFCmpInst(FCmpInst &I) {
+  if (I.getType()->isVectorTy()) {
+    Out << "llvm_fcmp_" << getCmpPredicateName(I.getPredicate()) << "_";
+    printTypeString(Out, I.getOperand(0)->getType(), I.isSigned());
+    Out << "(";
+    writeOperand(I.getOperand(0), ContextCasted);
+    Out << ", ";
+    writeOperand(I.getOperand(1), ContextCasted);
+    Out << ")";
+    if (VectorType *VTy = dyn_cast<VectorType>(I.getOperand(0)->getType())) {
+      CmpDeclTypes.insert(std::pair<CmpInst::Predicate, VectorType*>(I.getPredicate(), VTy));
+      TypedefDeclTypes.insert(I.getType()); // insert type not necessarily visible above
+    }
+    return;
+  }
+
+  Out << "llvm_fcmp_" << getCmpPredicateName(I.getPredicate()) << "(";
+  // Write the first operand
+  writeOperand(I.getOperand(0), ContextCasted);
+  Out << ", ";
+  // Write the second operand
+  writeOperand(I.getOperand(1), ContextCasted);
+  Out << ")";
+}
+
+static const char * getFloatBitCastField(Type *Ty) {
+  switch (Ty->getTypeID()) {
+    default: llvm_unreachable("Invalid Type");
+    case Type::FloatTyID:  return "Float";
+    case Type::DoubleTyID: return "Double";
+    case Type::IntegerTyID: {
+                              unsigned NumBits = cast<IntegerType>(Ty)->getBitWidth();
+                              if (NumBits <= 32)
+                                return "Int32";
+                              else
+                                return "Int64";
+                            }
+  }
+}
+
+void CWriter::visitCastInst(CastInst &I) {
+  //  DEBUG(errs() << "This is a cast instruction!\n");
+  Type *DstTy = I.getType();
+  Type *SrcTy = I.getOperand(0)->getType();
+
+  if (DstTy->isVectorTy() || SrcTy->isVectorTy()
+      || DstTy->getPrimitiveSizeInBits() > 64
+      || SrcTy->getPrimitiveSizeInBits() > 64) {
+    Out << "llvm_" << I.getOpcodeName() << "_";
+    printTypeString(Out, SrcTy, false);
+    Out << "_";
+    printTypeString(Out, DstTy, false);
+    Out << "(";
+    writeOperand(I.getOperand(0), ContextCasted);
+    Out << ")";
+    CastOpDeclTypes.insert(std::pair<Instruction::CastOps, std::pair<Type*, Type*> >(I.getOpcode(), std::pair<Type*, Type*>(SrcTy, DstTy)));
+    return;
+  }
+
+  if (isFPIntBitCast(I)) {
+    Out << '(';
+    // These int<->float and long<->double casts need to be handled specially
+    Out << GetValueName(&I) << "__BITCAST_TEMPORARY."
+      << getFloatBitCastField(I.getOperand(0)->getType()) << " = ";
+    writeOperand(I.getOperand(0), ContextCasted);
+    Out << ", " << GetValueName(&I) << "__BITCAST_TEMPORARY."
+      << getFloatBitCastField(I.getType());
+    Out << ')';
+    return;
+  }
+
+  Out << '(';
+  printCast(I.getOpcode(), SrcTy, DstTy);
+
+  // Make a sext from i1 work by subtracting the i1 from 0 (an int).
+  if (SrcTy == Type::getInt1Ty(I.getContext()) &&
+      I.getOpcode() == Instruction::SExt)
+    Out << "0-";
+
+  writeOperand(I.getOperand(0), ContextCasted);
+
+  if (DstTy == Type::getInt1Ty(I.getContext()) &&
+      (I.getOpcode() == Instruction::Trunc ||
+       I.getOpcode() == Instruction::FPToUI ||
+       I.getOpcode() == Instruction::FPToSI ||
+       I.getOpcode() == Instruction::PtrToInt)) {
+    // Make sure we really get a trunc to bool by anding the operand with 1
+    Out << "&1u";
+  }
+  Out << ')';
+}
+
+void CWriter::visitSelectInst(SelectInst &I) {
+  Out << "llvm_select_";
+  printTypeString(Out, I.getType(), false);
+  Out << "(";
+  writeOperand(I.getCondition(), ContextCasted);
+  Out << ", ";
+  writeOperand(I.getTrueValue(), ContextCasted);
+  Out << ", ";
+  writeOperand(I.getFalseValue(), ContextCasted);
+  Out << ")";
+  SelectDeclTypes.insert(I.getType());
+  assert(I.getCondition()->getType()->isVectorTy() == I.getType()->isVectorTy()); // TODO: might be scalarty == vectorty
+}
+
+// Returns the macro name or value of the max or min of an integer type
+// (as defined in limits.h).
+static void printLimitValue(IntegerType &Ty, bool isSigned, bool isMax,
+    raw_ostream &Out) {
+  const char* type;
+  const char* sprefix = "";
+
+  unsigned NumBits = Ty.getBitWidth();
+  if (NumBits <= 8) {
+    type = "CHAR";
+    sprefix = "S";
+  } else if (NumBits <= 16) {
+    type = "SHRT";
+  } else if (NumBits <= 32) {
+    type = "INT";
+  } else if (NumBits <= 64) {
+    type = "LLONG";
+  } else {
+    llvm_unreachable("Bit widths > 64 not implemented yet");
+  }
+
+  if (isSigned)
+    Out << sprefix << type << (isMax ? "_MAX" : "_MIN");
+  else
+    Out << "U" << type << (isMax ? "_MAX" : "0");
+}
+
+#ifndef NDEBUG
+static bool isSupportedIntegerSize(IntegerType &T) {
+  return T.getBitWidth() == 8 || T.getBitWidth() == 16 ||
+    T.getBitWidth() == 32 || T.getBitWidth() == 64 ||
+    T.getBitWidth() == 128;
+}
+#endif
+
+void CWriter::printIntrinsicDefinition(FunctionType *funT,
+    unsigned Opcode, std::string OpName, raw_ostream &Out) {
+  Type *retT = funT->getReturnType();
+  Type *elemT = funT->getParamType(0);
+  IntegerType *elemIntT = dyn_cast<IntegerType>(elemT);
+  char i, numParams = funT->getNumParams();
+  bool isSigned;
+  switch (Opcode) {
+    default:
+      isSigned = false;
+      break;
+    case Intrinsic::sadd_with_overflow:
+    case Intrinsic::ssub_with_overflow:
+    case Intrinsic::smul_with_overflow:
+      isSigned = true;
+      break;
+  }
+  assert(numParams > 0 && numParams < 26);
+
+  if (isa<VectorType>(retT)) {
+    // this looks general, but is only actually used for ctpop, ctlz, cttz
+    Type* *devecFunParams = (Type**)alloca(sizeof(Type*) * numParams);
+    for (i = 0; i < numParams; i++) {
+      devecFunParams[(int)i] = funT->params()[(int)i]->getScalarType();
+    }
+    FunctionType *devecFunT = FunctionType::get(funT->getReturnType()->getScalarType(),
+        makeArrayRef(devecFunParams, numParams), funT->isVarArg());
+    printIntrinsicDefinition(devecFunT, Opcode, OpName + "_devec", Out);
+  }
+
+  // static __forceinline Rty _llvm_op_ixx(unsigned ixx a, unsigned ixx b) {
+  //   Rty r;
+  //   <opcode here>
+  //   return r;
+  // }
+  Out << "static __forceinline ";
+  printTypeName(Out, retT);
+  Out << " ";
+  Out << OpName;
+  Out << "(";
+  for (i = 0; i < numParams; i++) {
+    switch (Opcode) {
+      // optional intrinsic validity assertion checks
+      default:
+        // default case: assume all parameters must have the same type
+        assert(elemT == funT->getParamType(i));
+        break;
+      case Intrinsic::ctlz:
+      case Intrinsic::cttz:
+      case Intrinsic::powi:
+        break;
+    }
+    printTypeNameUnaligned(Out, funT->getParamType(i), isSigned);
+    Out << " " << (char)('a' + i);
+    if (i != numParams - 1) Out << ", ";
+  }
+  Out << ") {\n  ";
+  printTypeName(Out, retT);
+  Out << " r;\n";
+
+  if (isa<VectorType>(retT)) {
+    for (i = 0; i < numParams; i++) {
+      Out << "  r.vector[" << (int)i << "] = " << OpName << "_devec(";
+      for (char j = 0; j < numParams; j++) {
+        Out << (char)('a' + j);
+        if (isa<VectorType>(funT->params()[j]))
+          Out << ".vector[" << (int)i << "]";
+        if (j != numParams - 1) Out << ", ";
+      }
+      Out << ");\n";
+    }
+  }
+  else if (elemIntT) {
+    // handle integer ops
+    assert(isSupportedIntegerSize(*elemIntT) &&
+        "CBackend does not support arbitrary size integers.");
+    switch (Opcode) {
+      default:
+#ifndef NDEBUG
+        errs() << "Unsupported Intrinsic!" << Opcode;
+#endif
+        llvm_unreachable(0);
+
+      case Intrinsic::uadd_with_overflow:
+        //   r.field0 = a + b;
+        //   r.field1 = (r.field0 < a);
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field0 = a + b;\n";
+        Out << "  r.field1 = (a >= -b);\n";
+        break;
+
+      case Intrinsic::sadd_with_overflow:
+        //   r.field0 = a + b;
+        //   r.field1 = (b > 0 && a > XX_MAX - b) ||
+        //              (b < 0 && a < XX_MIN - b);
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field0 = a + b;\n";
+        Out << "  r.field1 = (b >= 0 ? a > ";
+        printLimitValue(*elemIntT, true, true, Out);
+        Out << " - b : a < ";
+        printLimitValue(*elemIntT, true, false, Out);
+        Out << " - b);\n";
+        break;
+
+      case Intrinsic::usub_with_overflow:
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field0 = a - b;\n";
+        Out << "  r.field1 = (a < b);\n";
+        break;
+
+      case Intrinsic::ssub_with_overflow:
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field0 = a - b;\n";
+        Out << "  r.field1 = (b <= 0 ? a > ";
+        printLimitValue(*elemIntT, true, true, Out);
+        Out << " + b : a < ";
+        printLimitValue(*elemIntT, true, false, Out);
+        Out << " + b);\n";
+        break;
+
+      case Intrinsic::umul_with_overflow:
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field1 = LLVMMul_uov(8 * sizeof(a), &a, &b, &r.field0);\n";
+        break;
+
+      case Intrinsic::smul_with_overflow:
+        assert(cast<StructType>(retT)->getElementType(0) == elemT);
+        Out << "  r.field1 = LLVMMul_sov(8 * sizeof(a), &a, &b, &r.field0);\n";
+        break;
+
+      case Intrinsic::bswap:
+        assert(retT == elemT);
+        Out << "  LLVMFlipAllBits(8 * sizeof(a), &a, &r);\n";
+        break;
+
+      case Intrinsic::ctpop:
+        assert(retT == elemT);
+        Out << "  r = ";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << "llvm_ctor_u128(0, ";
+        Out << "LLVMCountPopulation(8 * sizeof(a), &a)";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << ")";
+        Out << ";\n";
+        break;
+
+      case Intrinsic::ctlz:
+        assert(retT == elemT);
+        Out << "  (void)b;\n  r = ";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << "llvm_ctor_u128(0, ";
+        Out << "LLVMCountLeadingZeros(8 * sizeof(a), &a)";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << ")";
+        Out << ";\n";
+        break;
+
+      case Intrinsic::cttz:
+        assert(retT == elemT);
+        Out << "  (void)b;\n  r = ";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << "llvm_ctor_u128(0, ";
+        Out << "LLVMCountTrailingZeros(8 * sizeof(a), &a)";
+        if (retT->getPrimitiveSizeInBits() > 64)
+          Out << ")";
+        Out << ";\n";
+        break;
+    }
+
+  } else {
+    // handle FP ops
+    const char *suffix;
+    assert(retT == elemT);
+    if (elemT->isFloatTy() || elemT->isHalfTy()) {
+      suffix = "f";
+    } else if (elemT->isDoubleTy()) {
+      suffix = "";
+    } else if (elemT->isFP128Ty()) {
+    } else if (elemT->isX86_FP80Ty()) {
+    } else if (elemT->isPPC_FP128Ty()) {
+      suffix = "l";
+    } else {
+#ifndef NDEBUG
+      errs() << "Unsupported Intrinsic!" << Opcode;
+#endif
+      llvm_unreachable(0);
+    }
+
+    switch (Opcode) {
+      default:
+#ifndef NDEBUG
+        errs() << "Unsupported Intrinsic!" << Opcode;
+#endif
+        llvm_unreachable(0);
+
+      case Intrinsic::ceil:
+        Out << "  r = ceil" << suffix << "(a);\n";
+        break;
+
+      case Intrinsic::fabs:
+        Out << "  r = fabs" << suffix << "(a);\n";
+        break;
+
+      case Intrinsic::floor:
+        Out << "  r = floor" << suffix << "(a);\n";
+        break;
+
+      case Intrinsic::fma:
+        Out << "  r = fma" << suffix << "(a, b, c);\n";
+        break;
+
+      case Intrinsic::fmuladd:
+        Out << "  r = a * b + c;\n";
+        break;
+
+      case Intrinsic::pow:
+      case Intrinsic::powi:
+        Out << "  r = pow" << suffix << "(a, b);\n";
+        break;
+
+      case Intrinsic::rint:
+        Out << "  r = rint" << suffix << "(a);\n";
+        break;
+
+      case Intrinsic::sqrt:
+        Out << "  r = sqrt" << suffix << "(a);\n";
+        break;
+
+      case Intrinsic::trunc:
+        Out << "  r = trunc" << suffix << "(a);\n";
+        break;
+
+    }
+  }
+
+  Out << "  return r;\n}\n";
+}
+
+void CWriter::printIntrinsicDefinition(Function &F, raw_ostream &Out) {
+  FunctionType *funT = F.getFunctionType();
+  unsigned Opcode = F.getIntrinsicID();
+  std::string OpName = GetValueName(&F);
+  printIntrinsicDefinition(funT, Opcode, OpName, Out);
+}
+
+void CWriter::lowerIntrinsics(Function &F) {
+  // Examine all the instructions in this function to find the intrinsics that
+  // need to be lowered.
+  for (Function::iterator BB = F.begin(), EE = F.end(); BB != EE; ++BB)
+    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; )
+      if (CallInst *CI = dyn_cast<CallInst>(I++))
+        if (Function *F = CI->getCalledFunction())
+          switch (F->getIntrinsicID()) {
+            case Intrinsic::not_intrinsic:
+            case Intrinsic::vastart:
+            case Intrinsic::vacopy:
+            case Intrinsic::vaend:
+            case Intrinsic::returnaddress:
+            case Intrinsic::frameaddress:
+            case Intrinsic::setjmp:
+            case Intrinsic::longjmp:
+            case Intrinsic::sigsetjmp:
+            case Intrinsic::siglongjmp:
+            case Intrinsic::prefetch:
+            case Intrinsic::x86_sse_cmp_ss:
+            case Intrinsic::x86_sse_cmp_ps:
+            case Intrinsic::x86_sse2_cmp_sd:
+            case Intrinsic::x86_sse2_cmp_pd:
+            case Intrinsic::ppc_altivec_lvsl:
+            case Intrinsic::uadd_with_overflow:
+            case Intrinsic::sadd_with_overflow:
+            case Intrinsic::usub_with_overflow:
+            case Intrinsic::ssub_with_overflow:
+            case Intrinsic::umul_with_overflow:
+            case Intrinsic::smul_with_overflow:
+            case Intrinsic::bswap:
+            case Intrinsic::ceil:
+            case Intrinsic::ctlz:
+            case Intrinsic::ctpop:
+            case Intrinsic::cttz:
+            case Intrinsic::fabs:
+            case Intrinsic::floor:
+            case Intrinsic::fma:
+            case Intrinsic::fmuladd:
+            case Intrinsic::pow:
+            case Intrinsic::powi:
+            case Intrinsic::rint:
+            case Intrinsic::sqrt:
+            case Intrinsic::trunc:
+            case Intrinsic::trap:
+            case Intrinsic::stackprotector:
+            case Intrinsic::dbg_value:
+            case Intrinsic::dbg_declare:
+              // We directly implement these intrinsics
+              break;
+            default:
+              // All other intrinsic calls we must lower.
+              BasicBlock::iterator Before = E;
+              if (CI != &BB->front())
+                Before = std::prev(BasicBlock::iterator(CI));
+
+              IL->LowerIntrinsicCall(CI);
+              if (Before != E) {        // Move iterator to instruction after call
+                I = Before; ++I;
+              } else {
+                I = BB->begin();
+              }
+              // If the intrinsic got lowered to another call, and that call has
+              // a definition then we need to make sure its prototype is emitted
+              // before any calls to it.
+              if (CallInst *Call = dyn_cast<CallInst>(I))
+                if (Function *NewF = Call->getCalledFunction())
+                  if (!NewF->isDeclaration())
+                    prototypesToGen.push_back(NewF);
+
+              break;
+          }
+}
+
+void CWriter::visitCallInst(CallInst &I) {
+  if (isa<InlineAsm>(I.getCalledValue()))
+    return visitInlineAsm(I);
+
+  // Handle intrinsic function calls first...
+  if (Function *F = I.getCalledFunction())
+    if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID())
+      if (visitBuiltinCall(I, ID))
+        return;
+
+  Value *Callee = I.getCalledValue();
+
+  PointerType  *PTy   = cast<PointerType>(Callee->getType());
+  FunctionType *FTy   = cast<FunctionType>(PTy->getElementType());
+
+  // If this is a call to a struct-return function, assign to the first
+  // parameter instead of passing it to the call.
+
+  // CHECK: If AttributeList replaces AttributeSet for CallInst
+  const AttributeList PAL = I.getAttributes();
+  bool hasByVal = I.hasByValArgument();
+  bool isStructRet = I.hasStructRetAttr();
+  if (isStructRet) {
+    writeOperandDeref(I.getArgOperand(0));
+    Out << " = ";
+  }
+
+  if (I.isTailCall()) Out << " /*tail*/ ";
+
+  // If this is an indirect call to a struct return function, we need to cast
+  // the pointer. Ditto for indirect calls with byval arguments.
+  bool NeedsCast = (hasByVal || isStructRet || I.getCallingConv() != CallingConv::C) && !isa<Function>(Callee);
+
+  // GCC is a real PITA.  It does not permit codegening casts of functions to
+  // function pointers if they are in a call (it generates a trap instruction
+  // instead!).  We work around this by inserting a cast to void* in between
+  // the function and the function pointer cast.  Unfortunately, we can't just
+  // form the constant expression here, because the folder will immediately
+  // nuke it.
+  //
+  // Note finally, that this is completely unsafe.  ANSI C does not guarantee
+  // that void* and function pointers have the same size. :( To deal with this
+  // in the common case, we handle casts where the number of arguments passed
+  // match exactly.
+  //
+  if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Callee))
+    if (CE->isCast())
+      if (Function *RF = dyn_cast<Function>(CE->getOperand(0))) {
+        NeedsCast = true;
+        Callee = RF;
+      }
+
+  if (NeedsCast) {
+    // Ok, just cast the pointer type.
+    Out << "((";
+    printTypeName(Out, I.getCalledValue()->getType()->getPointerElementType(), false, std::make_pair(PAL, I.getCallingConv()));
+    Out << "*)(void*)";
+  }
+  writeOperand(Callee, ContextCasted);
+  if (NeedsCast) Out << ')';
+
+  Out << '(';
+
+  bool PrintedArg = false;
+  if (FTy->isVarArg() && !FTy->getNumParams()) {
+    Out << "0 /*dummy arg*/";
+    PrintedArg = true;
+  }
+
+  unsigned NumDeclaredParams = FTy->getNumParams();
+  CallSite CS(&I);
+  CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end();
+  unsigned ArgNo = 0;
+  if (isStructRet) {   // Skip struct return argument.
+    ++AI;
+    ++ArgNo;
+  }
+
+  Function *F = I.getCalledFunction();
+  if (F) {
+    StringRef Name = F->getName();
+    // emit cast for the first argument to type expected by header prototype
+    // the jmp_buf type is an array, so the array-to-pointer decay adds the
+    // strange extra *'s
+    if (Name == "sigsetjmp")
+      Out << "*(sigjmp_buf*)";
+    else if (Name == "setjmp")
+      Out << "*(jmp_buf*)";
+  }
+
+  for (; AI != AE; ++AI, ++ArgNo) {
+    if (PrintedArg) Out << ", ";
+    if (ArgNo < NumDeclaredParams &&
+        (*AI)->getType() != FTy->getParamType(ArgNo)) {
+      Out << '(';
+      printTypeNameUnaligned(Out, FTy->getParamType(ArgNo),
+          /*isSigned=*/PAL.hasAttribute(ArgNo+1, Attribute::SExt));
+      Out << ')';
+    }
+    // Check if the argument is expected to be passed by value.
+    if (I.getAttributes().hasAttribute(ArgNo+1, Attribute::ByVal))
+      writeOperandDeref(*AI);
+    else
+      writeOperand(*AI, ContextCasted);
+    PrintedArg = true;
+  }
+  Out << ')';
+}
+
+/// visitBuiltinCall - Handle the call to the specified builtin.  Returns true
+/// if the entire call is handled, return false if it wasn't handled
+bool CWriter::visitBuiltinCall(CallInst &I, Intrinsic::ID ID) {
+
+  switch (ID) {
+    default: {
+#ifndef NDEBUG
+               errs() << "Unknown LLVM intrinsic! " << I;
+#endif
+               llvm_unreachable(0);
+               return false;
+             }
+      
+    case Intrinsic::dbg_value:
+    case Intrinsic::dbg_declare:
+             return true; // ignore these intrinsics
+    case Intrinsic::vastart:
+             Out << "0; ";
+
+             Out << "va_start(*(va_list*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", ";
+             // Output the last argument to the enclosing function.
+             if (I.getParent()->getParent()->arg_empty())
+               Out << "vararg_dummy_arg";
+             else
+               writeOperand(&*(I.getParent()->getParent()->arg_end() - 1));
+             Out << ')';
+             return true;
+    case Intrinsic::vaend:
+             if (!isa<ConstantPointerNull>(I.getArgOperand(0))) {
+               Out << "0; va_end(*(va_list*)";
+               writeOperand(I.getArgOperand(0), ContextCasted);
+               Out << ')';
+             } else {
+               Out << "va_end(*(va_list*)0)";
+             }
+             return true;
+    case Intrinsic::vacopy:
+             Out << "0; ";
+             Out << "va_copy(*(va_list*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", *(va_list*)";
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::returnaddress:
+             Out << "__builtin_return_address(";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::frameaddress:
+             Out << "__builtin_frame_address(";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::setjmp:
+             Out << "setjmp(*(jmp_buf*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::longjmp:
+             Out << "longjmp(*(jmp_buf*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", ";
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::sigsetjmp:
+             Out << "sigsetjmp(*(sigjmp_buf*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ',';
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::siglongjmp:
+             Out << "siglongjmp(*(sigjmp_buf*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", ";
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ')';
+             return true;
+    case Intrinsic::prefetch:
+             Out << "LLVM_PREFETCH((const void *)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", ";
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ", ";
+             writeOperand(I.getArgOperand(2), ContextCasted);
+             Out << ")";
+             return true;
+    case Intrinsic::stacksave:
+             // Emit this as: Val = 0; *((void**)&Val) = __builtin_stack_save()
+             // to work around GCC bugs (see PR1809).
+             Out << "0; *((void**)&" << GetValueName(&I)
+               << ") = __builtin_stack_save()";
+             return true;
+    case Intrinsic::x86_sse_cmp_ss:
+    case Intrinsic::x86_sse_cmp_ps:
+    case Intrinsic::x86_sse2_cmp_sd:
+    case Intrinsic::x86_sse2_cmp_pd:
+             Out << '(';
+             printTypeName(Out, I.getType());
+             Out << ')';
+             // Multiple GCC builtins multiplex onto this intrinsic.
+             switch (cast<ConstantInt>(I.getArgOperand(2))->getZExtValue()) {
+               default: llvm_unreachable("Invalid llvm.x86.sse.cmp!");
+               case 0: Out << "__builtin_ia32_cmpeq"; break;
+               case 1: Out << "__builtin_ia32_cmplt"; break;
+               case 2: Out << "__builtin_ia32_cmple"; break;
+               case 3: Out << "__builtin_ia32_cmpunord"; break;
+               case 4: Out << "__builtin_ia32_cmpneq"; break;
+               case 5: Out << "__builtin_ia32_cmpnlt"; break;
+               case 6: Out << "__builtin_ia32_cmpnle"; break;
+               case 7: Out << "__builtin_ia32_cmpord"; break;
+             }
+             if (ID == Intrinsic::x86_sse_cmp_ps || ID == Intrinsic::x86_sse2_cmp_pd)
+               Out << 'p';
+             else
+               Out << 's';
+             if (ID == Intrinsic::x86_sse_cmp_ss || ID == Intrinsic::x86_sse_cmp_ps)
+               Out << 's';
+             else
+               Out << 'd';
+
+             Out << "(";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ", ";
+             writeOperand(I.getArgOperand(1), ContextCasted);
+             Out << ")";
+             return true;
+    case Intrinsic::ppc_altivec_lvsl:
+             Out << '(';
+             printTypeName(Out, I.getType());
+             Out << ')';
+             Out << "__builtin_altivec_lvsl(0, (void*)";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             Out << ")";
+             return true;
+    case Intrinsic::stackprotector:
+             writeOperandDeref(I.getArgOperand(1));
+             Out << " = ";
+             writeOperand(I.getArgOperand(0), ContextCasted);
+             return true;
+    case Intrinsic::uadd_with_overflow:
+    case Intrinsic::sadd_with_overflow:
+    case Intrinsic::usub_with_overflow:
+    case Intrinsic::ssub_with_overflow:
+    case Intrinsic::umul_with_overflow:
+    case Intrinsic::smul_with_overflow:
+    case Intrinsic::bswap:
+    case Intrinsic::ceil:
+    case Intrinsic::ctlz:
+    case Intrinsic::ctpop:
+    case Intrinsic::cttz:
+    case Intrinsic::fabs:
+    case Intrinsic::floor:
+    case Intrinsic::fma:
+    case Intrinsic::fmuladd:
+    case Intrinsic::pow:
+    case Intrinsic::powi:
+    case Intrinsic::rint:
+    case Intrinsic::sqrt:
+    case Intrinsic::trap:
+    case Intrinsic::trunc:
+             return false; // these use the normal function call emission
+  }
+}
+
+//This converts the llvm constraint string to something gcc is expecting.
+//TODO: work out platform independent constraints and factor those out
+//      of the per target tables
+//      handle multiple constraint codes
+std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) {
+  return TargetLowering::AsmOperandInfo(c).ConstraintCode;
+#if 0
+  assert(c.Codes.size() == 1 && "Too many asm constraint codes to handle");
+
+  // Grab the translation table from MCAsmInfo if it exists.
+  const MCRegisterInfo *MRI;
+  const MCAsmInfo *TargetAsm;
+  std::string Triple = TheModule->getTargetTriple();
+  if (Triple.empty())
+    Triple = llvm::sys::getDefaultTargetTriple();
+
+  std::string E;
+  if (const Target *Match = TargetRegistry::lookupTarget(Triple, E)) {
+    MRI = Match->createMCRegInfo(Triple);
+    TargetAsm = Match->createMCAsmInfo(*MRI, Triple);
+  } else {
+    return c.Codes[0];
+  }
+
+  const char *const *table = TargetAsm->getAsmCBE();
+
+  // Search the translation table if it exists.
+  for (int i = 0; table && table[i]; i += 2)
+    if (c.Codes[0] == table[i]) {
+      delete TargetAsm;
+      delete MRI;
+      return table[i+1];
+    }
+
+  // Default is identity.
+  delete TargetAsm;
+  delete MRI;
+  return c.Codes[0];
+#endif
+}
+
+//TODO: import logic from AsmPrinter.cpp
+static std::string gccifyAsm(std::string asmstr) {
+  for (std::string::size_type i = 0; i != asmstr.size(); ++i)
+    if (asmstr[i] == '\n')
+      asmstr.replace(i, 1, "\\n");
+    else if (asmstr[i] == '\t')
+      asmstr.replace(i, 1, "\\t");
+    else if (asmstr[i] == '$') {
+      if (asmstr[i + 1] == '{') {
+        std::string::size_type a = asmstr.find_first_of(':', i + 1);
+        std::string::size_type b = asmstr.find_first_of('}', i + 1);
+        std::string n = "%" +
+          asmstr.substr(a + 1, b - a - 1) +
+          asmstr.substr(i + 2, a - i - 2);
+        asmstr.replace(i, b - i + 1, n);
+        i += n.size() - 1;
+      } else
+        asmstr.replace(i, 1, "%");
+    }
+    else if (asmstr[i] == '%')//grr
+    { asmstr.replace(i, 1, "%%"); ++i;}
+
+  return asmstr;
+}
+
+//TODO: assumptions about what consume arguments from the call are likely wrong
+//      handle communitivity
+void CWriter::visitInlineAsm(CallInst &CI) {
+  InlineAsm* as = cast<InlineAsm>(CI.getCalledValue());
+  InlineAsm::ConstraintInfoVector Constraints = as->ParseConstraints();
+
+  std::vector<std::pair<Value*, int> > ResultVals;
+  if (CI.getType() == Type::getVoidTy(CI.getContext()))
+    ;
+  else if (StructType *ST = dyn_cast<StructType>(CI.getType())) {
+    for (unsigned i = 0, e = ST->getNumElements(); i != e; ++i)
+      ResultVals.push_back(std::make_pair(&CI, (int)i));
+  } else {
+    ResultVals.push_back(std::make_pair(&CI, -1));
+  }
+
+  // Fix up the asm string for gcc and emit it.
+  Out << "__asm__ volatile (\"" << gccifyAsm(as->getAsmString()) << "\"\n";
+  Out << "        :";
+
+  unsigned ValueCount = 0;
+  bool IsFirst = true;
+
+  // Convert over all the output constraints.
+  for (InlineAsm::ConstraintInfoVector::iterator I = Constraints.begin(),
+      E = Constraints.end(); I != E; ++I) {
+
+    if (I->Type != InlineAsm::isOutput) {
+      ++ValueCount;
+      continue;  // Ignore non-output constraints.
+    }
+
+    assert(I->Codes.size() == 1 && "Too many asm constraint codes to handle");
+    std::string C = InterpretASMConstraint(*I);
+    if (C.empty()) continue;
+
+    if (!IsFirst) {
+      Out << ", ";
+      IsFirst = false;
+    }
+
+    // Unpack the dest.
+    Value *DestVal;
+    int DestValNo = -1;
+
+    if (ValueCount < ResultVals.size()) {
+      DestVal = ResultVals[ValueCount].first;
+      DestValNo = ResultVals[ValueCount].second;
+    } else
+      DestVal = CI.getArgOperand(ValueCount-ResultVals.size());
+
+    if (I->isEarlyClobber)
+      C = "&"+C;
+
+    Out << "\"=" << C << "\"(" << GetValueName(DestVal);
+    if (DestValNo != -1)
+      Out << ".field" << DestValNo; // Multiple retvals.
+    Out << ")";
+    ++ValueCount;
+  }
+
+
+  // Convert over all the input constraints.
+  Out << "\n        :";
+  IsFirst = true;
+  ValueCount = 0;
+  for (InlineAsm::ConstraintInfoVector::iterator I = Constraints.begin(),
+      E = Constraints.end(); I != E; ++I) {
+    if (I->Type != InlineAsm::isInput) {
+      ++ValueCount;
+      continue;  // Ignore non-input constraints.
+    }
+
+    assert(I->Codes.size() == 1 && "Too many asm constraint codes to handle");
+    std::string C = InterpretASMConstraint(*I);
+    if (C.empty()) continue;
+
+    if (!IsFirst) {
+      Out << ", ";
+      IsFirst = false;
+    }
+
+    assert(ValueCount >= ResultVals.size() && "Input can't refer to result");
+    Value *SrcVal = CI.getArgOperand(ValueCount-ResultVals.size());
+
+    Out << "\"" << C << "\"(";
+    if (!I->isIndirect)
+      writeOperand(SrcVal);
+    else
+      writeOperandDeref(SrcVal);
+    Out << ")";
+  }
+
+  // Convert over the clobber constraints.
+  IsFirst = true;
+  for (InlineAsm::ConstraintInfoVector::iterator I = Constraints.begin(),
+      E = Constraints.end(); I != E; ++I) {
+    if (I->Type != InlineAsm::isClobber)
+      continue;  // Ignore non-input constraints.
+
+    assert(I->Codes.size() == 1 && "Too many asm constraint codes to handle");
+    std::string C = InterpretASMConstraint(*I);
+    if (C.empty()) continue;
+
+    if (!IsFirst) {
+      Out << ", ";
+      IsFirst = false;
+    }
+
+    Out << '\"' << C << '"';
+  }
+
+  Out << ")";
+}
+
+void CWriter::visitAllocaInst(AllocaInst &I) {
+  Out << '(';
+  printTypeName(Out, I.getType());
+  Out << ") alloca(sizeof(";
+  printTypeName(Out, I.getType()->getElementType());
+  if (I.isArrayAllocation()) { 
+    Out << ") * (" ;
+    writeOperand(I.getArraySize(), ContextCasted);
+  }
+  Out << "))";
+}
+
+void CWriter::printGEPExpression(Value *Ptr, gep_type_iterator I,
+    gep_type_iterator E, bool isArrayType, GetElementPtrInst *GEPI) {
+    //DEBUG(errs() << "Printing GEP\n");
+    //DEBUG(errs() << "\tPtr: " << *Ptr << "\n");
+    //DEBUG(errs() << "\tGEPI: " << *GEPI <<"\n"); 
+  // If there are no indices, just print out the pointer.
+  if (I == E) {
+    //DEBUG(errs() << "I==E: Calling writeOperand()\n");
+    writeOperand(Ptr);
+    return;
+  }
+
+  // Find out if the last index is into a vector.  If so, we have to print this
+  // specially.  Since vectors can't have elements of indexable type, only the
+  // last index could possibly be of a vector element.
+  VectorType *LastIndexIsVector = 0;
+  {
+    for (gep_type_iterator TmpI = I; TmpI != E; ++TmpI)
+      //LastIndexIsVector = dyn_cast<VectorType>(TmpI.getCurTy());
+      // CHECK: This change needs thorough testing
+      LastIndexIsVector = dyn_cast<VectorType>(TmpI.getIndexedType());
+  }
+  Out << "(";
+
+  // If the last index is into a vector, we can't print it as &a[i][j] because
+  // we can't index into a vector with j in GCC.  Instead, emit this as
+  // (((float*)&a[i])+j)
+  // TODO: this is no longer true now that we don't represent vectors using gcc-extentions
+  if (LastIndexIsVector) {
+    //DEBUG(errs() << "LastIndexIsVector\n");
+    Out << "((";
+    printTypeName(Out, PointerType::getUnqual(LastIndexIsVector->getElementType()));
+    Out << ")(";
+  }
+  bool isArrayAccess = false; 
+
+  if (GEPStack.size() > 0 && GEPStack.top() == GEPI) {
+    //DEBUG(errs() << "Processing load-specific GEP\n");
+    GEPStack.pop();
+    isArrayAccess = true;
+  } else {
+    //DEBUG(errs() << "I'm hereee!\n");
+    Out << '&';
+  }
+  //DEBUG(errs() << "Here!\n");
+  // If the first index is 0 (very typical) we can do a number of
+  // simplifications to clean up the code.
+  Value *FirstOp = I.getOperand();
+  //DEBUG(errs() << "FirstOp: " << *(I.getOperand()) << "\n");
+  if (!isa<Constant>(FirstOp) || !cast<Constant>(FirstOp)->isNullValue()) {
+    //DEBUG(errs() << "Calling writeoperand()\n");
+    // First index isn't simple, print it the hard way.
+    writeOperand(Ptr, ContextNormal, isArrayAccess);
+  } else {
+    ++I;  // Skip the zero index.
+    //DEBUG(errs() << "Skipping zero index\n");
+
+    // Okay, emit the first operand. If Ptr is something that is already address
+    // exposed, like a global, avoid emitting (&foo)[0], just emit foo instead.
+    if (isAddressExposed(Ptr)) {
+      //DEBUG(errs() << "Address exposed; calling writeoperandinternal()\n");
+      writeOperandInternal(Ptr);
+    }
+    //else if (I != E && (I.getCurTy())->isStructTy()) {
+    // NOTE: This change needs to be tested more
+    else if (I != E && (I.isStruct()) ) {
+      //DEBUG(errs() << "Not address exposed; is struct type\n");
+      // If we didn't already emit the first operand, see if we can print it as
+      // P->f instead of "P[0].f"
+      writeOperand(Ptr);
+      Out << "->field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
+      ++I;  // eat the struct index as well.
+    } else {
+      //DEBUG(errs() << "In else; emitting *P\n");
+      // Instead of emitting P[0][1], emit (*P)[1], which is more idiomatic.
+      Out << "(*";
+      writeOperand(Ptr);
+      Out << ")";
+    }
+  }
+
+  Type *Agg = GEPI->getSourceElementType();
+  unsigned CurIdx = 1;
+  for (; I != E; ++CurIdx, ++I) {
+    assert(I.getOperand()->getType()->isIntegerTy()); // TODO: indexing a Vector with a Vector is valid, but we don't support it here
+    //DEBUG(errs() << "Type: " << *Agg << "; operand: " << *(I.getOperand()) << "\n");
+    if ((Agg->isStructTy())){
+      //DEBUG(errs() << "Found a struct\n");
+      Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
+    } else if (Agg->isArrayTy()) {
+      //DEBUG(errs() << "Found an array!\n");
+      Out << ".array[";
+      writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
+      Out << ']';
+    } else if (!Agg->isVectorTy()) {
+      //DEBUG(errs() << "Not a vector!\n");
+      Out << '[';
+      writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
+      Out << ']';
+    } else {
+      //DEBUG(errs() << "In else!\n");
+      // If the last index is into a vector, then print it out as "+j)".  This
+      // works with the 'LastIndexIsVector' code above.
+      if (isa<Constant>(I.getOperand()) &&
+          cast<Constant>(I.getOperand())->isNullValue()) {
+        Out << "))";  // avoid "+0".
+      } else {
+        Out << ")+(";
+        writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
+        Out << "))";
+      }
+    }
+    CompositeType *CT = dyn_cast<CompositeType>(Agg);
+    if (!CT || CT->isPointerTy()) 
+    {
+      //DEBUG(errs() << "Something wrong!!\n");
+      break;
+    }
+    Value* Index = GEPI->getOperand(CurIdx);
+    if (!CT->indexValid(Index))
+      if (!CT || CT->isPointerTy()) 
+      {
+        //DEBUG(errs() << "Something wrong 2!!\n");
+        break;
+      }
+    Agg = CT->getTypeAtIndex(Index);
+  }
+  Out << ")";
+    //DEBUG(errs() << "Leaving printGEPExpression\n");
+}
+
+void CWriter::writeMemoryAccess(Value *Operand, Type *OperandType,
+    bool IsVolatile, unsigned Alignment /*bytes*/) {
+    //DEBUG(errs() << *OperandType << "; " << *Operand << "\n");
+  bool arrayAccess = false;
+  if(isa<GetElementPtrInst>(Operand)) {
+     //DEBUG(errs() << "ISA Get Element Pointer!\n");
+    arrayAccess = true;
+    GEPStack.push(dyn_cast<GetElementPtrInst>(Operand));
+  }
+//  if (isAddressExposed(Operand)) {
+//    DEBUG(errs() << "Is address exposed!!\n");
+//    writeOperandInternal(Operand);
+//    return;
+//  }
+
+  bool IsUnaligned = Alignment &&
+    Alignment < TD->getABITypeAlignment(OperandType);
+  if (!arrayAccess) {
+    if (!IsUnaligned)
+      Out << '*';
+
+    else if (IsUnaligned) {
+      Out << "__UNALIGNED_LOAD__(";
+      printTypeNameUnaligned(Out, OperandType, false);
+      if (IsVolatile) Out << " volatile";
+      Out << ", " << Alignment << ", ";
+    }
+
+    else if (IsVolatile) {
+      Out << "(";
+      printTypeName(Out, OperandType, false);
+      Out << "volatile";
+      Out << "*)";
+    } 
+  }
+
+  writeOperand(Operand,ContextNormal, arrayAccess );
+
+  if (IsUnaligned) {
+    Out << ")";
+  }
+}
+
+void CWriter::visitLoadInst(LoadInst &I) {
+  //DEBUG(errs() << "Visiting Load instruction!\n");
+  //  DEBUG(errs() << "Visiting load: " << I << "\n");
+  writeMemoryAccess(I.getOperand(0), I.getType(), I.isVolatile(),
+      I.getAlignment());
+
+}
+
+void CWriter::visitStoreInst(StoreInst &I) {
+  //DEBUG(errs() << "Visiting store instruction!\n");
+  writeMemoryAccess(I.getPointerOperand(), I.getOperand(0)->getType(),
+      I.isVolatile(), I.getAlignment());
+  Out << " = ";
+  Value *Operand = I.getOperand(0);
+  unsigned BitMask = 0;
+  if (IntegerType* ITy = dyn_cast<IntegerType>(Operand->getType()))
+    if (!ITy->isPowerOf2ByteWidth())
+      // We have a bit width that doesn't match an even power-of-2 byte
+      // size. Consequently we must & the value with the type's bit mask
+      BitMask = ITy->getBitMask();
+  if (BitMask)
+    Out << "((";
+  writeOperand(Operand, BitMask ? ContextNormal : ContextCasted);
+  if (BitMask)
+    Out << ") & " << BitMask << ")";
+}
+
+void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
+  //  DEBUG(errs() <<"Visiting GEP: " << I << "\n");
+  printGEPExpression(I.getPointerOperand(), gep_type_begin(I),
+      gep_type_end(I), I.getSourceElementType()->isArrayTy(), &I);
+}
+
+void CWriter::visitVAArgInst(VAArgInst &I) {
+  Out << "va_arg(*(va_list*)";
+  writeOperand(I.getOperand(0), ContextCasted);
+  Out << ", ";
+  printTypeName(Out, I.getType());
+  Out << ");\n ";
+}
+
+void CWriter::visitInsertElementInst(InsertElementInst &I) {
+  // Start by copying the entire aggregate value into the result variable.
+  writeOperand(I.getOperand(0));
+  Type *EltTy = I.getType()->getElementType();
+  assert(I.getOperand(1)->getType() == EltTy);
+  if (isEmptyType(EltTy)) return;
+
+  // Then do the insert to update the field.
+  Out << ";\n  ";
+  Out << GetValueName(&I) << ".vector[";
+  writeOperand(I.getOperand(2));
+  Out << "] = ";
+  writeOperand(I.getOperand(1), ContextCasted);
+}
+
+void CWriter::visitExtractElementInst(ExtractElementInst &I) {
+  assert(!isEmptyType(I.getType()));
+  if (isa<UndefValue>(I.getOperand(0))) {
+    Out << "(";
+    printTypeName(Out, I.getType());
+    Out << ") 0/*UNDEF*/";
+  } else {
+    Out << "(";
+    writeOperand(I.getOperand(0));
+    Out << ").vector[";
+    writeOperand(I.getOperand(1));
+    Out << "]";
+  }
+}
+
+// <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask>
+// ; yields <m x <ty>>
+void CWriter::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
+  VectorType *VT = SVI.getType();
+  Type *EltTy = VT->getElementType();
+  VectorType *InputVT = cast<VectorType>(SVI.getOperand(0)->getType());
+  assert(!isEmptyType(VT));
+  assert(InputVT->getElementType() == VT->getElementType());
+
+  CtorDeclTypes.insert(VT);
+  Out << "llvm_ctor_";
+  printTypeString(Out, VT, false);
+  Out << "(";
+
+  Constant *Zero = Constant::getNullValue(EltTy);
+  unsigned NumElts = VT->getNumElements();
+  unsigned NumInputElts = InputVT->getNumElements(); // n
+  for (unsigned i = 0; i != NumElts; ++i) {
+    if (i) Out << ", ";
+    int SrcVal = SVI.getMaskValue(i);
+    if ((unsigned)SrcVal >= NumInputElts * 2) {
+      Out << "/*undef*/";
+      printConstant(Zero, ContextCasted);
+    } else {
+      // If SrcVal belongs [0, n - 1], it extracts value from <v1>
+      // If SrcVal belongs [n, 2 * n - 1], it extracts value from <v2>
+      // In C++, the value false is converted to zero and the value true is
+      // converted to one
+      Value *Op = SVI.getOperand((unsigned)SrcVal >= NumInputElts);
+      if (isa<Instruction>(Op)) {
+        // Do an extractelement of this value from the appropriate input.
+        Out << "(";
+        writeOperand(Op);
+        Out << ").vector[";
+        Out << ((unsigned)SrcVal >= NumInputElts ? SrcVal - NumInputElts : SrcVal);
+        Out << "]";
+      } else if (isa<ConstantAggregateZero>(Op) || isa<UndefValue>(Op)) {
+        printConstant(Zero, ContextCasted);
+      } else {
+        printConstant(cast<ConstantVector>(Op)->getOperand(SrcVal &
+              (NumElts-1)),
+            ContextNormal);
+      }
+    }
+  }
+  Out << ")";
+}
+
+void CWriter::visitInsertValueInst(InsertValueInst &IVI) {
+  // Start by copying the entire aggregate value into the result variable.
+  writeOperand(IVI.getOperand(0));
+  Type *EltTy = IVI.getOperand(1)->getType();
+  if (isEmptyType(EltTy)) return;
+
+  // Then do the insert to update the field.
+  Out << ";\n  ";
+  Out << GetValueName(&IVI);
+  for (const unsigned *b = IVI.idx_begin(), *i = b, *e = IVI.idx_end();
+      i != e; ++i) {
+    Type *IndexedTy =
+      ExtractValueInst::getIndexedType(IVI.getOperand(0)->getType(),
+          makeArrayRef(b, i));
+    assert(IndexedTy);
+    if (IndexedTy->isArrayTy())
+      Out << ".array[" << *i << "]";
+    else
+      Out << ".field" << *i;
+  }
+  Out << " = ";
+  writeOperand(IVI.getOperand(1), ContextCasted);
+}
+
+void CWriter::visitExtractValueInst(ExtractValueInst &EVI) {
+  Out << "(";
+  if (isa<UndefValue>(EVI.getOperand(0))) {
+    Out << "(";
+    printTypeName(Out, EVI.getType());
+    Out << ") 0/*UNDEF*/";
+  } else {
+    writeOperand(EVI.getOperand(0));
+    for (const unsigned *b = EVI.idx_begin(), *i = b, *e = EVI.idx_end();
+        i != e; ++i) {
+      Type *IndexedTy =
+        ExtractValueInst::getIndexedType(EVI.getOperand(0)->getType(),
+            makeArrayRef(b, i));
+      if (IndexedTy->isArrayTy())
+        Out << ".array[" << *i << "]";
+      else
+        Out << ".field" << *i;
+    }
+  }
+  Out << ")";
+}
+
+//===----------------------------------------------------------------------===//
+//                       External Interface declaration
+//===----------------------------------------------------------------------===//
+
+ bool CTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
+					  raw_pwrite_stream &Out,
+                                          raw_pwrite_stream *Out2,
+					  CodeGenFileType FileType,
+                                          bool DisableVerify,
+                                          MachineModuleInfo *MMI){
+
+  if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
+
+  PM.add(createGCLoweringPass());
+  PM.add(createLowerInvokePass());
+  PM.add(createCFGSimplificationPass());   // clean up after lower invoke.
+  PM.add(new CWriter(Out));
+  return false;
+}
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h
new file mode 100644
index 0000000000..07f3b80af5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.h
@@ -0,0 +1,344 @@
+
+#include "CTargetMachine.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/DepthFirstIterator.h"
+#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/CodeGen/IntrinsicLowering.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/IR/Attributes.h"
+#include "llvm/IR/CallingConv.h"
+#include "llvm/IR/CallSite.h"
+#include "llvm/IR/CFG.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/GetElementPtrTypeIterator.h"
+#include "llvm/IR/InstVisitor.h"
+#include "llvm/IR/InlineAsm.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Intrinsics.h"
+#include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/Module.h"
+#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCObjectFileInfo.h"
+#include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/MC/MCSymbol.h"
+#include "llvm/Pass.h"
+#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Transforms/Scalar.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/Analysis/PostDominators.h"
+#include "llvm/IR/Dominators.h"
+#include "llvm/Transforms/Utils/PromoteMemToReg.h"
+#include "llvm/Transforms/Utils/Mem2Reg.h"
+#include "llvm/Transforms/Utils/LoopUtils.h"
+#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Analysis/ScalarEvolutionExpander.h"
+#include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/Analysis/IVUsers.h"
+#include "llvm/Transforms/Utils/LoopSimplify.h"
+#include "llvm/Analysis/AssumptionCache.h"
+
+#include <set>
+#include <stack>
+
+#define GENERIC_ADDRSPACE 0
+#define GLOBAL_ADDRSPACE 1
+#define SHARED_ADDRSPACE 3
+#define CONSTANT_ADDRSPACE 4
+#define PRIVATE_ADDRSPACE 5
+
+namespace {
+  using namespace llvm;
+
+  class CBEMCAsmInfo : public MCAsmInfo {
+  public:
+    CBEMCAsmInfo() {
+      PrivateGlobalPrefix = "";
+    }
+  };
+
+  /// CWriter - This class is the main chunk of code that converts an LLVM
+  /// module to a C translation unit.
+  class CWriter : public FunctionPass, public InstVisitor<CWriter> {
+    std::string _Out;
+    raw_string_ostream Out;
+    raw_pwrite_stream &FileOut;
+    IntrinsicLowering *IL;
+    LoopInfo *LI;
+    PostDominatorTree *PDT;
+    DominatorTree *DT;
+    ScalarEvolution *SE;
+    IVUsers *IU;
+    AssumptionCache *AC;
+    
+    const Module *TheModule;
+    const MCAsmInfo* TAsm;
+    const MCRegisterInfo *MRI;
+    const MCObjectFileInfo *MOFI;
+    MCContext *TCtx;
+    const DataLayout* TD;
+
+    std::map<const ConstantFP *, unsigned> FPConstantMap;
+    std::set<const Argument*> ByValParams;
+    
+    // Set for storing all loop induction variables 
+    std::set<PHINode*> LInductionVars;
+    std::map<Loop*, PHINode*> LoopIndVarsMap;
+
+    unsigned FPCounter;
+    unsigned OpaqueCounter;
+
+    DenseMap<const Value*, unsigned> AnonValueNumbers;
+    unsigned NextAnonValueNumber;
+
+    /// UnnamedStructIDs - This contains a unique ID for each struct that is
+    /// either anonymous or has no name.
+    DenseMap<StructType*, unsigned> UnnamedStructIDs;
+    unsigned NextAnonStructNumber;
+
+    std::set<Type*> TypedefDeclTypes;
+    std::set<Type*> SelectDeclTypes;
+    std::set<std::pair<CmpInst::Predicate, VectorType*>> CmpDeclTypes;
+    std::set<std::pair<CastInst::CastOps, std::pair<Type*, Type*>>> CastOpDeclTypes;
+    std::set<std::pair<unsigned, Type*>> InlineOpDeclTypes;
+    std::set<Type*> CtorDeclTypes;
+
+    DenseMap<std::pair<FunctionType*, std::pair<AttributeList, CallingConv::ID>>, unsigned> UnnamedFunctionIDs;
+    unsigned NextFunctionNumber;
+
+    // This is used to keep track of intrinsics that get generated to a lowered
+    // function. We must generate the prototypes before the function body which
+    // will only be expanded on first use
+    std::vector<Function*> prototypesToGen;
+    
+    // Set for keeping track of visited blocks to avoid goto when possible
+    std::set<BasicBlock*> VisitedBlocks;
+    std::set<BasicBlock*> CompVisitedBlocks;
+    std::set<BasicBlock*> FindVisitedBlocks;
+    std::set<BasicBlock*> ReplicateBlocks;
+    std::stack<BasicBlock*> ImmPostDommBlocks;
+    std::stack<BasicBlock*> ElseBlocks;
+    std::stack<BranchInst*> ElseBranches;
+    std::stack<GetElementPtrInst*> GEPStack;
+  public:
+    static char ID;
+    explicit CWriter(raw_pwrite_stream &o)
+      : FunctionPass(ID), Out(_Out), FileOut(o), IL(0), LI(0),
+        TheModule(0), TAsm(0), MRI(0), MOFI(0), TCtx(0), TD(0),
+        OpaqueCounter(0), NextAnonValueNumber(0),
+        NextAnonStructNumber(0), NextFunctionNumber(0), PDT(0) {
+      FPCounter = 0;
+    }
+
+    virtual StringRef getPassName() const { return "C backend"; }
+
+    void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired<LoopInfoWrapperPass>();
+      // Adding PDT pass to avoid code duplication
+      AU.addRequired<PostDominatorTreeWrapperPass>();
+      AU.addRequired<ScalarEvolutionWrapperPass>();
+      AU.addRequired<DominatorTreeWrapperPass>();
+      AU.addRequired<AssumptionCacheTracker>();
+//      AU.addRequiredID(LoopSimplifyID);
+//      AU.addRequired<LoopSimplifyPass>();
+
+//      AU.addRequired<IVUsersWrapperPass>();
+      //AU.addRequired<PromotePass>();
+      AU.setPreservesCFG();
+    }
+
+    virtual bool doInitialization(Module &M);
+    virtual bool doFinalization(Module &M);
+    virtual bool runOnFunction(Function &F);
+
+  private:
+
+    void generateHeader(Module &M);
+    void declareOneGlobalVariable(GlobalVariable* I);
+
+    void forwardDeclareStructs(raw_ostream &Out, Type *Ty, std::set<Type*> &TypesPrinted);
+    void forwardDeclareFunctionTypedefs(raw_ostream &Out, Type *Ty,
+					std::set<Type*> &TypesPrinted);
+
+    raw_ostream &printFunctionProto(raw_ostream &Out, FunctionType *Ty,
+				    //std::pair<AttributeSet, CallingConv::ID> Attrs,
+				    std::pair<AttributeList, CallingConv::ID> Attrs,
+				    const std::string &Name,
+				    Function::arg_iterator ArgList,
+				    //Function::ArgumentListType *ArgList,
+				    bool isKernel);
+    
+    raw_ostream &printFunctionProto(raw_ostream &Out, Function *F) {
+      bool isKernel = false;
+      if (NamedMDNode * KernelMD = F->getParent()->getNamedMetadata("opencl.kernels")) {
+        for (auto iter : KernelMD->operands()) {
+          const MDOperand *KernelMDOp = iter->operands().begin();
+          Metadata *KMD = KernelMDOp->get();
+          if(ValueAsMetadata *KMDVAM = dyn_cast<ValueAsMetadata>(KMD)){
+            Value *KMDVal = KMDVAM->getValue();
+            Function *KMDFunc = dyn_cast<Function>(KMDVal);
+            if(KMDFunc == F) {
+              isKernel = true;
+            }
+          }
+        }
+      }
+      
+      return printFunctionProto(Out, F->getFunctionType(), std::make_pair(F->getAttributes(), F->getCallingConv()), GetValueName(F), NULL, isKernel);
+      
+    }
+
+    raw_ostream &printFunctionDeclaration(raw_ostream &Out, FunctionType *Ty,
+        std::pair<AttributeList, CallingConv::ID> PAL = std::make_pair(AttributeList(), CallingConv::C));
+    raw_ostream &printStructDeclaration(raw_ostream &Out, StructType *Ty);
+    raw_ostream &printArrayDeclaration(raw_ostream &Out, ArrayType *Ty);
+    raw_ostream &printVectorDeclaration(raw_ostream &Out, VectorType *Ty);
+
+    raw_ostream &printTypeName(raw_ostream &Out, Type *Ty,
+			       bool isSigned = false,
+			       std::pair<AttributeList, CallingConv::ID>
+			       PAL = std::make_pair(AttributeList(), CallingConv::C));
+    raw_ostream &printTypeNameUnaligned(raw_ostream &Out, Type *Ty, bool isSigned = false);
+    raw_ostream &printSimpleType(raw_ostream &Out, Type *Ty, bool isSigned);
+    raw_ostream &printTypeString(raw_ostream &Out, Type *Ty, bool isSigned);
+
+    std::string getStructName(StructType *ST);
+    std::string getFunctionName(FunctionType *FT,
+				std::pair<AttributeList, CallingConv::ID> PAL
+				= std::make_pair(AttributeList(), CallingConv::C));
+    std::string getArrayName(ArrayType *AT);
+    std::string getVectorName(VectorType *VT, bool Aligned);
+
+    enum OperandContext {
+      ContextNormal,
+      ContextCasted,
+      // Casted context means the type-cast will be implicit,
+      // such as the RHS of a `var = RHS;` expression
+      // or inside a struct initializer expression
+      ContextStatic
+        // Static context means that it is being used in as a static initializer
+        // (also implies ContextCasted)
+    };
+
+    void writeOperandDeref(Value *Operand);
+    void writeOperand(Value *Operand, enum OperandContext Context = ContextNormal, bool arrayAccess = false);
+    void writeInstComputationInline(Instruction &I);
+    void writeOperandInternal(Value *Operand, enum OperandContext Context = ContextNormal);
+    void writeOperandWithCast(Value* Operand, unsigned Opcode);
+    void opcodeNeedsCast(unsigned Opcode, bool &shouldCast, bool &castIsSigned);
+
+    void writeOperandWithCast(Value* Operand, ICmpInst &I);
+    bool writeInstructionCast(Instruction &I);
+    void writeMemoryAccess(Value *Operand, Type *OperandType,
+        bool IsVolatile, unsigned Alignment);
+
+    std::string InterpretASMConstraint(InlineAsm::ConstraintInfo& c);
+
+    void lowerIntrinsics(Function &F);
+    /// Prints the definition of the intrinsic function F. Supports the
+    /// intrinsics which need to be explicitly defined in the CBackend.
+    void printIntrinsicDefinition(Function &F, raw_ostream &Out);
+    void printIntrinsicDefinition(FunctionType *funT,
+        unsigned Opcode, std::string OpName,
+        raw_ostream &Out);
+
+    void printModuleTypes(raw_ostream &Out);
+    void printContainedTypes(raw_ostream &Out, Type *Ty, std::set<Type*> &);
+
+    void printFloatingPointConstants(Function &F);
+    void printFloatingPointConstants(const Constant *C);
+
+    void printFunction(Function &);
+    void printBasicBlock(BasicBlock *BB);
+    void printLoop(Loop *L);
+
+    void printCast(unsigned opcode, Type *SrcTy, Type *DstTy);
+    void printConstant(Constant *CPV, enum OperandContext Context);
+    void printConstantWithCast(Constant *CPV, unsigned Opcode);
+    bool printConstExprCast(ConstantExpr *CE);
+    void printConstantArray(ConstantArray *CPA, enum OperandContext Context);
+    void printConstantVector(ConstantVector *CV, enum OperandContext Context);
+    void printConstantDataSequential(ConstantDataSequential *CDS, enum OperandContext Context);
+    bool printConstantString(Constant *C, enum OperandContext Context);
+
+    bool isEmptyType(Type *Ty) const;
+    bool isAddressExposed(Value *V) const;
+    bool isInlinableInst(Instruction &I) const;
+    AllocaInst *isDirectAlloca(Value *V) const;
+    bool isInlineAsm(Instruction& I) const;
+
+    // Instruction visitation functions
+    friend class InstVisitor<CWriter>;
+
+    void visitReturnInst(ReturnInst &I);
+    void visitBranchInst(BranchInst &I);
+    void visitSwitchInst(SwitchInst &I);
+    void visitIndirectBrInst(IndirectBrInst &I);
+    void visitInvokeInst(InvokeInst &I) {
+      llvm_unreachable("Lowerinvoke pass didn't work!");
+    }
+    void visitResumeInst(ResumeInst &I) {
+      llvm_unreachable("DwarfEHPrepare pass didn't work!");
+    }
+    void visitUnreachableInst(UnreachableInst &I);
+
+    void visitPHINode(PHINode &I);
+    void visitBinaryOperator(BinaryOperator &I);
+    void visitICmpInst(ICmpInst &I);
+    void visitFCmpInst(FCmpInst &I);
+
+    void visitCastInst (CastInst &I);
+    void visitSelectInst(SelectInst &I);
+    void visitCallInst (CallInst &I);
+    void visitInlineAsm(CallInst &I);
+    bool visitBuiltinCall(CallInst &I, Intrinsic::ID ID);
+
+    void visitAllocaInst(AllocaInst &I);
+    void visitLoadInst  (LoadInst   &I);
+    void visitStoreInst (StoreInst  &I);
+    void visitGetElementPtrInst(GetElementPtrInst &I);
+    void visitVAArgInst (VAArgInst &I);
+
+    void visitInsertElementInst(InsertElementInst &I);
+    void visitExtractElementInst(ExtractElementInst &I);
+    void visitShuffleVectorInst(ShuffleVectorInst &SVI);
+
+    void visitInsertValueInst(InsertValueInst &I);
+    void visitExtractValueInst(ExtractValueInst &I);
+    void visitInstruction(Instruction &I) {
+#ifndef NDEBUG
+      errs() << "C Writer does not know about " << I;
+#endif
+      llvm_unreachable(0);
+    }
+
+    void outputLValue(Instruction *I) {
+      Out << "  " << GetValueName(I) << " = ";
+    }
+
+    bool extractIndVarChain(Instruction *Inst, std::stack<Instruction*> *IndVarChain, Instruction *Branch, unsigned indent);
+    
+    bool traverseUseDefChain(Instruction*I, PHINode*PI);
+    bool isGotoCodeNecessary(BasicBlock *From, BasicBlock *To);
+    void printPHICopiesForSuccessor(BasicBlock *CurBlock,
+        BasicBlock *Successor, unsigned Indent);
+    void printBranchToBlock(BasicBlock *CurBlock, BasicBlock *SuccBlock,
+        unsigned Indent);
+    void printGEPExpression(Value *Ptr, gep_type_iterator I, gep_type_iterator E, bool isArrayType, GetElementPtrInst*);
+
+
+    bool findLoopBranch(BranchInst **LBranch, BasicBlock* CurBlock, BasicBlock* LHeader, std::set<BasicBlock*>*visitSet);
+    std::string GetValueName(Value *Operand);
+    void printBBorLoop(BasicBlock *BB);
+
+    bool compareBlocks(BasicBlock *CurrBlock, BasicBlock *CompBlock, BasicBlock *ImmPostDomm);
+    bool findMatch(BasicBlock *CurrBlock, BasicBlock *CompBlock, BasicBlock *ImmPostDomm);
+  };
+}
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt
new file mode 100644
index 0000000000..979ca63eeb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CMakeLists.txt
@@ -0,0 +1,23 @@
+#add_llvm_target(CBackendCodeGen
+#  CBackend.cpp
+#  )
+#
+#add_subdirectory(TargetInfo)
+add_subdirectory(TargetInfo)
+
+set(LLVM_LINK_COMPONENTS
+  Analysis
+  CBackendInfo
+  CodeGen
+  Core
+  MC
+  ScalarOpts
+  Support
+  Target
+  SelectionDAG
+  TransformUtils
+  )
+
+add_llvm_target(CBackendCodeGen
+  CBackend.cpp
+  )
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h
new file mode 100644
index 0000000000..b6c02fc461
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/CTargetMachine.h
@@ -0,0 +1,58 @@
+//===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the TargetMachine that is used by the C backend.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CTARGETMACHINE_H
+#define CTARGETMACHINE_H
+
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/ADT/Optional.h"
+
+namespace llvm {
+
+struct CTargetMachine : public TargetMachine {
+  
+  // NOTE: Interface change 
+  CTargetMachine(const Target &T, const Triple &TargetTriple,
+		 StringRef CPU, StringRef FS,
+		 const TargetOptions &Options,
+		 Optional<Reloc::Model> RM,
+		 Optional<CodeModel::Model> CM,
+		 CodeGenOpt::Level OL, bool JIT)
+    
+    : TargetMachine(T, "", TargetTriple, CPU, FS, Options) { }
+
+  /// Add passes to the specified pass manager to get the specified file
+  /// emitted.  Typically this will involve several steps of code generation.
+
+  /*bool addPassesToEmitFile(
+    PassManagerBase &PM, raw_pwrite_stream &Out, CodeGenFileType FileType,
+    bool DisableVerify = true, AnalysisID StartBefore = nullptr,
+    AnalysisID StartAfter = nullptr, AnalysisID StopBefore = nullptr, 
+    AnalysisID StopAfter = nullptr) override;
+    //MachineFunctionInitializer *MFInitializer = nullptr) override;
+  */
+
+  virtual bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out,
+                                   raw_pwrite_stream *Out2, CodeGenFileType FileType,
+                                   bool DisableVerify = true,
+				   MachineModuleInfo *MMI = nullptr) override;
+
+};
+
+extern Target TheCBackendTarget;
+
+} // End llvm namespace
+
+
+#endif
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt b/hpvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt
new file mode 100644
index 0000000000..cccd602bd8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/LLVMBuild.txt
@@ -0,0 +1,46 @@
+;===- ./lib/Target/CBackend/LLVMBuild.txt ----------------------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[common]
+subdirectories = TargetInfo
+
+[component_0]
+type = TargetGroup
+name = CBackend
+parent = Target
+
+[component_1]
+type = Library
+name = CBackendCodeGen
+parent = CBackend
+required_libraries = Analysis CBackendInfo CodeGen Core MC ScalarOpts Support Target TransformUtils
+add_to_library_groups = CBackend
+
+;[common]
+;subdirectories = TargetInfo
+;
+;[component_0]
+;type = TargetGroup
+;name = CBackend
+;parent = Target
+;
+;[component_1]
+;type = Library
+;name = CBackendCodeGen
+;parent = CBackend
+;required_libraries = Analysis CBackendInfo CodeGen Core MC Scalar Support Target TransformUtils
+;add_to_library_groups = CBackend
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/Makefile b/hpvm/projects/llvm-cbe/lib/Target/CBackend/Makefile
new file mode 100644
index 0000000000..04e38a061e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/Makefile
@@ -0,0 +1,17 @@
+##===- lib/Target/CBackend/Makefile ------------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL := ../../../../..
+include $(LEVEL)/Makefile.config
+
+LIBRARYNAME := LLVMCBackendCodeGen
+DIRS := TargetInfo
+CompileCommonOpts += -Wno-format
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
new file mode 100644
index 0000000000..63982e4ad6
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp
@@ -0,0 +1,21 @@
+//===-- CBackendTargetInfo.cpp - CBackend Target Implementation -----------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../CTargetMachine.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/TargetRegistry.h"
+using namespace llvm;
+
+Target llvm::TheCBackendTarget;
+
+extern "C" void LLVMInitializeCBackendTargetInfo() {
+  RegisterTarget<> X(TheCBackendTarget, "c", "C-backend", "C-backend");
+}
+
+extern "C" void LLVMInitializeCBackendTargetMC() {}
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp~ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp~
new file mode 100644
index 0000000000..f60b4fb10f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CBackendTargetInfo.cpp~
@@ -0,0 +1,21 @@
+//===-- CBackendTargetInfo.cpp - CBackend Target Implementation -----------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "../CTargetMachine.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/TargetRegistry.h"
+using namespace llvm;
+
+Target llvm::TheCBackendTarget;
+
+extern "C" void LLVMInitializeCBackendTargetInfo() {
+  RegisterTarget<> X(TheCBackendTarget, "c", "C backend");
+}
+
+extern "C" void LLVMInitializeCBackendTargetMC() {}
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt
new file mode 100644
index 0000000000..554dbbb8e4
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/CMakeLists.txt
@@ -0,0 +1,17 @@
+#include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
+#
+#add_llvm_library(LLVMCBackendInfo
+#  CBackendTargetInfo.cpp
+#  )
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
+
+set(LLVM_LINK_COMPONENTS
+  MC
+  ScalarOpts
+  Support
+  Target
+  )
+
+add_llvm_library(LLVMCBackendInfo
+  CBackendTargetInfo.cpp
+  )
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt
new file mode 100644
index 0000000000..1b47d8ebbe
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/LLVMBuild.txt
@@ -0,0 +1,23 @@
+;===- ./lib/Target/CBackend/TargetInfo/LLVMBuild.txt -----------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = CBackendInfo
+parent = CBackend
+required_libraries = MC Support Target
+add_to_library_groups = CBackend
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/Makefile b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/Makefile
new file mode 100644
index 0000000000..84e745bcff
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CBackend/TargetInfo/Makefile
@@ -0,0 +1,14 @@
+##===- lib/Target/CBackend/TargetInfo/Makefile -------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LEVEL := ../../../../../../
+include $(LEVEL)/Makefile.config
+
+LIBRARYNAME := LLVMCBackendInfo
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/lib/Target/CMakeLists.txt b/hpvm/projects/llvm-cbe/lib/Target/CMakeLists.txt
new file mode 100644
index 0000000000..bc216b4365
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(CBackend)
diff --git a/hpvm/projects/llvm-cbe/lib/Target/Makefile b/hpvm/projects/llvm-cbe/lib/Target/Makefile
new file mode 100644
index 0000000000..9b0c253840
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/lib/Target/Makefile
@@ -0,0 +1,14 @@
+##===- projects/sample/lib/sample/Makefile -----------------*- Makefile -*-===##
+
+#
+# Indicate where we are relative to the top of the source tree.
+#
+LEVEL = ../../../..
+include $(LEVEL)/Makefile.config
+
+#
+# List all of the subdirectories that we will compile.
+#
+PARALLEL_DIRS = CBackend
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/test/.cdsenv b/hpvm/projects/llvm-cbe/test/.cdsenv
new file mode 100644
index 0000000000..b4c30a5b5e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/.cdsenv
@@ -0,0 +1,104 @@
+;--------------------------------------------------------------------------
+;
+;This is a sample environment variable file containing the default
+;values for environment variables in Design Framework II products.
+;See the appropriate tool documentation regarding the use and
+;choices for each variable.
+;To customize your defaults, use this file as a template and place
+;a modified version of this file in ../local/.cdsenv.  This
+;local version should typically reflect the values of your system
+;defaults as set by your site coordinator.  To specify more personal
+;defaults, place a modified version of either this or the
+;../local/.cdsenv file into your home directory as .cdsenv.
+;Your ../local/.cdsenv file will be loaded first, followed
+;by the .cdsenv in your home directory, so any values in ~/.cdsenv
+;will override those previously loaded.
+;
+;==========================================================================
+
+;--------------------------------------------------------------------------
+; DLE variables
+;--------------------------------------------------------------------------
+adle mfactorSplit boolean nil
+;adle stopList string "layout"
+;adle viewList string "cmos_sch schematic"
+
+;--------------------------------------------------------------------------
+; Analog Artist Simulation Environment Defaults
+; FORMAT: tool[.partition] varName type value private {choices, minmax} comment
+;--------------------------------------------------------------------------
+asimenv.startup       simulator       string  "hspiceD"
+asimenv.startup       projectDir      string  "~/cadence/simulation"
+asimenv.window        x       int     100
+asimenv.window        y       int     480
+asimenv.plotting      width   int     900
+asimenv.plotting      height  int     700
+asimenv.plotting      x       int     100
+asimenv.plotting      y       int     40
+
+
+;--------------------------------------------------------------------------
+; cdsSpice environment variables
+;--------------------------------------------------------------------------
+;cdsSpice.envOpts    modelPath       string  "~/cadence/models /afs/eos/dist/cadence/local/models"
+
+
+;--------------------------------------------------------------------------
+; ddserv Environment Variables
+;--------------------------------------------------------------------------
+ddserv        showWhatsNew    string  "no"
+
+
+;--------------------------------------------------------------------------
+; Graphics Editor and Design Editor Environment Variables
+;--------------------------------------------------------------------------
+;graphic       drfPath string  "/afs/eos/dist/cadence/local/cdssetup/display.drf"
+
+
+;--------------------------------------------------------------------------
+; hspiceS environment variables
+;--------------------------------------------------------------------------
+;hspiceS.envOpts 	modelPath       string  "~/cadence/models/hspice /afs/eos/dist/cadence/local/models/hspice/public"
+
+
+;--------------------------------------------------------------------------
+;Layout Environment Variables
+;--------------------------------------------------------------------------
+layout        leWindowBBox    string  "((100 160) (1000 860))"
+layout        originMarkersOn boolean nil
+; the snap spacing is set to be a multiple of all the mfgGridResolutions
+; this is just to prevent warning messages; the correct value is set in
+; local/skill/misc/triggers.il
+layout        xSnapSpacing    float   6.0
+layout        ySnapSpacing    float   6.0
+layout        gravityOn       boolean nil
+layout        gravityType     string  ""
+
+
+;--------------------------------------------------------------------------
+; Schematic Editor Environment Variables
+;--------------------------------------------------------------------------
+schematic     browserType     string  "component"
+schematic     schWindowBBox   string  "((130 150) (1030 850))"
+schematic     symWindowBBox   string  "((130 150) (1030 850))"
+
+
+;--------------------------------------------------------------------------
+; spectreS environment variables
+;--------------------------------------------------------------------------
+;spectreS.envOpts    modelPath       string  "~/cadence/models/spectre /afs/eos/dist/cadence/local/models/spectre/public"
+
+
+;--------------------------------------------------------------------------
+; User Preference Defaults
+;--------------------------------------------------------------------------
+ui    showScrollBars  boolean t
+ui    showOptionForms boolean t
+ui    undoLevel       int     10
+
+;--------------------------------------------------------------------------
+; Try to stop the "out of memory" errors in cdsSpice
+;--------------------------------------------------------------------------
+;cdsSpice.init   languageSize    int     1000
+;spectreS.init   languageSize    int     1000
+;hspiceS.init    languageSize    int     1000
diff --git a/hpvm/projects/llvm-cbe/test/.cdsinit b/hpvm/projects/llvm-cbe/test/.cdsinit
new file mode 100644
index 0000000000..005adf7d61
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/.cdsinit
@@ -0,0 +1,120 @@
+;;                        -*-Lisp-*-
+;;
+;; NCSU CDK Copyright (C) 2006 North Carolina State University
+;;
+
+(let 
+    ((LOCAL_CDK_DIR (getShellEnvVar "CDK_DIR")))
+  (if LOCAL_CDK_DIR
+      (if (not (boundp 'NCSU_CDK_LOADED))
+	  (let ()   ; CDK needs to be loaded, so load it.
+
+	    (setq NCSU_CDK_DIR LOCAL_CDK_DIR)
+	    (procedure (prependNCSUCDKInstallPath dir)
+		       (strcat NCSU_CDK_DIR "/" dir))
+	    
+	    (printf "Loading NCSU CDK 1.5.1 customizations...\n")
+	    (setq NCSU_newLayoutMenuLabels t)
+	    (putpropq (hiGetCIWindow) 96 "maxLayerPoolSize")
+            (envSetVal "graphic" "drfPath" 'string
+		       (strcat NCSU_CDK_DIR "/cdssetup/display.drf"))
+	    
+	    (if (isFile (prependNCSUCDKInstallPath "cdssetup/cdsenv"))
+		(envLoadVals 
+		 ?envFile (prependNCSUCDKInstallPath "cdssetup/cdsenv")
+		 ?tool "ALL"))
+
+	    (if (isFile "~/.cdsenv")
+		(envLoadVals 
+		 ?envFile "~/.cdsenv"
+		 ?tool "ALL"))
+
+	    (let
+		((configFileList (list  ; "aaConfig.il" 
+					; "dmConfig.il" 
+	     				; "dciConfig.il"
+					; "metConfig.il"
+					; "sysConfig.il" 
+					; "uiConfig.il" 
+					; "leConfig.il" 
+;				  "schConfig.il"
+				  "streamIn.il"                   
+				  ))
+		 (path (strcat ". ~ "
+			       (prependNCSUCDKInstallPath "skill/config_files")))
+		 (saveSkillPath (getSkillPath))
+		 file )
+	      (setSkillPath path)
+	      (foreach file configFileList
+		       (if (isFile file)
+			   (loadi file)))
+	      (setSkillPath saveSkillPath))
+
+	    (let
+		((bindKeyFileList (list   
+				   "common_bindkeys.il"                
+				   ))
+		 (path (strcat ". ~ "
+			       (prependNCSUCDKInstallPath "cdssetup")))
+		 (saveSkillPath (getSkillPath))
+		 file )
+	      (setSkillPath path)
+	      (foreach file bindKeyFileList
+		       (if (isFile file)
+			   (loadi file)))
+	      (setSkillPath saveSkillPath))
+	    
+	    (sstatus writeProtect nil)
+	    
+	    (let ((skillPathElements
+		   (list "." "~"
+			 (prependNCSUCDKInstallPath "skill")
+			 (prependNCSUCDKInstallPath "skill/cdf")
+			 (prependNCSUCDKInstallPath "skill/menus")
+			 (prependNCSUCDKInstallPath "skill/menus/artist")
+			 (prependNCSUCDKInstallPath "skill/menus/ciw")
+			 (prependNCSUCDKInstallPath "skill/menus/virtuoso")
+			 (prependNCSUCDKInstallPath "skill/misc")
+			 (prependNCSUCDKInstallPath "skill/pcells")
+			 (prependNCSUCDKInstallPath "techfile")))
+		  sPE)
+
+	      (foreach sPE skillPathElements
+		       (setSkillPath (cons sPE (getSkillPath)))))
+	    
+;	    (if (isCallable 'awvSetOptionValue)
+;		(let ()
+;		  (awvSetOptionValue  "hcDisplay" "psb" )
+;		  (awvSetOptionValue  "hcTmpDir"  "/tmp" )))
+	    
+	    (if  (not (boundp 'NCSU_skillAlreadyLoaded))
+		(let ()
+		  (setq NCSU_skillAlreadyLoaded t)
+		  (printf "Loading NCSU SKILL routines...\n")
+		  (load (prependNCSUCDKInstallPath "skill/loadSkill.il"))))
+	    	    
+;	    (asiSetEnvOptionVal  
+;	     (asiGetTool 'spectreS) 
+;	     'modelPath (strcat NCSU_CDK_DIR "/models/spectre/nom/"))
+;	    (asiSetEnvOptionVal  
+;	     (asiGetTool 'hspiceS) 
+;	     'modelPath (strcat NCSU_CDK_DIR "/models/hspice/public/"))
+	    (envSetVal "graphic" "drfPath"  'string
+		       (strcat NCSU_CDK_DIR "/cdssetup/display.drf"))
+
+	    (setq lePlotTemplate 
+		  (prependNCSUCDKInstallPath "cdssetup/layoutPlotTemplate"))
+	    (setq schPlotTemplate
+		  (prependNCSUCDKInstallPath "cdssetup/schPlotTemplate" ))
+	    (unless (getShellEnvVar "SKIP_CDSLIB_MANAGER")
+	      (ddsOpenLibManager))
+	    (printf "Done loading NCSU_CDK customizations.\n")
+	    )
+	(printf "NCSU CDK already loaded.\n")
+	)
+
+    ; you get to this let if NCSU_CDK_DIR is nil
+    (let ()
+      (printf "Environment variable CDK_DIR must be defined to use\n")
+      (printf "the NCSU CDK.  It is not defined in the calling environment\n")
+      (printf "so the NCSU customizations will not be performed!\n"))))
diff --git a/hpvm/projects/llvm-cbe/test/.gitignore b/hpvm/projects/llvm-cbe/test/.gitignore
new file mode 100644
index 0000000000..1b3fac7675
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/.gitignore
@@ -0,0 +1,5 @@
+*.ll
+*.exe
+*.cbe
+*.cexe
+*.cbe.c
diff --git a/hpvm/projects/llvm-cbe/test/.log b/hpvm/projects/llvm-cbe/test/.log
new file mode 100644
index 0000000000..f9c13079e1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/.log
@@ -0,0 +1 @@
+Args: ../../../build/bin/llvm-cbe test003_O0.ll -debug 
diff --git a/hpvm/projects/llvm-cbe/test/APInt-C.cpp b/hpvm/projects/llvm-cbe/test/APInt-C.cpp
new file mode 100644
index 0000000000..0dec791c14
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/APInt-C.cpp
@@ -0,0 +1,535 @@
+// This file is a part of Julia. License is MIT: http://julialang.org/license
+
+#include "llvm-version.h"
+#include <llvm/ADT/ArrayRef.h>
+#include <llvm/ADT/APInt.h>
+#include <llvm/ADT/APFloat.h>
+#include <llvm/Support/MathExtras.h>
+
+#include "APInt-C.h"
+#include "julia.h"
+
+using namespace llvm;
+
+#if JL_LLVM_VERSION >= 30900
+inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
+    return alignTo(Value, Align, Skew);
+}
+#endif
+
+/* create "APInt s" from "integerPart *ps" */
+#define CREATE(s) \
+    APInt s; \
+    if ((numbits % integerPartWidth) != 0) { \
+        /* use LLT_ALIGN to round the memory area up to the nearest integerPart-sized chunk */ \
+        unsigned nbytes = RoundUpToAlignment(numbits, integerPartWidth) / host_char_bit; \
+        integerPart *data_a64 = (integerPart*)alloca(nbytes); \
+        /* TODO: this memcpy assumes little-endian,
+         * for big-endian, need to align the copy to the other end */ \
+        memcpy(data_a64, p##s, RoundUpToAlignment(numbits, host_char_bit) / host_char_bit); \
+        s = APInt(numbits, makeArrayRef(data_a64, nbytes / sizeof(integerPart))); \
+    } \
+    else { \
+        s = APInt(numbits, makeArrayRef(p##s, numbits / integerPartWidth)); \
+    }
+
+/* assign to "integerPart *pr" from "APInt a" */
+#define ASSIGN(r, a) \
+    if (numbits <= 8) \
+        *(uint8_t*)p##r = a.getZExtValue(); \
+    else if (numbits <= 16) \
+        *(uint16_t*)p##r = a.getZExtValue(); \
+    else if (numbits <= 32) \
+        *(uint32_t*)p##r = a.getZExtValue(); \
+    else if (numbits <= 64) \
+        *(uint64_t*)p##r = a.getZExtValue(); \
+    else \
+        memcpy(p##r, a.getRawData(), RoundUpToAlignment(numbits, host_char_bit) / host_char_bit); \
+
+extern "C" JL_DLLEXPORT
+void LLVMNeg(unsigned numbits, integerPart *pa, integerPart *pr) {
+    APInt z(numbits, 0);
+    CREATE(a)
+    z -= a;
+    ASSIGN(r, z)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMAdd(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a += b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMSub(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a -= b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMMul(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a *= b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMSDiv(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.sdiv(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMUDiv(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.udiv(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMSRem(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.srem(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMURem(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.urem(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpEQ(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.eq(b);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpNE(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.ne(b);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpSLT(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.slt(b);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpULT(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.ult(b);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpSLE(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.sle(b);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMICmpULE(unsigned numbits, integerPart *pa, integerPart *pb) {
+    CREATE(a)
+    CREATE(b)
+    return a.ule(b);
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMAnd(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a &= b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMOr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a |= b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMXor(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a ^= b;
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMShl(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.shl(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMLShr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.lshr(b);
+    ASSIGN(r, a)
+}
+extern "C" JL_DLLEXPORT
+void LLVMAShr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.ashr(b);
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMFlipAllBits(unsigned numbits, integerPart *pa, integerPart *pr) {
+    CREATE(a)
+    a.flipAllBits();
+    ASSIGN(r, a)
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMAdd_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.uadd_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMAdd_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.sadd_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMSub_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.usub_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMSub_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.ssub_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMMul_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.smul_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMMul_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.umul_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMDiv_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    bool Overflow;
+    a = a.sdiv_ov(b, Overflow);
+    ASSIGN(r, a)
+    return Overflow;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMDiv_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.udiv(b);
+    ASSIGN(r, a)
+    // unsigned division cannot overflow
+    return false;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMRem_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.srem(b);
+    ASSIGN(r, a)
+    // signed remainder cannot overflow
+    return false;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMRem_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    a = a.urem(b);
+    ASSIGN(r, a)
+    // unsigned remainder cannot overflow
+    return false;
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMByteSwap(unsigned numbits, integerPart *pa, integerPart *pr) {
+    CREATE(a)
+    a = a.byteSwap();
+    ASSIGN(r, a)
+}
+
+void LLVMFPtoInt(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr, bool isSigned, bool *isExact) {
+    double Val;
+    if (numbits == 32)
+        Val = *(float*)pa;
+    else if (numbits == 64)
+        Val = *(double*)pa;
+    else
+        jl_error("FPtoSI: runtime floating point intrinsics are not implemented for bit sizes other than 32 and 64");
+    unsigned onumbytes = RoundUpToAlignment(onumbits, host_char_bit) / host_char_bit;
+    if (onumbits <= 64) { // fast-path, if possible
+        if (isSigned) {
+            int64_t ia = Val;
+            memcpy(pr, &ia, onumbytes); // TODO: assumes little-endian
+            if (isExact) {
+                // check whether the conversion was lossless
+                int64_t ia2 = ia < 0 ? -1 : 0;
+                memcpy(&ia2, pr, onumbytes);
+                *isExact = (Val == (double)ia2 && ia == ia2);
+            }
+        }
+        else {
+            uint64_t ia = Val;
+            memcpy(pr, &ia, onumbytes); // TODO: assumes little-endian
+            if (isExact) {
+                // check whether the conversion was lossless
+                uint64_t ia2 = 0;
+                memcpy(&ia2, pr, onumbytes);
+                *isExact = (Val == (double)ia2 && ia == ia2);
+            }
+        }
+    }
+    else {
+        APFloat a(Val);
+        bool isVeryExact;
+        APFloat::roundingMode rounding_mode = APFloat::rmNearestTiesToEven;
+        unsigned nbytes = RoundUpToAlignment(onumbits, integerPartWidth) / host_char_bit;
+        integerPart *parts = (integerPart*)alloca(nbytes);
+        APFloat::opStatus status = a.convertToInteger(parts, onumbits, isSigned, rounding_mode, &isVeryExact);
+        memcpy(pr, parts, onumbytes);
+        if (isExact)
+            *isExact = (status == APFloat::opOK);
+    }
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMFPtoSI(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    LLVMFPtoInt(numbits, pa, onumbits, pr, true, NULL);
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMFPtoUI(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    LLVMFPtoInt(numbits, pa, onumbits, pr, false, NULL);
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMFPtoSI_exact(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    bool isExact;
+    LLVMFPtoInt(numbits, pa, onumbits, pr, true, &isExact);
+    return isExact;
+}
+
+extern "C" JL_DLLEXPORT
+int LLVMFPtoUI_exact(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    bool isExact;
+    LLVMFPtoInt(numbits, pa, onumbits, pr, false, &isExact);
+    return isExact;
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMSItoFP(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    CREATE(a)
+    double val = a.roundToDouble(true);
+    if (onumbits == 32)
+        *(float*)pr = val;
+    else if (onumbits == 64)
+        *(double*)pr = val;
+    else
+        jl_error("SItoFP: runtime floating point intrinsics are not implemented for bit sizes other than 32 and 64");
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMUItoFP(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    CREATE(a)
+    double val = a.roundToDouble(false);
+    if (onumbits == 32)
+        *(float*)pr = val;
+    else if (onumbits == 64)
+        *(double*)pr = val;
+    else
+        jl_error("UItoFP: runtime floating point intrinsics are not implemented for bit sizes other than 32 and 64");
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMSExt(unsigned inumbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    assert(inumbits < onumbits);
+    unsigned inumbytes = RoundUpToAlignment(inumbits, host_char_bit) / host_char_bit;
+    unsigned onumbytes = RoundUpToAlignment(onumbits, host_char_bit) / host_char_bit;
+    int bits = (0 - inumbits) % host_char_bit;
+    int signbit = (inumbits - 1) % host_char_bit;
+    int sign = ((unsigned char*)pa)[inumbytes - 1] & (1 << signbit) ? -1 : 0;
+    // copy over the input bytes
+    memcpy(pr, pa, inumbytes);
+    if (bits) {
+        // sign-extend the partial byte
+        ((signed char*)pr)[inumbytes - 1] = ((signed char*)pa)[inumbytes - 1] << bits >> bits;
+    }
+    // sign-extend the rest of the bytes
+    memset((char*)pr + inumbytes, sign, onumbytes - inumbytes);
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMZExt(unsigned inumbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    assert(inumbits < onumbits);
+    unsigned inumbytes = RoundUpToAlignment(inumbits, host_char_bit) / host_char_bit;
+    unsigned onumbytes = RoundUpToAlignment(onumbits, host_char_bit) / host_char_bit;
+    int bits = (0 - inumbits) % host_char_bit;
+    // copy over the input bytes
+    memcpy(pr, pa, inumbytes);
+    if (bits) {
+        // zero the remaining bits of the partial byte
+        ((unsigned char*)pr)[inumbytes - 1] = ((unsigned char*)pa)[inumbytes - 1] << bits >> bits;
+    }
+    // zero-extend the rest of the bytes
+    memset((char*)pr + inumbytes, 0, onumbytes - inumbytes);
+}
+
+extern "C" JL_DLLEXPORT
+void LLVMTrunc(unsigned inumbits, integerPart *pa, unsigned onumbits, integerPart *pr) {
+    assert(inumbits > onumbits);
+    unsigned onumbytes = RoundUpToAlignment(onumbits, host_char_bit) / host_char_bit;
+    memcpy(pr, pa, onumbytes);
+}
+
+extern "C" JL_DLLEXPORT
+unsigned countTrailingZeros_8(uint8_t Val) {
+#if JL_LLVM_VERSION >= 30500
+    return countTrailingZeros(Val);
+#else
+    return CountTrailingZeros_32(Val);
+#endif
+}
+
+extern "C" JL_DLLEXPORT
+unsigned countTrailingZeros_16(uint16_t Val) {
+#if JL_LLVM_VERSION >= 30500
+    return countTrailingZeros(Val);
+#else
+    return CountTrailingZeros_32(Val);
+#endif
+}
+
+extern "C" JL_DLLEXPORT
+unsigned countTrailingZeros_32(uint32_t Val) {
+#if JL_LLVM_VERSION >= 30500
+    return countTrailingZeros(Val);
+#else
+    return CountTrailingZeros_32(Val);
+#endif
+}
+
+extern "C" JL_DLLEXPORT
+unsigned countTrailingZeros_64(uint64_t Val) {
+#if JL_LLVM_VERSION >= 30500
+    return countTrailingZeros(Val);
+#else
+    return CountTrailingZeros_64(Val);
+#endif
+}
+
+extern "C" JL_DLLEXPORT
+void jl_LLVMSMod(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    CREATE(a)
+    CREATE(b)
+    APInt r = a.srem(b);
+    if (a.isNegative() != b.isNegative()) {
+        r = (b + r).srem(b);
+    }
+    ASSIGN(r, r)
+}
+
+extern "C" JL_DLLEXPORT
+void jl_LLVMFlipSign(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr) {
+    unsigned numbytes = RoundUpToAlignment(numbits, host_char_bit) / host_char_bit;
+    int signbit = (numbits - 1) % host_char_bit;
+    int sign = ((unsigned char*)pa)[numbytes - 1] & (1 << signbit) ? -1 : 0;
+    if (sign)
+        LLVMNeg(numbits, pa, pr);
+    else
+        memcpy(pr, pa,  numbytes);
+}
+
+extern "C" JL_DLLEXPORT
+unsigned LLVMCountPopulation(unsigned numbits, integerPart *pa) {
+    CREATE(a)
+    return a.countPopulation();
+}
+
+extern "C" JL_DLLEXPORT
+unsigned LLVMCountTrailingOnes(unsigned numbits, integerPart *pa) {
+    CREATE(a)
+    return a.countTrailingOnes();
+}
+
+extern "C" JL_DLLEXPORT
+unsigned LLVMCountTrailingZeros(unsigned numbits, integerPart *pa) {
+    CREATE(a)
+    return a.countTrailingZeros();
+}
+
+extern "C" JL_DLLEXPORT
+unsigned LLVMCountLeadingOnes(unsigned numbits, integerPart *pa) {
+    CREATE(a)
+    return a.countLeadingOnes();
+}
+
+extern "C" JL_DLLEXPORT
+unsigned LLVMCountLeadingZeros(unsigned numbits, integerPart *pa) {
+    CREATE(a)
+    return a.countLeadingZeros();
+}
\ No newline at end of file
diff --git a/hpvm/projects/llvm-cbe/test/APInt-C.h b/hpvm/projects/llvm-cbe/test/APInt-C.h
new file mode 100644
index 0000000000..793bc12300
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/APInt-C.h
@@ -0,0 +1,89 @@
+// This file is a part of Julia. License is MIT: http://julialang.org/license
+
+#ifndef APINT_C_H
+#define APINT_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "dtypes.h"
+
+#ifdef LLVM_VERSION_MAJOR
+using llvm::integerPart;
+#else
+typedef void integerPart;
+#endif
+
+JL_DLLEXPORT void LLVMNeg(unsigned numbits, integerPart *pa, integerPart *pr);
+JL_DLLEXPORT void LLVMByteSwap(unsigned numbits, integerPart *pa, integerPart *pr);
+
+JL_DLLEXPORT void LLVMAdd(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMSub(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMMul(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMSDiv(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMUDiv(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMSRem(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMURem(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+
+JL_DLLEXPORT void LLVMAnd(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMOr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMXor(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMShl(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMLShr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMAShr(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void LLVMFlipAllBits(unsigned numbits, integerPart *pa, integerPart *pr);
+
+JL_DLLEXPORT int LLVMICmpEQ(unsigned numbits, integerPart *pa, integerPart *pr);
+JL_DLLEXPORT int LLVMICmpNE(unsigned numbits, integerPart *pa, integerPart *pb);
+JL_DLLEXPORT int LLVMICmpSLT(unsigned numbits, integerPart *pa, integerPart *pb);
+JL_DLLEXPORT int LLVMICmpULT(unsigned numbits, integerPart *pa, integerPart *pb);
+JL_DLLEXPORT int LLVMICmpSLE(unsigned numbits, integerPart *pa, integerPart *pb);
+JL_DLLEXPORT int LLVMICmpULE(unsigned numbits, integerPart *pa, integerPart *pb);
+
+JL_DLLEXPORT int LLVMAdd_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMAdd_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMSub_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMSub_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMMul_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMMul_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMDiv_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMDiv_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMRem_sov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT int LLVMRem_uov(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+
+JL_DLLEXPORT unsigned LLVMCountPopulation(unsigned numbits, integerPart *pa);
+JL_DLLEXPORT unsigned LLVMCountTrailingOnes(unsigned numbits, integerPart *pa);
+JL_DLLEXPORT unsigned LLVMCountTrailingZeros(unsigned numbits, integerPart *pa);
+JL_DLLEXPORT unsigned LLVMCountLeadingOnes(unsigned numbits, integerPart *pa);
+JL_DLLEXPORT unsigned LLVMCountLeadingZeros(unsigned numbits, integerPart *pa);
+
+JL_DLLEXPORT void LLVMFPtoSI(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMFPtoUI(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMSItoFP(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMUItoFP(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMSExt(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMZExt(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT void LLVMTrunc(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+
+JL_DLLEXPORT int LLVMFPtoSI_exact(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+JL_DLLEXPORT int LLVMFPtoUI_exact(unsigned numbits, integerPart *pa, unsigned onumbits, integerPart *pr);
+
+JL_DLLEXPORT void jl_LLVMSMod(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+JL_DLLEXPORT void jl_LLVMFlipSign(unsigned numbits, integerPart *pa, integerPart *pb, integerPart *pr);
+
+JL_DLLEXPORT unsigned countTrailingZeros_8(uint8_t Val);
+JL_DLLEXPORT unsigned countTrailingZeros_16(uint16_t Val);
+JL_DLLEXPORT unsigned countTrailingZeros_32(uint32_t Val);
+JL_DLLEXPORT unsigned countTrailingZeros_64(uint64_t Val);
+
+//uint8_t getSwappedBytes_8(uint8_t Value); // no-op
+//uint16_t getSwappedBytes_16(uint16_t Value);
+//uint32_t getSwappedBytes_32(uint32_t Value);
+//uint64_t getSwappedBytes_64(uint64_t Value);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/hpvm/projects/llvm-cbe/test/CBEWarningsErrors.txt b/hpvm/projects/llvm-cbe/test/CBEWarningsErrors.txt
new file mode 100644
index 0000000000..d2dfdfffb8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/CBEWarningsErrors.txt
@@ -0,0 +1,31 @@
+CBE Warnings/Errors
+
+1. "warning: conflicting types for built-in function 
+
+‘memcpy’ [enabled by default]"
+
+Affecting:
+test093.cbe.c:126:23
+test095.cbe.c:121:23
+
+This warning is generated when an array is declared and 
+
+initialized in the same line. 
+
+/*-----------------------*/
+
+2.  "error: cannot convert to a pointer type"
+
+Affecting:
+test089.cbe.c:158:3
+test091.cbe.c:143:3
+
+/*-----------------------*/
+
+3.  "warning: cast from pointer to integer of different size 
+
+[-Wpointer-to-int-cast]"
+
+Affecting: 
+test101.cbe.c:214:10
+test101.cbe.c:214:43
diff --git a/hpvm/projects/llvm-cbe/test/Makefile b/hpvm/projects/llvm-cbe/test/Makefile
new file mode 100644
index 0000000000..0551aaf4e2
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/Makefile
@@ -0,0 +1,80 @@
+#===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===----------------------------------------------------------------------===//
+#
+# Makefile for CBE test cases. Currently uses manual file identification.
+#
+#===----------------------------------------------------------------------===//
+
+LLVMToolDir ?= ../../../build/bin
+
+PYTHON = python
+CC = gcc
+CLANG = /shared/workspace/aejjeh/clang/bin/clang 
+CPPFLAGS = -Wall -Wno-unused-function -Wno-parentheses-equality -Wno-unused-variable -Wno-incompatible-library-redeclaration
+FILES := $(patsubst %.c,%,$(filter-out %.cbe.c,$(wildcard *.c)))
+
+all: cexec tollvm buildcbe
+
+.PHONY: clean cexec buildcbe buildcbe* tollvm tollvm* all
+.SECONDARY:
+
+#Make each level of Optimization in one call
+tollvm: tollvmO0 tollvmO1 tollvmO2 tollvmO3
+tollvmO0: $(addsuffix _O0.ll,$(FILES))
+tollvmO1: $(addsuffix _O1.ll,$(FILES))
+tollvmO2: $(addsuffix _O2.ll,$(FILES))
+tollvmO3: $(addsuffix _O3.ll,$(FILES))
+%_O0.ll: %.c
+	$(CLANG) $(CPPFLAGS) $< -emit-llvm -I./ -S -O0 -o $@
+%_O1.ll: %.c
+	$(CLANG) $(CPPFLAGS) $< -emit-llvm -I./ -S -O1 -o $@
+%_O2.ll: %.c
+	$(CLANG) $(CPPFLAGS) $< -emit-llvm -I./ -S -O2 -o $@
+%_O3.ll: %.c
+	$(CLANG) $(CPPFLAGS) $< -emit-llvm -I./ -S -O3 -o $@
+
+#tocbe: tocbeO0 tocbeO1 tocbeO2 tocbeO3
+#tocbeO%: tollvmO%
+#	rm -rf *_O$*.cbe.c
+#	for name in $(FILES); do\
+#		$(LLVMToolDir)/llvm-cbe $${name}_O$*.ll -debug >& $${name}_O$*.log; \
+#	done
+#
+#%_O0.cbe.c: tocbeO0
+#	@echo built: $@
+#%_O1.cbe.c: tocbeO1
+#	@echo built: $@
+#%_O2.cbe.c: tocbeO2
+#	@echo built: $@
+#%_O3.cbe.c: tocbeO3
+#	@echo built: $@
+#
+#buildcbe: buildcbeO0 buildcbeO1 buildcbeO2 buildcbeO3
+#buildcbeO0 : $(addsuffix _O0.cbe,$(FILES))
+#buildcbeO1 : $(addsuffix _O1.cbe,$(FILES))
+#buildcbeO2 : $(addsuffix _O2.cbe,$(FILES))
+#buildcbeO3 : $(addsuffix _O3.cbe,$(FILES))
+#%.cbe : %.cbe.c
+#	$(CC) $(CPPFLAGS) -I./ -o $@ -O$(shell echo $* | sed 's/^.*_O\([0-9]\)$$/\1/') $<
+
+#Make C-Based Executables
+cexec: $(addsuffix .cexe,$(FILES))
+%.cexe: %.c
+	$(CC) $(CPPFLAGS) -I./ -o $@ $<
+
+test: all
+	LLVMToolDir=$(LLVMToolDir) $(PYTHON) testFile.py
+
+#Remove all .ll, .cbe.c, and .cbe files
+clean:
+	rm -rf *.ll
+	rm -rf *.cbe
+	rm -rf *.cexe
+	rm -rf *.cbe.c
+	rm -rf *.log
diff --git a/hpvm/projects/llvm-cbe/test/cds.lib b/hpvm/projects/llvm-cbe/test/cds.lib
new file mode 100644
index 0000000000..a82dccf022
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cds.lib
@@ -0,0 +1,13 @@
+SOFTINCLUDE $SYSTEM_CDS_LIB_DIR/cds.lib
+DEFINE      basic                   $CDK_DIR/lib/basic
+DEFINE      NCSU_Analog_Parts 	    $CDK_DIR/lib/NCSU_Analog_Parts
+DEFINE      NCSU_Digital_Parts 	    $CDK_DIR/lib/NCSU_Digital_Parts
+--DEFINE      MOSIS_Layout_Test       $CDK_DIR/lib/MOSIS_Layout_Test
+DEFINE      NCSU_TechLib_ami06      $CDK_DIR/lib/NCSU_TechLib_ami06
+DEFINE      NCSU_TechLib_ami16      $CDK_DIR/lib/NCSU_TechLib_ami16
+DEFINE      NCSU_TechLib_hp06       $CDK_DIR/lib/NCSU_TechLib_hp06
+DEFINE      NCSU_TechLib_tsmc02     $CDK_DIR/lib/NCSU_TechLib_tsmc02
+DEFINE      NCSU_TechLib_tsmc02d    $CDK_DIR/lib/NCSU_TechLib_tsmc02d
+DEFINE      NCSU_TechLib_tsmc03     $CDK_DIR/lib/NCSU_TechLib_tsmc03
+DEFINE      NCSU_TechLib_tsmc03d    $CDK_DIR/lib/NCSU_TechLib_tsmc03d
+DEFINE      NCSU_TechLib_tsmc04_4M2P    $CDK_DIR/lib/NCSU_TechLib_tsmc04_4M2P
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test001.c b/hpvm/projects/llvm-cbe/test/cfiles/test001.c
new file mode 100644
index 0000000000..817d7ca8ca
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test001.c
@@ -0,0 +1,17 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will return the correct number.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    return 6;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test002.c b/hpvm/projects/llvm-cbe/test/cfiles/test002.c
new file mode 100644
index 0000000000..9af3c34ee8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test002.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a for loop correctly.
+// *TW 
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    int i, x = 0;
+    for (i = 0; i < 6; i++)
+        ++x;
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test003.c b/hpvm/projects/llvm-cbe/test/cfiles/test003.c
new file mode 100644
index 0000000000..4aa8eb6bfb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test003.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a while loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 0, x = 0;
+    while (i < 6) {
+        ++x;
+        ++i;
+    }
+    return x;
+} 
+   
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test004.c b/hpvm/projects/llvm-cbe/test/cfiles/test004.c
new file mode 100644
index 0000000000..ba619f09bb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test004.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an if/else statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int x = 3;
+    x += 3;
+    if (x == 6)
+        return x;
+    else
+        return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test005.c b/hpvm/projects/llvm-cbe/test/cfiles/test005.c
new file mode 100644
index 0000000000..8b9323a97e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test005.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested for loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int i, j, x = 0;
+    for (i = 0; i < 3; i++)
+        for (j = 0; j < 2; j++)
+            ++x;
+            
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test006.c b/hpvm/projects/llvm-cbe/test/cfiles/test006.c
new file mode 100644
index 0000000000..b513d75d4a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test006.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested while loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int i = 0, j = 0, x = 0;
+    while (i < 6) {
+        while (j < 6) {
+            ++x;
+            ++j;
+        }
+      ++i;
+    }
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test007.c b/hpvm/projects/llvm-cbe/test/cfiles/test007.c
new file mode 100644
index 0000000000..50c895d181
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test007.c
@@ -0,0 +1,33 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a switch statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char var = 'x';
+   
+   switch (var) {
+      case 'z' :
+         return 0;
+         break;
+      case 'y' :
+         return 1;
+         break;
+      case 'x' :
+         return 6;
+         break;
+      case 'w' :
+         return 7;
+         break;
+      default :
+         return 100;
+   }
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test008.c b/hpvm/projects/llvm-cbe/test/cfiles/test008.c
new file mode 100644
index 0000000000..283b8f73ba
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test008.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a struct correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+struct test {
+   int var1;
+   int var2;
+   int var3;
+};
+
+int main() {
+
+   struct test variable;
+
+   variable.var2 = 5;
+   variable.var3 = 6;
+   variable.var1 = 9;
+    
+   return variable.var3;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test009.c b/hpvm/projects/llvm-cbe/test/cfiles/test009.c
new file mode 100644
index 0000000000..a46509105c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test009.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an array correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int example[10];
+    int i;
+       for (i = 0;i < 10; ++i) {
+        example[i] = i;
+       }
+       return example[6];
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test010.c b/hpvm/projects/llvm-cbe/test/cfiles/test010.c
new file mode 100644
index 0000000000..e3841e64d3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test010.c
@@ -0,0 +1,43 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested switch statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char var = 'x', var2;
+   switch (var) {
+      case 'z' :
+         return 0;
+         break;
+      case 'y' :
+         return 1;
+         break;
+      case 'x' :
+         var2 = 'b';
+    
+         switch (var2) {
+            case 'a' :
+               return 10;
+               break;
+            case 'b' :
+               return 6;
+               break;
+            default :
+               return 18;
+         }
+
+         case 'w' :
+            return 7;
+            break;
+         default :
+            return 100;
+   }
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test011.c b/hpvm/projects/llvm-cbe/test/cfiles/test011.c
new file mode 100644
index 0000000000..aa0ee7229f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test011.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle addition between two variables.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 2, t = 4, x = 0;
+    x = i+t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test012.c b/hpvm/projects/llvm-cbe/test/cfiles/test012.c
new file mode 100644
index 0000000000..403c635686
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test012.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle subtraction between two variables.
+//  *TW
+//===----------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 8, t = 2, x = 0;
+    x = i-t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test013.c b/hpvm/projects/llvm-cbe/test/cfiles/test013.c
new file mode 100644
index 0000000000..444d4676b7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test013.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle multiplication between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 3, t = 2, x = 0;
+    x = i*t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test014.c b/hpvm/projects/llvm-cbe/test/cfiles/test014.c
new file mode 100644
index 0000000000..e1dc6931f9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test014.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle division between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 30, t = 5, x = 0;
+    x = i/t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test015.c b/hpvm/projects/llvm-cbe/test/cfiles/test015.c
new file mode 100644
index 0000000000..e4c2a5c03b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test015.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle modulus between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 26, t = 20, x = 0;
+    x = i%t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test016.c b/hpvm/projects/llvm-cbe/test/cfiles/test016.c
new file mode 100644
index 0000000000..0841840ebc
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test016.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the unary plus (+a) operator.
+// Increases the amount of space the char data type to 4.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    char ch;
+
+    if(sizeof(+ch) == 4) {
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test017.c b/hpvm/projects/llvm-cbe/test/cfiles/test017.c
new file mode 100644
index 0000000000..0535862b30
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test017.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the unary minus (-a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main() {
+
+    signed int a = 10;
+    signed int b = -a;
+
+    if(b == -10) {
+        return 6;
+    }
+        return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test018.c b/hpvm/projects/llvm-cbe/test/cfiles/test018.c
new file mode 100644
index 0000000000..c02efa9d0e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test018.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the incremental (++a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 5;
+
+    ++x;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test019.c b/hpvm/projects/llvm-cbe/test/cfiles/test019.c
new file mode 100644
index 0000000000..1975bb9c5b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test019.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the decremental (--a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 7;
+   
+    --x;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test020.c b/hpvm/projects/llvm-cbe/test/cfiles/test020.c
new file mode 100644
index 0000000000..a68801708d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test020.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// greater than (>) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 3;
+
+    if(x > y){
+        return x;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test021.c b/hpvm/projects/llvm-cbe/test/cfiles/test021.c
new file mode 100644
index 0000000000..93eed31d9b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test021.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// greater than or equal (>=) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x >= y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test022.c b/hpvm/projects/llvm-cbe/test/cfiles/test022.c
new file mode 100644
index 0000000000..895069a83b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test022.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// less than (<) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 12;
+
+
+    if(x < y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test023.c b/hpvm/projects/llvm-cbe/test/cfiles/test023.c
new file mode 100644
index 0000000000..52348d3e16
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test023.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// less than or equal to (=<) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x <= y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test024.c b/hpvm/projects/llvm-cbe/test/cfiles/test024.c
new file mode 100644
index 0000000000..2c90879b87
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test024.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// equal (==) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x == y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test025.c b/hpvm/projects/llvm-cbe/test/cfiles/test025.c
new file mode 100644
index 0000000000..153cb40134
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test025.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// not equal (!=) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 2;
+
+    if(x != y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test026.c b/hpvm/projects/llvm-cbe/test/cfiles/test026.c
new file mode 100644
index 0000000000..874c06957d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test026.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (&&) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+int x = 6;
+int y = 6;
+int z = 6;
+
+    if(x == y && x == z){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test027.c b/hpvm/projects/llvm-cbe/test/cfiles/test027.c
new file mode 100644
index 0000000000..d1322597c3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test027.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (||) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+    int z = 6;
+
+    if(x == y || x != z){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test028.c b/hpvm/projects/llvm-cbe/test/cfiles/test028.c
new file mode 100644
index 0000000000..ce77d792f3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test028.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// NOT (~a) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = -7;
+    unsigned int b = 0;
+
+    b = ~a;
+    if( b == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test029.c b/hpvm/projects/llvm-cbe/test/cfiles/test029.c
new file mode 100644
index 0000000000..b7ac93ecf5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test029.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (a&b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;  //0110
+    unsigned int b = 15; //1111
+    unsigned int c = 0;
+
+    c = a&b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test030.c b/hpvm/projects/llvm-cbe/test/cfiles/test030.c
new file mode 100644
index 0000000000..333ce5aa01
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test030.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (a&b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+unsigned int a = 2;
+unsigned int b = 4;
+unsigned int c = 0;
+
+    c = a|b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test031.c b/hpvm/projects/llvm-cbe/test/cfiles/test031.c
new file mode 100644
index 0000000000..69d0dab0e1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test031.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// XOR (a^b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 9;  //1001
+    unsigned int b = 15; //1111
+    unsigned int c = 0;
+
+
+    c = a^b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test032.c b/hpvm/projects/llvm-cbe/test/cfiles/test032.c
new file mode 100644
index 0000000000..ae63e2c4d2
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test032.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Left (a<<b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 3;  //0011
+    unsigned int b = 0;
+
+
+    b = a << 1;  //0110
+    if(b == 6){
+          return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test033.c b/hpvm/projects/llvm-cbe/test/cfiles/test033.c
new file mode 100644
index 0000000000..1bb96d21bd
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test033.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Right (a>>b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 13;  //1100
+    unsigned int b = 0;
+
+    b = a >> 1;  //0110
+    if(b == 6){
+          return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test034.c b/hpvm/projects/llvm-cbe/test/cfiles/test034.c
new file mode 100644
index 0000000000..dd9106b0be
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test034.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Addition Assignment(a+=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 3;
+    int b = 3;
+ 
+    a+=b;
+    if(a == 6){
+          return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test035.c b/hpvm/projects/llvm-cbe/test/cfiles/test035.c
new file mode 100644
index 0000000000..d1c0ae391f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test035.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Subtraction Assignment(a-=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 9;
+    int b = 3;
+
+    a-=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test036.c b/hpvm/projects/llvm-cbe/test/cfiles/test036.c
new file mode 100644
index 0000000000..d8d5a1957c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test036.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Multiplication Assignment(a*=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+int main(){
+
+    int a = 2;
+    int b = 3;
+
+    a*=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test037.c b/hpvm/projects/llvm-cbe/test/cfiles/test037.c
new file mode 100644
index 0000000000..5bf5ee705a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test037.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Division Assignment(a/=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 30;
+    int b = 5;
+
+    a/=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test038.c b/hpvm/projects/llvm-cbe/test/cfiles/test038.c
new file mode 100644
index 0000000000..efbe234607
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test038.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Modulus Assignment(a%=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 20;
+    int b = 14;
+
+    a%=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test039.c b/hpvm/projects/llvm-cbe/test/cfiles/test039.c
new file mode 100644
index 0000000000..112d7f6970
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test039.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (a&=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;  //0110
+    unsigned int b = 15; //1111
+
+    a&=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test040.c b/hpvm/projects/llvm-cbe/test/cfiles/test040.c
new file mode 100644
index 0000000000..5285fb73ec
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test040.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (a|=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 2;
+    unsigned int b = 4;
+
+    a|=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test041.c b/hpvm/projects/llvm-cbe/test/cfiles/test041.c
new file mode 100644
index 0000000000..f04e682356
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test041.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// XOR (a^=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 9;  //1001
+    unsigned int b = 15; //1111
+
+    a^=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test042.c b/hpvm/projects/llvm-cbe/test/cfiles/test042.c
new file mode 100644
index 0000000000..5b4f12d808
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test042.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Left (a<<=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 3;  //0011
+
+    a <<= 1;  //0110
+    if( a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test043.c b/hpvm/projects/llvm-cbe/test/cfiles/test043.c
new file mode 100644
index 0000000000..3b42179304
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test043.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Right (a>>=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 13;  //1100
+
+    a >>= 1;  //0110
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test044.c b/hpvm/projects/llvm-cbe/test/cfiles/test044.c
new file mode 100644
index 0000000000..dbb9d31ad9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test044.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    char a = 'A' ; //65
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test045.c b/hpvm/projects/llvm-cbe/test/cfiles/test045.c
new file mode 100644
index 0000000000..50aaa8effc
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test045.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning a signed char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    signed char a = 'A';
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test046.c b/hpvm/projects/llvm-cbe/test/cfiles/test046.c
new file mode 100644
index 0000000000..ea57085caf
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test046.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning an unsigned char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned char a = 'A';
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test047.c b/hpvm/projects/llvm-cbe/test/cfiles/test047.c
new file mode 100644
index 0000000000..2b90d14c7f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test047.c
@@ -0,0 +1,19 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+	int a = 6;
+        return a;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test048.c b/hpvm/projects/llvm-cbe/test/cfiles/test048.c
new file mode 100644
index 0000000000..c30694ff50
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test048.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a short int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    short int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test049.c b/hpvm/projects/llvm-cbe/test/cfiles/test049.c
new file mode 100644
index 0000000000..bb4a080198
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test049.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a long int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    long int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test050.c b/hpvm/projects/llvm-cbe/test/cfiles/test050.c
new file mode 100644
index 0000000000..f69c7cee23
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test050.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a signed int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    signed int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test051.c b/hpvm/projects/llvm-cbe/test/cfiles/test051.c
new file mode 100644
index 0000000000..61f1e03d57
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test051.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a unsigned int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test052.c b/hpvm/projects/llvm-cbe/test/cfiles/test052.c
new file mode 100644
index 0000000000..48e1ce67f8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test052.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a float.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    float a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test053.c b/hpvm/projects/llvm-cbe/test/cfiles/test053.c
new file mode 100644
index 0000000000..86dd5691a7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test053.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a double.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    double a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test054.c b/hpvm/projects/llvm-cbe/test/cfiles/test054.c
new file mode 100644
index 0000000000..4c86601412
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test054.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long double.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long double a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test055.c b/hpvm/projects/llvm-cbe/test/cfiles/test055.c
new file mode 100644
index 0000000000..cd7891acfe
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test055.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test056.c b/hpvm/projects/llvm-cbe/test/cfiles/test056.c
new file mode 100644
index 0000000000..b12df1df99
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test056.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test057.c b/hpvm/projects/llvm-cbe/test/cfiles/test057.c
new file mode 100644
index 0000000000..50678081ec
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test057.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an unsigned short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test058.c b/hpvm/projects/llvm-cbe/test/cfiles/test058.c
new file mode 100644
index 0000000000..cdbfac068f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test058.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed short int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed short int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test059.c b/hpvm/projects/llvm-cbe/test/cfiles/test059.c
new file mode 100644
index 0000000000..4de964a13e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test059.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned short int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned short int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test060.c b/hpvm/projects/llvm-cbe/test/cfiles/test060.c
new file mode 100644
index 0000000000..a0a6e16949
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test060.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test061.c b/hpvm/projects/llvm-cbe/test/cfiles/test061.c
new file mode 100644
index 0000000000..d1bf812aa0
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test061.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test062.c b/hpvm/projects/llvm-cbe/test/cfiles/test062.c
new file mode 100644
index 0000000000..077ace8b32
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test062.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test063.c b/hpvm/projects/llvm-cbe/test/cfiles/test063.c
new file mode 100644
index 0000000000..78fbe390f5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test063.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test064.c b/hpvm/projects/llvm-cbe/test/cfiles/test064.c
new file mode 100644
index 0000000000..c26a3da001
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test064.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and
+// returning an unsigned long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test065.c b/hpvm/projects/llvm-cbe/test/cfiles/test065.c
new file mode 100644
index 0000000000..d9b299752c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test065.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test066.c b/hpvm/projects/llvm-cbe/test/cfiles/test066.c
new file mode 100644
index 0000000000..b4adc62240
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test066.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test067.c b/hpvm/projects/llvm-cbe/test/cfiles/test067.c
new file mode 100644
index 0000000000..9d786b5210
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test067.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long long  a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test068.c b/hpvm/projects/llvm-cbe/test/cfiles/test068.c
new file mode 100644
index 0000000000..1f72ecd1b7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test068.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long long  a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test069.c b/hpvm/projects/llvm-cbe/test/cfiles/test069.c
new file mode 100644
index 0000000000..bc611f13c1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test069.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning a signed long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test070.c b/hpvm/projects/llvm-cbe/test/cfiles/test070.c
new file mode 100644
index 0000000000..94c42bd8b5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test070.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an unsigned long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test071.c b/hpvm/projects/llvm-cbe/test/cfiles/test071.c
new file mode 100644
index 0000000000..3e090147c7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test071.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an if statement correctly.
+// *TW 
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   int x = 6;
+   if (x == 6)
+      return x;
+	return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test072.c b/hpvm/projects/llvm-cbe/test/cfiles/test072.c
new file mode 100644
index 0000000000..7c7cbcb391
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test072.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an else-if statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 6;
+   if (x == 4) {
+      return 2;
+   } else if (x == 6){
+        return 6;
+     } else {
+          return 8;
+     }
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test073.c b/hpvm/projects/llvm-cbe/test/cfiles/test073.c
new file mode 100644
index 0000000000..006a7348e8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test073.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a do-while statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 0;
+   do {
+      x++;
+   } while (x < 6);
+
+   return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test074.c b/hpvm/projects/llvm-cbe/test/cfiles/test074.c
new file mode 100644
index 0000000000..bb3ff37858
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test074.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a break/continue statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x;
+   for (x=0; x<=25; x++) {
+      if (x == 6)
+         break;
+      if (x < 15)
+         continue;
+   }
+   return x;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test075.c b/hpvm/projects/llvm-cbe/test/cfiles/test075.c
new file mode 100644
index 0000000000..a0601622c2
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test075.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a Goto-Label statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 0;
+   goto label;
+   
+   for(;;) {
+      x = 10;
+      return x;
+   }
+
+   label:
+   x = 6;
+   return x;
+
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test076.c b/hpvm/projects/llvm-cbe/test/cfiles/test076.c
new file mode 100644
index 0000000000..d5f149eb3b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test076.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use an integer pointer and
+// return the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+
+   int x = 6, y = 0, *ip = 0;
+   ip = &x;
+   y = *ip;
+   return y;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test077.c b/hpvm/projects/llvm-cbe/test/cfiles/test077.c
new file mode 100644
index 0000000000..a6e1fc7985
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test077.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a char pointer and
+// return the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char x = 'a', y = 'b', *cp;
+   cp = &x;
+   y = *cp;
+   if (y == 'a'){
+      return 6;
+   }
+   return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test078.c b/hpvm/projects/llvm-cbe/test/cfiles/test078.c
new file mode 100644
index 0000000000..cc60c18e34
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test078.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a NULL pointer and
+// confirm that it is equal to zero.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+#include <stddef.h>
+
+int main() {
+   int *ptr = NULL;
+    if (ptr == 0){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test079.c b/hpvm/projects/llvm-cbe/test/cfiles/test079.c
new file mode 100644
index 0000000000..fd1ea11039
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test079.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a double pointer and
+// confirms the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   double x = 6, y = 0, *dp;
+   dp = &x;
+   y = *dp;
+   if (y == 6){
+      return 6;
+   }
+   return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test080.c b/hpvm/projects/llvm-cbe/test/cfiles/test080.c
new file mode 100644
index 0000000000..b7fb855bf4
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test080.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a double pointer and
+// confirms the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   float x = 6, y = 0, *fp;
+   fp = &x;
+   y = *fp;
+   if (y == 6){
+      return 6;
+   }
+   return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test081.c b/hpvm/projects/llvm-cbe/test/cfiles/test081.c
new file mode 100644
index 0000000000..6efcad46ea
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test081.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use the address-of value (&)
+// variable and and return the value-at address (*) variable from integer 'num'.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main(){
+   int *ptr;
+   int num = 6;
+   ptr = &num;
+   int deref = *ptr;
+   return deref;
+
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test082.c b/hpvm/projects/llvm-cbe/test/cfiles/test082.c
new file mode 100644
index 0000000000..e30bb7a2f1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test082.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a pointer to
+// a structure (->).
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+struct Number{
+   int price;
+};
+
+int main(){
+   struct Number a;
+   struct Number* ptr = &a;
+   ptr->price = 6;
+   return ptr->price;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test083.c b/hpvm/projects/llvm-cbe/test/cfiles/test083.c
new file mode 100644
index 0000000000..5dc920edf4
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test083.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a pointer to
+// access an array.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main(){
+   int *ip;
+   int a[2];
+   a[0] = 1;
+   a[1] = 6;
+   ip = &a[1];
+
+   return *ip;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test084.c b/hpvm/projects/llvm-cbe/test/cfiles/test084.c
new file mode 100644
index 0000000000..6f5b3ad6d9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test084.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly increment a pointer via int.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+#include <stdint.h>
+
+int main() {
+
+  intptr_t inc0 = 0, inc1 = 0, diff = 0, a = 100;
+  intptr_t *p = &a;
+  inc0 = (intptr_t)p;
+  ++(*p++);  //++(*p++);
+  inc1 = (intptr_t)p;
+  diff =  inc1-inc0;
+  diff += 2;
+  return diff;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test085.c b/hpvm/projects/llvm-cbe/test/cfiles/test085.c
new file mode 100644
index 0000000000..01e8d65e6c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test085.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly decrement a pointer via int.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+#include <stdint.h>
+
+int main() {
+
+  intptr_t inc0 = 0, inc1 = 0, diff = 0, a = 100;
+  intptr_t *p = &a;
+  inc0 = (intptr_t)p;
+  --(*p--); //--(*p--);
+  inc1 = (intptr_t)p;
+  diff =  inc0-inc1;
+  diff += 2;
+  return diff;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test086.c b/hpvm/projects/llvm-cbe/test/cfiles/test086.c
new file mode 100644
index 0000000000..72e7f03901
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test086.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly increment a pointer via char.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+
+  // char inc0 = 0, inc1 = 0;
+  // int diff = 0, a = 100;
+  // int *p = &a;
+  // inc0 =(int)p;
+  // ++(*p++);  //++(*p++);
+  // inc1 =(int)p;
+  // diff =  inc1-inc0;
+  // diff += 2;
+  // return diff;
+  return 6; //TODO
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test087.c b/hpvm/projects/llvm-cbe/test/cfiles/test087.c
new file mode 100644
index 0000000000..2929116790
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test087.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly decrement a pointer via char.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//===---------------------------------------------------------------------------===//
+
+int main() {
+
+  // char inc0 = 0, inc1 = 0;
+  // int diff = 0, a = 100;
+  // int *p = &a;
+  // inc0 =(int)p;
+  // --(*p--);  //--*p--);
+  // inc1 =(int)p;
+  // diff =  inc0-inc1;
+  // diff += 2;
+  // return diff;
+  return 6; //TODO
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test088.c b/hpvm/projects/llvm-cbe/test/cfiles/test088.c
new file mode 100644
index 0000000000..938237bea9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test088.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly declare a multi-dimension.
+// This example works by using a pointer to access address[1][1] to return 6.
+// *TW
+//===---------------------------------------------------------------------------===//
+
+int main(){
+   int a[2][2];
+   int *ip;
+   a[0][0] = 0;
+   a[0][1] = 1;
+   a[1][0] = 3;
+   a[1][1] = 6;
+   ip = &a[1][1];
+
+   return *ip;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test089.c b/hpvm/projects/llvm-cbe/test/cfiles/test089.c
new file mode 100644
index 0000000000..925c3bb56b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test089.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute data-packing in a structure correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+#pragma pack(push)
+#pragma pack(1)
+
+struct DataSize{
+    char Data2;
+    char Data3;
+    int Data1;
+};
+
+int main(){
+    struct DataSize example;
+    return sizeof(example);
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test090.c b/hpvm/projects/llvm-cbe/test/cfiles/test090.c
new file mode 100644
index 0000000000..021a05e8a0
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test090.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a union and check the data size correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+union Data{
+   int i;
+   float f;
+   char  str[8];
+};
+
+int main(){
+   union Data data;
+   int datasize = sizeof(data) - 2;
+
+   return datasize;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test091.c b/hpvm/projects/llvm-cbe/test/cfiles/test091.c
new file mode 100644
index 0000000000..dce59d85d5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test091.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will access and return union members correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+union Data{
+   char unit1[6];
+   char unit2;
+   char unit3;
+};
+
+int main(){
+   union Data data;
+   return sizeof(data);
+}
+
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test092.c b/hpvm/projects/llvm-cbe/test/cfiles/test092.c
new file mode 100644
index 0000000000..3b197f21a5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test092.c
@@ -0,0 +1,35 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will pass a structure into a function correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int k = 0;
+
+struct test{
+   int i;
+   float f;
+};
+
+void funct(struct test example){
+   k = example.i;
+}
+
+int main(){
+   struct test example;
+
+   example.i = 6;
+   example.f = 6.0;
+   funct(example);
+
+   return k;
+}
+
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test093.c b/hpvm/projects/llvm-cbe/test/cfiles/test093.c
new file mode 100644
index 0000000000..3553edea3a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test093.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested structure properly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+struct layer1{
+   int depth1;
+   char name1[20];
+};
+
+struct layer2{
+   int depth2;
+   char name2[20];
+   struct layer1 layer_data;
+}layer2_data;
+
+int main(){
+   struct layer2 layer2_data = {1, "test", {6, "test2"}};
+
+   return layer2_data.layer_data.depth1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test094.c b/hpvm/projects/llvm-cbe/test/cfiles/test094.c
new file mode 100644
index 0000000000..2568c9c353
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test094.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a structure using typedef.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+typedef struct test {
+ int var1;
+ int var2;
+ int var3;
+}testrename;
+
+int main(){
+    testrename variable;
+
+    variable.var2 = 5;
+    variable.var3 = 6;
+    variable.var1 = 9;
+
+    return variable.var3;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test095.c b/hpvm/projects/llvm-cbe/test/cfiles/test095.c
new file mode 100644
index 0000000000..21db272034
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test095.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an array of structures.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+struct Shows
+    {
+     char show[20];
+     int runlength;
+     int rating;
+};
+
+int main(){
+struct Shows b1[3] = {
+        {"Big Bang Theory",22,6},
+        {"NCIS",45,9},
+    };
+    return b1[0].rating;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test096.c b/hpvm/projects/llvm-cbe/test/cfiles/test096.c
new file mode 100644
index 0000000000..81661df121
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test096.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a self referencing structure.
+// *TW
+//===------------------------------------------------------------------------------===//
+#include <stdio.h> //for NULL
+
+struct data{
+   int a;
+   struct data *ptr;
+};
+
+int main(){
+   struct data p=(struct data){.a=3,.ptr=&(struct data){.a=6,.ptr=NULL}};
+   return p.ptr->a;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test097.c b/hpvm/projects/llvm-cbe/test/cfiles/test097.c
new file mode 100644
index 0000000000..a42e36b6cb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test097.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle a simple addition function.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int addby2 ( int x );
+
+int main( ){
+    int n ;
+    n = addby2 ( 4 ) ;
+    return n;
+}
+
+int addby2(int x){
+    int p ;
+    p = x + 2 ;
+    return ( p ) ;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test098.c b/hpvm/projects/llvm-cbe/test/cfiles/test098.c
new file mode 100644
index 0000000000..70de117e51
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test098.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle static variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int subtrby2 ( int x );
+static int eight = 8;
+static int two = 2;
+
+int main( ){
+    int n ;
+    n = subtrby2 ( eight ) ;
+    return n;
+}
+
+int subtrby2(int x){
+    int p ;
+    p = x - two ;
+    return ( p ) ;
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test099.c b/hpvm/projects/llvm-cbe/test/cfiles/test099.c
new file mode 100644
index 0000000000..1c4713262e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test099.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle register variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main() {
+    register int counter = 0;
+    counter += 6;
+
+    return 6;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test100.c b/hpvm/projects/llvm-cbe/test/cfiles/test100.c
new file mode 100644
index 0000000000..db2cd9ea60
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test100.c
@@ -0,0 +1,30 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle a recursive function.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int fibonaci(int i){
+   if(i == 0){
+      return 0;
+   }
+   if(i == 1){
+      return 1;
+   }
+   return fibonaci(i-1) + fibonaci(i-2);
+}
+
+int  main(){
+    int returnval;
+    returnval = fibonaci(6) - 2;
+
+    return returnval;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test101.c b/hpvm/projects/llvm-cbe/test/cfiles/test101.c
new file mode 100644
index 0000000000..50d18d3ec3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test101.c
@@ -0,0 +1,37 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute a fibonacci numbers example.
+// Credit: http://en.literateprograms.org/Fibonacci_numbers_(C)
+// *TW
+//===------------------------------------------------------------------------------===//
+
+unsigned int fastfib(unsigned int n);
+
+int main(){
+    return fastfib(6) - 2;
+}
+
+unsigned int fastfib(unsigned int n){
+    unsigned int a[3];
+    unsigned int *p=a;
+    unsigned int i;
+
+    for(i=0; i<=n; ++i) {
+        if(i<2) *p=i;
+        else{
+            if(p==a) *p=*(a+1)+*(a+2);
+            else if(p==a+1) *p=*a+*(a+2);
+            else *p=*a+*(a+1);
+        }
+        if(++p>a+2) p=a;
+    }
+    return p==a?*(p+2):*(p-1);
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test102.c b/hpvm/projects/llvm-cbe/test/cfiles/test102.c
new file mode 100644
index 0000000000..572ea03103
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test102.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute a function pointer.
+// *TW
+//
+//===------------------------------------------------------------------------------===//
+
+int subtract(int x, int y) {
+  int z = x - y;
+  return z;
+}
+
+int main() {
+  int (*sabPtr)(int, int) = subtract;
+  return (*sabPtr)(10, 4);
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test103.c b/hpvm/projects/llvm-cbe/test/cfiles/test103.c
new file mode 100644
index 0000000000..6e2329021d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test103.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute Macro Substitution.
+// *TW
+//
+//===---------------------------------------------------------------------===//
+#define A 3
+#define B 3
+#define C A + B
+
+int main(){
+
+   int x = C;
+   return x;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test104.c b/hpvm/projects/llvm-cbe/test/cfiles/test104.c
new file mode 100644
index 0000000000..88884d6857
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test104.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests if the CBE will execute a tail recursion example correctly.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int tail (int n) {
+  if (n == 6)
+    return n;
+  else
+    return tail(n+1);
+}
+
+int main(){
+  return tail(0);
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/test105.c b/hpvm/projects/llvm-cbe/test/cfiles/test105.c
new file mode 100644
index 0000000000..7e830d55c5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/test105.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests if the CBE will execute a head recursion example correctly.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int head(int n){
+  if(n == 6)
+    return n;
+  else
+    return head(n+1);
+}
+
+int main(){
+  return head(0);
+}
diff --git a/hpvm/projects/llvm-cbe/test/cfiles/testbad.c b/hpvm/projects/llvm-cbe/test/cfiles/testbad.c
new file mode 100644
index 0000000000..a7456dc2b5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/cfiles/testbad.c
@@ -0,0 +1,17 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Does not return 6, will always fail. Exception for 25 so it will succeed.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    return 25;
+}
diff --git a/hpvm/projects/llvm-cbe/test/dtypes.h b/hpvm/projects/llvm-cbe/test/dtypes.h
new file mode 100644
index 0000000000..3ab8d8b1c5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/dtypes.h
@@ -0,0 +1,204 @@
+// This file is a part of Julia. License is MIT: http://julialang.org/license
+
+#ifndef DTYPES_H
+#define DTYPES_H
+
+#include <stddef.h>
+#include <stddef.h> // double include of stddef.h fixes #3421
+#include <stdint.h>
+#if defined(_COMPILER_INTEL_)
+#include <mathimf.h>
+#else
+#include <math.h>
+#endif
+
+#include "platform.h"
+
+#if !defined(_OS_WINDOWS_)
+#include <inttypes.h>
+#endif
+
+#if defined(_OS_WINDOWS_)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#if !defined(_COMPILER_MINGW_)
+
+#define strtoull                                            _strtoui64
+#define strtoll                                             _strtoi64
+#define strcasecmp                                          _stricmp
+#define strncasecmp                                         _strnicmp
+#define snprintf                                            _snprintf
+#define stat                                                _stat
+
+#define STDIN_FILENO                                        0
+#define STDOUT_FILENO                                       1
+#define STDERR_FILENO                                       2
+
+#endif /* !_COMPILER_MINGW_ */
+
+#endif /* _OS_WINDOWS_ */
+
+
+/*
+  This file defines sane integer types for our target platforms. This
+  library only runs on machines with the following characteristics:
+  - supports integer word sizes of 8, 16, 32, and 64 bits
+  - uses unsigned and signed 2's complement representations
+  - all pointer types are the same size
+  - there is an integer type with the same size as a pointer
+  Some features require:
+  - IEEE 754 single- and double-precision floating point
+  We assume the LP64 convention for 64-bit platforms.
+*/
+
+#ifdef _OS_WINDOWS_
+#define STDCALL __stdcall
+# ifdef LIBRARY_EXPORTS
+#  define JL_DLLEXPORT __declspec(dllexport)
+# else
+#  define JL_DLLEXPORT __declspec(dllimport)
+# endif
+#else
+#define STDCALL
+#define JL_DLLEXPORT __attribute__ ((visibility("default")))
+#endif
+
+#ifdef _OS_LINUX_
+#include <endian.h>
+#define LITTLE_ENDIAN  __LITTLE_ENDIAN
+#define BIG_ENDIAN     __BIG_ENDIAN
+#define PDP_ENDIAN     __PDP_ENDIAN
+#define BYTE_ORDER     __BYTE_ORDER
+#endif
+
+#if defined(__APPLE__) || defined(__FreeBSD__)
+#include <machine/endian.h>
+#define __LITTLE_ENDIAN  LITTLE_ENDIAN
+#define __BIG_ENDIAN     BIG_ENDIAN
+#define __PDP_ENDIAN     PDP_ENDIAN
+#define __BYTE_ORDER     BYTE_ORDER
+#endif
+
+#ifdef _OS_WINDOWS_
+#define __LITTLE_ENDIAN    1234
+#define __BIG_ENDIAN       4321
+#define __PDP_ENDIAN       3412
+#define __BYTE_ORDER       __LITTLE_ENDIAN
+#define __FLOAT_WORD_ORDER __LITTLE_ENDIAN
+#define LITTLE_ENDIAN      __LITTLE_ENDIAN
+#define BIG_ENDIAN         __BIG_ENDIAN
+#define PDP_ENDIAN         __PDP_ENDIAN
+#define BYTE_ORDER         __BYTE_ORDER
+#endif
+
+#define LLT_ALLOC(n) malloc(n)
+#define LLT_REALLOC(p,n) realloc((p),(n))
+#define LLT_FREE(x) free(x)
+
+#if defined(_OS_WINDOWS_) && defined(_COMPILER_INTEL_)
+#  define STATIC_INLINE static
+#  define INLINE
+#elif defined(_OS_WINDOWS_) && defined(_COMPILER_MICROSOFT_)
+#  define STATIC_INLINE static __inline
+#  define INLINE __inline
+#else
+#  define STATIC_INLINE static inline
+#  define INLINE inline
+#endif
+
+#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_)
+#  define NOINLINE __declspec(noinline)
+#  define NOINLINE_DECL(f) __declspec(noinline) f
+#else
+#  define NOINLINE __attribute__((noinline))
+#  define NOINLINE_DECL(f) f __attribute__((noinline))
+#endif
+
+#ifdef _COMPILER_MICROSOFT_
+# ifdef _P64
+#  define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) __declspec(align(8)) x
+# else
+#  define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) __declspec(align(4)) x
+# endif
+#elif defined(__GNUC__)
+#  define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) x __attribute__ ((aligned (sizeof(void*))))
+#else
+#  define JL_ATTRIBUTE_ALIGN_PTRSIZE(x)
+#endif
+
+typedef int bool_t;
+typedef unsigned char  byte_t;   /* 1 byte */
+
+#ifdef _P64
+#define TOP_BIT 0x8000000000000000
+#define NBITS 64
+typedef uint64_t uint_t;  // preferred int type on platform
+typedef int64_t int_t;
+#else
+#define TOP_BIT 0x80000000
+#define NBITS 32
+typedef uint32_t uint_t;
+typedef int32_t int_t;
+#endif
+
+STATIC_INLINE unsigned int next_power_of_two(unsigned int val)
+{
+    /* this function taken from libuv src/unix/core.c */
+    val -= 1;
+    val |= val >> 1;
+    val |= val >> 2;
+    val |= val >> 4;
+    val |= val >> 8;
+    val |= val >> 16;
+    val += 1;
+    return val;
+}
+
+#define LLT_ALIGN(x, sz) (((x) + (sz)-1) & -(sz))
+
+// branch prediction annotations
+#ifdef __GNUC__
+#define __unlikely(x) __builtin_expect(!!(x), 0)
+#define __likely(x)   __builtin_expect(!!(x), 1)
+#else
+#define __unlikely(x) (x)
+#define __likely(x)   (x)
+#endif
+
+#define DBL_MAXINT 9007199254740992LL
+#define FLT_MAXINT 16777216
+#define U64_MAX    18446744073709551615ULL
+#define S64_MAX    9223372036854775807LL
+#define S64_MIN    (-S64_MAX - 1LL)
+#define BIT63      0x8000000000000000LL
+#define U32_MAX    4294967295L
+#define S32_MAX    2147483647L
+#define S32_MIN    (-S32_MAX - 1L)
+#define BIT31      0x80000000
+
+#define D_PNAN ((double)+NAN)
+#define D_NNAN ((double)-NAN)
+#define D_PINF ((double)+INFINITY)
+#define D_NINF ((double)-INFINITY)
+#define F_PNAN ((float)+NAN)
+#define F_NNAN ((float)-NAN)
+#define F_PINF ((float)+INFINITY)
+#define F_NINF ((float)-INFINITY)
+
+typedef enum { T_INT8, T_UINT8, T_INT16, T_UINT16, T_INT32, T_UINT32,
+               T_INT64, T_UINT64, T_FLOAT, T_DOUBLE } numerictype_t;
+
+#define N_NUMTYPES ((int)T_DOUBLE+1)
+
+#ifdef _P64
+# define T_PTRDIFF T_INT64
+# define T_SIZE T_UINT64
+#else
+# define T_PTRDIFF T_INT32
+# define T_SIZE T_UINT32
+#endif
+
+#endif /* DTYPES_H */
\ No newline at end of file
diff --git a/hpvm/projects/llvm-cbe/test/platform.h b/hpvm/projects/llvm-cbe/test/platform.h
new file mode 100644
index 0000000000..0b7c6bcbbd
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/platform.h
@@ -0,0 +1,113 @@
+// This file is a part of Julia. License is MIT: http://julialang.org/license
+
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+/*
+ * This file provides convenient macros to be used to identify the platform
+ * based of compiler-specific pre-defined macros. It is based on the
+ * information that can be found at the following address:
+ *
+ *     http://sourceforge.net/p/predef/wiki/Home/
+ *
+ * Possible values include:
+ *      Compiler:
+ *          _COMPILER_CLANG_
+ *          _COMPILER_GCC_
+ *          _COMPILER_INTEL_
+ *          _COMPILER_MICROSOFT_
+ *          _COMPILER_MINGW_
+ *      OS:
+ *          _OS_FREEBSD_
+ *          _OS_LINUX_
+ *          _OS_WINDOWS_
+ *          _OS_DARWIN_
+ *
+ *      CPU/Architecture:
+ *          _CPU_X86_
+ *          _CPU_X86_64_
+ *          _CPU_ARM_
+ */
+
+/*******************************************************************************
+*                               Compiler                                       *
+*******************************************************************************/
+
+/*
+ * Notes:
+ *
+ *  1. Checking for Intel's compiler should be done before checking for
+ * Microsoft's. On Windows Intel's compiler also defines _MSC_VER as the
+ * acknoledgement of the fact that it is integrated with Visual Studio.
+ *
+ *  2. Checking for MinGW should be done before checking for GCC as MinGW
+ * pretends to be GCC.
+ */
+#if defined(__clang__)
+#define _COMPILER_CLANG_
+// Clang can also be used as a MinGW compiler
+#if defined(__MINGW32__)
+#define _COMPILER_MINGW_
+#endif
+#elif defined(__INTEL_COMPILER) || defined(__ICC)
+#define _COMPILER_INTEL_
+#elif defined(__MINGW32__)
+#define _COMPILER_MINGW_
+#elif defined(_MSC_VER)
+#define _COMPILER_MICROSOFT_
+#elif defined(__GNUC__)
+#define _COMPILER_GCC_
+#endif
+
+/*******************************************************************************
+*                               OS                                             *
+*******************************************************************************/
+
+#if defined(__FreeBSD__)
+#define _OS_FREEBSD_
+#elif defined(__linux__)
+#define _OS_LINUX_
+#elif defined(_WIN32) || defined(_WIN64)
+#define _OS_WINDOWS_
+#elif defined(__APPLE__) && defined(__MACH__)
+#define _OS_DARWIN_
+#endif
+
+/*******************************************************************************
+*                               Architecture                                   *
+*******************************************************************************/
+
+#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
+#define _CPU_X86_64_
+#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_X86_)
+#define _CPU_X86_
+#elif defined(__aarch64__)
+#define _CPU_AARCH64_
+#elif defined(__arm__) || defined(_M_ARM)
+#define _CPU_ARM_
+#elif defined(__PPC64__)
+#define _CPU_PPC64_
+#elif defined(_ARCH_PPC)
+#define _CPU_PPC_
+#endif
+
+#if defined(_CPU_X86_64_)
+#  define _P64
+#elif defined(_CPU_X86_)
+#  define _P32
+#elif defined(_OS_WINDOWS_)
+/* Not sure how to determine pointer size on Windows running ARM. */
+#  if _WIN64
+#    define _P64
+#  else
+#    define _P32
+#  endif
+#elif __SIZEOF_POINTER__ == 8
+#    define _P64
+#elif __SIZEOF_POINTER__ == 4
+#    define _P32
+#else
+#  error pointer size not known for your platform / compiler
+#endif
+
+#endif /* !PLATFORM_H */
\ No newline at end of file
diff --git a/hpvm/projects/llvm-cbe/test/selectionsort/main.c b/hpvm/projects/llvm-cbe/test/selectionsort/main.c
new file mode 100644
index 0000000000..47cf877d34
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/selectionsort/main.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+int main()
+{
+	int array[100], n, c, d, position, swap;
+	
+	printf("Enter number of elements\n");
+	scanf("%d", &n);
+	
+	printf("Enter %d integers\n", n);
+	
+	for (c = 0; c < n; c++)
+		scanf("%d", &array[c]);
+		
+	for (c = 0; c < (n - 1); c++)
+	{
+		position = c;
+		
+		for (d = c +1; d < n; d++)
+		{
+			if (array[position] > array[d])
+				position = d;
+		}
+		if (position != c)
+		{
+			swap = array[c];
+			array[c] = array[position];
+			array[position] = swap;
+		}
+	}
+	
+	printf("Sorted list in ascending order:\n");
+	
+	for (c = 0; c < n; c++)
+		printf("%d\n", array[c]);
+	
+	return 0;
+}
+	
diff --git a/hpvm/projects/llvm-cbe/test/test.log b/hpvm/projects/llvm-cbe/test/test.log
new file mode 100644
index 0000000000..b110730292
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test.log
@@ -0,0 +1,52 @@
+llvm-cbe: /home/aejjeh/work_dir/llvm_9/llvm/lib/Transforms/Utils/LoopSimplify.cpp:721: bool llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*, llvm::MemorySSAUpdater*, bool): Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Requested to preserve LCSSA, but it's already broken."' failed.
+ #0 0x000056094abcac6d llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:533:0
+ #1 0x000056094abcad00 PrintStackTraceSignalHandler(void*) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:594:0
+ #2 0x000056094abc8bda llvm::sys::RunSignalHandlers() /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Signals.cpp:68:0
+ #3 0x000056094abca624 SignalHandler(int) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:385:0
+ #4 0x00007fce196c7890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
+ #5 0x00007fce1837be97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
+ #6 0x00007fce1837d801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
+ #7 0x00007fce1836d39a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
+ #8 0x00007fce1836d412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
+ #9 0x000056094ada8c10 llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*, llvm::MemorySSAUpdater*, bool) /home/aejjeh/work_dir/llvm_9/llvm/lib/Transforms/Utils/LoopSimplify.cpp:720:0
+#10 0x0000560949f8148a (anonymous namespace)::CWriter::runOnFunction(llvm::Function&) /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp:173:0
+#11 0x000056094a651b86 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1648:0
+#12 0x000056094a651e77 llvm::FPPassManager::runOnModule(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1685:0
+#13 0x000056094a6522b7 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1750:0
+#14 0x000056094a652a77 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1863:0
+#15 0x000056094a652c69 llvm::legacy::PassManager::run(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1895:0
+#16 0x0000560949768421 compileModule(char**, llvm::LLVMContext&) /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp:360:0
+#17 0x00005609497678b7 main /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp:210:0
+#18 0x00007fce1835eb97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
+#19 0x0000560949765f9a _start (../../../build/bin/llvm-cbe+0xe9ff9a)
+Stack dump:
+0.	Program arguments: ../../../build/bin/llvm-cbe ./test101_O1.ll 
+1.	Running pass 'Function Pass Manager' on module './test101_O1.ll'.
+2.	Running pass 'C backend' on function '@fastfib'
+test.sh: line 1: 31864 Aborted                 ../../../build/bin/llvm-cbe $i
+llvm-cbe: /home/aejjeh/work_dir/llvm_9/llvm/lib/Transforms/Utils/LoopSimplify.cpp:721: bool llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*, llvm::MemorySSAUpdater*, bool): Assertion `L->isRecursivelyLCSSAForm(*DT, *LI) && "Requested to preserve LCSSA, but it's already broken."' failed.
+ #0 0x000055f2095bcc6d llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:533:0
+ #1 0x000055f2095bcd00 PrintStackTraceSignalHandler(void*) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:594:0
+ #2 0x000055f2095babda llvm::sys::RunSignalHandlers() /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Signals.cpp:68:0
+ #3 0x000055f2095bc624 SignalHandler(int) /home/aejjeh/work_dir/llvm_9/llvm/lib/Support/Unix/Signals.inc:385:0
+ #4 0x00007fdafbf50890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
+ #5 0x00007fdafac04e97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
+ #6 0x00007fdafac06801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
+ #7 0x00007fdafabf639a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
+ #8 0x00007fdafabf6412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
+ #9 0x000055f20979ac10 llvm::simplifyLoop(llvm::Loop*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::AssumptionCache*, llvm::MemorySSAUpdater*, bool) /home/aejjeh/work_dir/llvm_9/llvm/lib/Transforms/Utils/LoopSimplify.cpp:720:0
+#10 0x000055f20897348a (anonymous namespace)::CWriter::runOnFunction(llvm::Function&) /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/lib/Target/CBackend/CBackend.cpp:173:0
+#11 0x000055f209043b86 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1648:0
+#12 0x000055f209043e77 llvm::FPPassManager::runOnModule(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1685:0
+#13 0x000055f2090442b7 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1750:0
+#14 0x000055f209044a77 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1863:0
+#15 0x000055f209044c69 llvm::legacy::PassManager::run(llvm::Module&) /home/aejjeh/work_dir/llvm_9/llvm/lib/IR/LegacyPassManager.cpp:1895:0
+#16 0x000055f20815a421 compileModule(char**, llvm::LLVMContext&) /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp:360:0
+#17 0x000055f2081598b7 main /home/aejjeh/work_dir/llvm_9/llvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp:210:0
+#18 0x00007fdafabe7b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
+#19 0x000055f208157f9a _start (../../../build/bin/llvm-cbe+0xe9ff9a)
+Stack dump:
+0.	Program arguments: ../../../build/bin/llvm-cbe ./test006_O1.ll 
+1.	Running pass 'Function Pass Manager' on module './test006_O1.ll'.
+2.	Running pass 'C backend' on function '@main'
+test.sh: line 1: 31911 Aborted                 ../../../build/bin/llvm-cbe $i
diff --git a/hpvm/projects/llvm-cbe/test/test.sh b/hpvm/projects/llvm-cbe/test/test.sh
new file mode 100644
index 0000000000..d874d3d72a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test.sh
@@ -0,0 +1,3 @@
+for i in $(find . -name '*.ll'); do
+  ../../../build/bin/llvm-cbe $i
+  done
diff --git a/hpvm/projects/llvm-cbe/test/test001.c b/hpvm/projects/llvm-cbe/test/test001.c
new file mode 100644
index 0000000000..817d7ca8ca
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test001.c
@@ -0,0 +1,17 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will return the correct number.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    return 6;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test002.c b/hpvm/projects/llvm-cbe/test/test002.c
new file mode 100644
index 0000000000..9af3c34ee8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test002.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a for loop correctly.
+// *TW 
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    int i, x = 0;
+    for (i = 0; i < 6; i++)
+        ++x;
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test003.c b/hpvm/projects/llvm-cbe/test/test003.c
new file mode 100644
index 0000000000..4aa8eb6bfb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test003.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a while loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 0, x = 0;
+    while (i < 6) {
+        ++x;
+        ++i;
+    }
+    return x;
+} 
+   
diff --git a/hpvm/projects/llvm-cbe/test/test004.c b/hpvm/projects/llvm-cbe/test/test004.c
new file mode 100644
index 0000000000..ba619f09bb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test004.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an if/else statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int x = 3;
+    x += 3;
+    if (x == 6)
+        return x;
+    else
+        return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test005.c b/hpvm/projects/llvm-cbe/test/test005.c
new file mode 100644
index 0000000000..8b9323a97e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test005.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested for loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int i, j, x = 0;
+    for (i = 0; i < 3; i++)
+        for (j = 0; j < 2; j++)
+            ++x;
+            
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test006.c b/hpvm/projects/llvm-cbe/test/test006.c
new file mode 100644
index 0000000000..b513d75d4a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test006.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested while loop correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int i = 0, j = 0, x = 0;
+    while (i < 6) {
+        while (j < 6) {
+            ++x;
+            ++j;
+        }
+      ++i;
+    }
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test007.c b/hpvm/projects/llvm-cbe/test/test007.c
new file mode 100644
index 0000000000..50c895d181
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test007.c
@@ -0,0 +1,33 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a switch statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char var = 'x';
+   
+   switch (var) {
+      case 'z' :
+         return 0;
+         break;
+      case 'y' :
+         return 1;
+         break;
+      case 'x' :
+         return 6;
+         break;
+      case 'w' :
+         return 7;
+         break;
+      default :
+         return 100;
+   }
+}
diff --git a/hpvm/projects/llvm-cbe/test/test008.c b/hpvm/projects/llvm-cbe/test/test008.c
new file mode 100644
index 0000000000..283b8f73ba
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test008.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a struct correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+struct test {
+   int var1;
+   int var2;
+   int var3;
+};
+
+int main() {
+
+   struct test variable;
+
+   variable.var2 = 5;
+   variable.var3 = 6;
+   variable.var1 = 9;
+    
+   return variable.var3;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test009.c b/hpvm/projects/llvm-cbe/test/test009.c
new file mode 100644
index 0000000000..a46509105c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test009.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an array correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+    int example[10];
+    int i;
+       for (i = 0;i < 10; ++i) {
+        example[i] = i;
+       }
+       return example[6];
+}
diff --git a/hpvm/projects/llvm-cbe/test/test010.c b/hpvm/projects/llvm-cbe/test/test010.c
new file mode 100644
index 0000000000..e3841e64d3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test010.c
@@ -0,0 +1,43 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested switch statement correctly.
+// *TW
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char var = 'x', var2;
+   switch (var) {
+      case 'z' :
+         return 0;
+         break;
+      case 'y' :
+         return 1;
+         break;
+      case 'x' :
+         var2 = 'b';
+    
+         switch (var2) {
+            case 'a' :
+               return 10;
+               break;
+            case 'b' :
+               return 6;
+               break;
+            default :
+               return 18;
+         }
+
+         case 'w' :
+            return 7;
+            break;
+         default :
+            return 100;
+   }
+}
diff --git a/hpvm/projects/llvm-cbe/test/test011.c b/hpvm/projects/llvm-cbe/test/test011.c
new file mode 100644
index 0000000000..aa0ee7229f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test011.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle addition between two variables.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 2, t = 4, x = 0;
+    x = i+t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test012.c b/hpvm/projects/llvm-cbe/test/test012.c
new file mode 100644
index 0000000000..403c635686
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test012.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle subtraction between two variables.
+//  *TW
+//===----------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 8, t = 2, x = 0;
+    x = i-t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test013.c b/hpvm/projects/llvm-cbe/test/test013.c
new file mode 100644
index 0000000000..444d4676b7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test013.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle multiplication between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 3, t = 2, x = 0;
+    x = i*t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test014.c b/hpvm/projects/llvm-cbe/test/test014.c
new file mode 100644
index 0000000000..e1dc6931f9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test014.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle division between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 30, t = 5, x = 0;
+    x = i/t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test015.c b/hpvm/projects/llvm-cbe/test/test015.c
new file mode 100644
index 0000000000..e4c2a5c03b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test015.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle modulus between two variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main()
+{
+    int i = 26, t = 20, x = 0;
+    x = i%t;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test016.c b/hpvm/projects/llvm-cbe/test/test016.c
new file mode 100644
index 0000000000..0841840ebc
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test016.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the unary plus (+a) operator.
+// Increases the amount of space the char data type to 4.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    char ch;
+
+    if(sizeof(+ch) == 4) {
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test017.c b/hpvm/projects/llvm-cbe/test/test017.c
new file mode 100644
index 0000000000..0535862b30
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test017.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the unary minus (-a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main() {
+
+    signed int a = 10;
+    signed int b = -a;
+
+    if(b == -10) {
+        return 6;
+    }
+        return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test018.c b/hpvm/projects/llvm-cbe/test/test018.c
new file mode 100644
index 0000000000..c02efa9d0e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test018.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the incremental (++a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 5;
+
+    ++x;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test019.c b/hpvm/projects/llvm-cbe/test/test019.c
new file mode 100644
index 0000000000..1975bb9c5b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test019.c
@@ -0,0 +1,21 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the decremental (--a) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 7;
+   
+    --x;
+
+    return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test020.c b/hpvm/projects/llvm-cbe/test/test020.c
new file mode 100644
index 0000000000..a68801708d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test020.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// greater than (>) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 3;
+
+    if(x > y){
+        return x;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test021.c b/hpvm/projects/llvm-cbe/test/test021.c
new file mode 100644
index 0000000000..93eed31d9b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test021.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// greater than or equal (>=) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x >= y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test022.c b/hpvm/projects/llvm-cbe/test/test022.c
new file mode 100644
index 0000000000..895069a83b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test022.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// less than (<) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 12;
+
+
+    if(x < y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test023.c b/hpvm/projects/llvm-cbe/test/test023.c
new file mode 100644
index 0000000000..52348d3e16
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test023.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// less than or equal to (=<) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x <= y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test024.c b/hpvm/projects/llvm-cbe/test/test024.c
new file mode 100644
index 0000000000..2c90879b87
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test024.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// equal (==) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+
+    if(x == y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test025.c b/hpvm/projects/llvm-cbe/test/test025.c
new file mode 100644
index 0000000000..153cb40134
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test025.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// not equal (!=) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 2;
+
+    if(x != y){
+        return x;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test026.c b/hpvm/projects/llvm-cbe/test/test026.c
new file mode 100644
index 0000000000..874c06957d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test026.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (&&) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+int x = 6;
+int y = 6;
+int z = 6;
+
+    if(x == y && x == z){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test027.c b/hpvm/projects/llvm-cbe/test/test027.c
new file mode 100644
index 0000000000..d1322597c3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test027.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (||) relational logic operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int x = 6;
+    int y = 6;
+    int z = 6;
+
+    if(x == y || x != z){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test028.c b/hpvm/projects/llvm-cbe/test/test028.c
new file mode 100644
index 0000000000..ce77d792f3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test028.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// NOT (~a) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = -7;
+    unsigned int b = 0;
+
+    b = ~a;
+    if( b == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test029.c b/hpvm/projects/llvm-cbe/test/test029.c
new file mode 100644
index 0000000000..b7ac93ecf5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test029.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (a&b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;  //0110
+    unsigned int b = 15; //1111
+    unsigned int c = 0;
+
+    c = a&b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test030.c b/hpvm/projects/llvm-cbe/test/test030.c
new file mode 100644
index 0000000000..333ce5aa01
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test030.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (a&b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+unsigned int a = 2;
+unsigned int b = 4;
+unsigned int c = 0;
+
+    c = a|b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test031.c b/hpvm/projects/llvm-cbe/test/test031.c
new file mode 100644
index 0000000000..69d0dab0e1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test031.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// XOR (a^b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 9;  //1001
+    unsigned int b = 15; //1111
+    unsigned int c = 0;
+
+
+    c = a^b;
+    if(c == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test032.c b/hpvm/projects/llvm-cbe/test/test032.c
new file mode 100644
index 0000000000..ae63e2c4d2
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test032.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Left (a<<b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 3;  //0011
+    unsigned int b = 0;
+
+
+    b = a << 1;  //0110
+    if(b == 6){
+          return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test033.c b/hpvm/projects/llvm-cbe/test/test033.c
new file mode 100644
index 0000000000..1bb96d21bd
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test033.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Right (a>>b) bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 13;  //1100
+    unsigned int b = 0;
+
+    b = a >> 1;  //0110
+    if(b == 6){
+          return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test034.c b/hpvm/projects/llvm-cbe/test/test034.c
new file mode 100644
index 0000000000..dd9106b0be
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test034.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Addition Assignment(a+=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 3;
+    int b = 3;
+ 
+    a+=b;
+    if(a == 6){
+          return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test035.c b/hpvm/projects/llvm-cbe/test/test035.c
new file mode 100644
index 0000000000..d1c0ae391f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test035.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Subtraction Assignment(a-=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 9;
+    int b = 3;
+
+    a-=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test036.c b/hpvm/projects/llvm-cbe/test/test036.c
new file mode 100644
index 0000000000..d8d5a1957c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test036.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Multiplication Assignment(a*=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+int main(){
+
+    int a = 2;
+    int b = 3;
+
+    a*=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test037.c b/hpvm/projects/llvm-cbe/test/test037.c
new file mode 100644
index 0000000000..5bf5ee705a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test037.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Division Assignment(a/=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 30;
+    int b = 5;
+
+    a/=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test038.c b/hpvm/projects/llvm-cbe/test/test038.c
new file mode 100644
index 0000000000..efbe234607
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test038.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Compound Modulus Assignment(a%=b) operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    int a = 20;
+    int b = 14;
+
+    a%=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test039.c b/hpvm/projects/llvm-cbe/test/test039.c
new file mode 100644
index 0000000000..112d7f6970
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test039.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// AND (a&=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;  //0110
+    unsigned int b = 15; //1111
+
+    a&=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test040.c b/hpvm/projects/llvm-cbe/test/test040.c
new file mode 100644
index 0000000000..5285fb73ec
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test040.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// OR (a|=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 2;
+    unsigned int b = 4;
+
+    a|=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test041.c b/hpvm/projects/llvm-cbe/test/test041.c
new file mode 100644
index 0000000000..f04e682356
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test041.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// XOR (a^=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 9;  //1001
+    unsigned int b = 15; //1111
+
+    a^=b;
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test042.c b/hpvm/projects/llvm-cbe/test/test042.c
new file mode 100644
index 0000000000..5b4f12d808
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test042.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Left (a<<=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 3;  //0011
+
+    a <<= 1;  //0110
+    if( a == 6){
+        return 6;
+    }
+    return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test043.c b/hpvm/projects/llvm-cbe/test/test043.c
new file mode 100644
index 0000000000..3b42179304
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test043.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle the
+// Binary Shift Right (a>>=b) Compound Assignment bitwise operator.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 13;  //1100
+
+    a >>= 1;  //0110
+    if(a == 6){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test044.c b/hpvm/projects/llvm-cbe/test/test044.c
new file mode 100644
index 0000000000..dbb9d31ad9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test044.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    char a = 'A' ; //65
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test045.c b/hpvm/projects/llvm-cbe/test/test045.c
new file mode 100644
index 0000000000..50aaa8effc
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test045.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning a signed char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    signed char a = 'A';
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test046.c b/hpvm/projects/llvm-cbe/test/test046.c
new file mode 100644
index 0000000000..ea57085caf
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test046.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning an unsigned char.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned char a = 'A';
+    int ia = 0;
+
+    ia = a;
+    ia-=59;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test047.c b/hpvm/projects/llvm-cbe/test/test047.c
new file mode 100644
index 0000000000..2b90d14c7f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test047.c
@@ -0,0 +1,19 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+	int a = 6;
+        return a;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test048.c b/hpvm/projects/llvm-cbe/test/test048.c
new file mode 100644
index 0000000000..c30694ff50
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test048.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a short int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    short int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test049.c b/hpvm/projects/llvm-cbe/test/test049.c
new file mode 100644
index 0000000000..bb4a080198
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test049.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a long int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    long int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test050.c b/hpvm/projects/llvm-cbe/test/test050.c
new file mode 100644
index 0000000000..f69c7cee23
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test050.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a signed int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    signed int a = 6;
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test051.c b/hpvm/projects/llvm-cbe/test/test051.c
new file mode 100644
index 0000000000..61f1e03d57
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test051.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle
+// declaring and returning a unsigned int.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test052.c b/hpvm/projects/llvm-cbe/test/test052.c
new file mode 100644
index 0000000000..48e1ce67f8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test052.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a float.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    float a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test053.c b/hpvm/projects/llvm-cbe/test/test053.c
new file mode 100644
index 0000000000..86dd5691a7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test053.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a double.
+// *TW
+//===------------------------------------------------------------------------===//
+
+int main(){
+
+    double a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test054.c b/hpvm/projects/llvm-cbe/test/test054.c
new file mode 100644
index 0000000000..4c86601412
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test054.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long double.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long double a = 6.0;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test055.c b/hpvm/projects/llvm-cbe/test/test055.c
new file mode 100644
index 0000000000..cd7891acfe
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test055.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test056.c b/hpvm/projects/llvm-cbe/test/test056.c
new file mode 100644
index 0000000000..b12df1df99
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test056.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test057.c b/hpvm/projects/llvm-cbe/test/test057.c
new file mode 100644
index 0000000000..50678081ec
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test057.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an unsigned short.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned short a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test058.c b/hpvm/projects/llvm-cbe/test/test058.c
new file mode 100644
index 0000000000..cdbfac068f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test058.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed short int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed short int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test059.c b/hpvm/projects/llvm-cbe/test/test059.c
new file mode 100644
index 0000000000..4de964a13e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test059.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned short int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned short int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test060.c b/hpvm/projects/llvm-cbe/test/test060.c
new file mode 100644
index 0000000000..a0a6e16949
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test060.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test061.c b/hpvm/projects/llvm-cbe/test/test061.c
new file mode 100644
index 0000000000..d1bf812aa0
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test061.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test062.c b/hpvm/projects/llvm-cbe/test/test062.c
new file mode 100644
index 0000000000..077ace8b32
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test062.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test063.c b/hpvm/projects/llvm-cbe/test/test063.c
new file mode 100644
index 0000000000..78fbe390f5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test063.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test064.c b/hpvm/projects/llvm-cbe/test/test064.c
new file mode 100644
index 0000000000..c26a3da001
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test064.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and
+// returning an unsigned long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test065.c b/hpvm/projects/llvm-cbe/test/test065.c
new file mode 100644
index 0000000000..d9b299752c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test065.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long long a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test066.c b/hpvm/projects/llvm-cbe/test/test066.c
new file mode 100644
index 0000000000..b4adc62240
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test066.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test067.c b/hpvm/projects/llvm-cbe/test/test067.c
new file mode 100644
index 0000000000..9d786b5210
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test067.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a signed long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long long  a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test068.c b/hpvm/projects/llvm-cbe/test/test068.c
new file mode 100644
index 0000000000..1f72ecd1b7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test068.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning a unsigned long long.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long long  a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test069.c b/hpvm/projects/llvm-cbe/test/test069.c
new file mode 100644
index 0000000000..bc611f13c1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test069.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring
+// and returning a signed long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    signed long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test070.c b/hpvm/projects/llvm-cbe/test/test070.c
new file mode 100644
index 0000000000..94c42bd8b5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test070.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle declaring and returning an unsigned long long int.
+// *TW
+//===-------------------------------------------------------------------------------===//
+
+int main(){
+
+    unsigned long long int a = 6;
+
+    int ia = 0;
+    ia = (int)a;
+
+    return ia;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test071.c b/hpvm/projects/llvm-cbe/test/test071.c
new file mode 100644
index 0000000000..3e090147c7
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test071.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an if statement correctly.
+// *TW 
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   int x = 6;
+   if (x == 6)
+      return x;
+	return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test072.c b/hpvm/projects/llvm-cbe/test/test072.c
new file mode 100644
index 0000000000..7c7cbcb391
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test072.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an else-if statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 6;
+   if (x == 4) {
+      return 2;
+   } else if (x == 6){
+        return 6;
+     } else {
+          return 8;
+     }
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test073.c b/hpvm/projects/llvm-cbe/test/test073.c
new file mode 100644
index 0000000000..006a7348e8
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test073.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a do-while statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 0;
+   do {
+      x++;
+   } while (x < 6);
+
+   return x;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test074.c b/hpvm/projects/llvm-cbe/test/test074.c
new file mode 100644
index 0000000000..bb3ff37858
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test074.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a break/continue statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x;
+   for (x=0; x<=25; x++) {
+      if (x == 6)
+         break;
+      if (x < 15)
+         continue;
+   }
+   return x;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test075.c b/hpvm/projects/llvm-cbe/test/test075.c
new file mode 100644
index 0000000000..a0601622c2
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test075.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a Goto-Label statement correctly.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+   int x = 0;
+   goto label;
+   
+   for(;;) {
+      x = 10;
+      return x;
+   }
+
+   label:
+   x = 6;
+   return x;
+
+}
diff --git a/hpvm/projects/llvm-cbe/test/test076.c b/hpvm/projects/llvm-cbe/test/test076.c
new file mode 100644
index 0000000000..d5f149eb3b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test076.c
@@ -0,0 +1,22 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use an integer pointer and
+// return the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+
+   int x = 6, y = 0, *ip = 0;
+   ip = &x;
+   y = *ip;
+   return y;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test077.c b/hpvm/projects/llvm-cbe/test/test077.c
new file mode 100644
index 0000000000..a6e1fc7985
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test077.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a char pointer and
+// return the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   char x = 'a', y = 'b', *cp;
+   cp = &x;
+   y = *cp;
+   if (y == 'a'){
+      return 6;
+   }
+   return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test078.c b/hpvm/projects/llvm-cbe/test/test078.c
new file mode 100644
index 0000000000..cc60c18e34
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test078.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a NULL pointer and
+// confirm that it is equal to zero.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+#include <stddef.h>
+
+int main() {
+   int *ptr = NULL;
+    if (ptr == 0){
+        return 6;
+    }
+    return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test079.c b/hpvm/projects/llvm-cbe/test/test079.c
new file mode 100644
index 0000000000..fd1ea11039
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test079.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a double pointer and
+// confirms the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   double x = 6, y = 0, *dp;
+   dp = &x;
+   y = *dp;
+   if (y == 6){
+      return 6;
+   }
+   return 1;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test080.c b/hpvm/projects/llvm-cbe/test/test080.c
new file mode 100644
index 0000000000..b7fb855bf4
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test080.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a double pointer and
+// confirms the value located originally at the address of x.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main() {
+   float x = 6, y = 0, *fp;
+   fp = &x;
+   y = *fp;
+   if (y == 6){
+      return 6;
+   }
+   return 1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test081.c b/hpvm/projects/llvm-cbe/test/test081.c
new file mode 100644
index 0000000000..6efcad46ea
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test081.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use the address-of value (&)
+// variable and and return the value-at address (*) variable from integer 'num'.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main(){
+   int *ptr;
+   int num = 6;
+   ptr = &num;
+   int deref = *ptr;
+   return deref;
+
+}
diff --git a/hpvm/projects/llvm-cbe/test/test082.c b/hpvm/projects/llvm-cbe/test/test082.c
new file mode 100644
index 0000000000..e30bb7a2f1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test082.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a pointer to
+// a structure (->).
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+struct Number{
+   int price;
+};
+
+int main(){
+   struct Number a;
+   struct Number* ptr = &a;
+   ptr->price = 6;
+   return ptr->price;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test083.c b/hpvm/projects/llvm-cbe/test/test083.c
new file mode 100644
index 0000000000..5dc920edf4
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test083.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly use a pointer to
+// access an array.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int main(){
+   int *ip;
+   int a[2];
+   a[0] = 1;
+   a[1] = 6;
+   ip = &a[1];
+
+   return *ip;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test084.c b/hpvm/projects/llvm-cbe/test/test084.c
new file mode 100644
index 0000000000..6f5b3ad6d9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test084.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly increment a pointer via int.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+#include <stdint.h>
+
+int main() {
+
+  intptr_t inc0 = 0, inc1 = 0, diff = 0, a = 100;
+  intptr_t *p = &a;
+  inc0 = (intptr_t)p;
+  ++(*p++);  //++(*p++);
+  inc1 = (intptr_t)p;
+  diff =  inc1-inc0;
+  diff += 2;
+  return diff;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test085.c b/hpvm/projects/llvm-cbe/test/test085.c
new file mode 100644
index 0000000000..01e8d65e6c
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test085.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly decrement a pointer via int.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+#include <stdint.h>
+
+int main() {
+
+  intptr_t inc0 = 0, inc1 = 0, diff = 0, a = 100;
+  intptr_t *p = &a;
+  inc0 = (intptr_t)p;
+  --(*p--); //--(*p--);
+  inc1 = (intptr_t)p;
+  diff =  inc0-inc1;
+  diff += 2;
+  return diff;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test086.c b/hpvm/projects/llvm-cbe/test/test086.c
new file mode 100644
index 0000000000..72e7f03901
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test086.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly increment a pointer via char.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//
+//===---------------------------------------------------------------------------===//
+
+int main() {
+
+  // char inc0 = 0, inc1 = 0;
+  // int diff = 0, a = 100;
+  // int *p = &a;
+  // inc0 =(int)p;
+  // ++(*p++);  //++(*p++);
+  // inc1 =(int)p;
+  // diff =  inc1-inc0;
+  // diff += 2;
+  // return diff;
+  return 6; //TODO
+}
diff --git a/hpvm/projects/llvm-cbe/test/test087.c b/hpvm/projects/llvm-cbe/test/test087.c
new file mode 100644
index 0000000000..2929116790
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test087.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly decrement a pointer via char.
+// This example works by subtracting two mem. addresses and adding 2 to return 6.
+// *TW
+//===---------------------------------------------------------------------------===//
+
+int main() {
+
+  // char inc0 = 0, inc1 = 0;
+  // int diff = 0, a = 100;
+  // int *p = &a;
+  // inc0 =(int)p;
+  // --(*p--);  //--*p--);
+  // inc1 =(int)p;
+  // diff =  inc0-inc1;
+  // diff += 2;
+  // return diff;
+  return 6; //TODO
+}
diff --git a/hpvm/projects/llvm-cbe/test/test088.c b/hpvm/projects/llvm-cbe/test/test088.c
new file mode 100644
index 0000000000..938237bea9
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test088.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will properly declare a multi-dimension.
+// This example works by using a pointer to access address[1][1] to return 6.
+// *TW
+//===---------------------------------------------------------------------------===//
+
+int main(){
+   int a[2][2];
+   int *ip;
+   a[0][0] = 0;
+   a[0][1] = 1;
+   a[1][0] = 3;
+   a[1][1] = 6;
+   ip = &a[1][1];
+
+   return *ip;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test089.c b/hpvm/projects/llvm-cbe/test/test089.c
new file mode 100644
index 0000000000..925c3bb56b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test089.c
@@ -0,0 +1,26 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute data-packing in a structure correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+#pragma pack(push)
+#pragma pack(1)
+
+struct DataSize{
+    char Data2;
+    char Data3;
+    int Data1;
+};
+
+int main(){
+    struct DataSize example;
+    return sizeof(example);
+}
diff --git a/hpvm/projects/llvm-cbe/test/test090.c b/hpvm/projects/llvm-cbe/test/test090.c
new file mode 100644
index 0000000000..021a05e8a0
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test090.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a union and check the data size correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+union Data{
+   int i;
+   float f;
+   char  str[8];
+};
+
+int main(){
+   union Data data;
+   int datasize = sizeof(data) - 2;
+
+   return datasize;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test091.c b/hpvm/projects/llvm-cbe/test/test091.c
new file mode 100644
index 0000000000..dce59d85d5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test091.c
@@ -0,0 +1,25 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will access and return union members correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+union Data{
+   char unit1[6];
+   char unit2;
+   char unit3;
+};
+
+int main(){
+   union Data data;
+   return sizeof(data);
+}
+
+
diff --git a/hpvm/projects/llvm-cbe/test/test092.c b/hpvm/projects/llvm-cbe/test/test092.c
new file mode 100644
index 0000000000..3b197f21a5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test092.c
@@ -0,0 +1,35 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will pass a structure into a function correctly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int k = 0;
+
+struct test{
+   int i;
+   float f;
+};
+
+void funct(struct test example){
+   k = example.i;
+}
+
+int main(){
+   struct test example;
+
+   example.i = 6;
+   example.f = 6.0;
+   funct(example);
+
+   return k;
+}
+
+
diff --git a/hpvm/projects/llvm-cbe/test/test093.c b/hpvm/projects/llvm-cbe/test/test093.c
new file mode 100644
index 0000000000..3553edea3a
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test093.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a nested structure properly.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+struct layer1{
+   int depth1;
+   char name1[20];
+};
+
+struct layer2{
+   int depth2;
+   char name2[20];
+   struct layer1 layer_data;
+}layer2_data;
+
+int main(){
+   struct layer2 layer2_data = {1, "test", {6, "test2"}};
+
+   return layer2_data.layer_data.depth1;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test094.c b/hpvm/projects/llvm-cbe/test/test094.c
new file mode 100644
index 0000000000..2568c9c353
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test094.c
@@ -0,0 +1,29 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a structure using typedef.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+typedef struct test {
+ int var1;
+ int var2;
+ int var3;
+}testrename;
+
+int main(){
+    testrename variable;
+
+    variable.var2 = 5;
+    variable.var3 = 6;
+    variable.var1 = 9;
+
+    return variable.var3;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test095 b/hpvm/projects/llvm-cbe/test/test095
new file mode 100755
index 0000000000000000000000000000000000000000..47cc85407b662ffde70f02e6b12cf9399e889a5a
GIT binary patch
literal 8464
zcmeHMZ){W76+gD~j{>&CSeHUa-ZszzA|?q*W>&F2J25=71XytBsx7=Yv6FanY-B%|
z&`m2^N>z)|@?js?K1|uCW$Hfc!~S^Hqyni(H&vQD?Vq$xLI^sbjl={)QK!~B=e~R5
z=a<)seb|>NNAf%OoO^!f+<))h^RAzZ3><K~T)^apFMyEhRG~7T02dx(3jh^@unwQw
zU@J7Bx*mUQr^*uZW$BuElXT-jUWdP++f)SIswgmj+*AW|ZXt1sS0z;zO}@L)6qy4k
zLP0octKTa`<fEd%{BhY1MRLZGNVqnMYm+$UW!W(1+&}6Y{bJHz%&nqCvPum4#k0!E
zmgwkBBO%HZl&C=!jCr>y0dvNE32_XOCjXK7W$loR_fg|=SN4y&6k$&~HP+j`C!J_d
zr!s|^_L*RBdvA9jpAB@0ev^N)J$QInMB;H&P@*<(#viQ#s_*&Dk1qUtV)NDK-ut1i
zvHar`=k_ffCoKQ4_|UW-EjKw>e-d?ygC4LS<J9b4&~+;7c_W@P^yzpigPO_dY({Ey
zI5-du_vu}Mu0RiZGAGuBt)zDHcow##)=}MV8Ee@$DoQjraw!P8#c%3qxe}g9vFNS#
z+U$Ex+PV731_iXUmyG&bdl8|{zTULJNRwB3y3nMuqZ^;TRuxMmPf_LVYZas&yGW*x
zx63GYE=7xPozRNcwb>hYkH(^lm#)>Tpe<fLDcIstoeH;piH7$le69TerO#mlhqd+&
zWZLYqS1aB;<sMlmQ2=V#{gKzGs&dWOdWLi*lGy(8vIp(8;uY=kohLO{S$k`_fZ$ij
zP&@m31Z%~sCjPp_pV@zQy#i2Z9!BJ?Z(&15uGZ&J<+`^({nKXme|a4m7~58wuzC13
z#fz;g-mH{IZhr$IzE-%MM@~Mp^TTt(^jD8i)Z(A-X|HI-_ls_A_DY>r3a2KOa6B`q
z6(e(6Nr_D*v$@k~7MWj+{1gGO82Q<wf|Y1WwZ+J<5BEinA%EShebZ#+c471fTnun7
zQX0X=o}rr1Q=wudbUa#o5E_ma{}_r5oZs<clY&EZzMc57ft@!y|EgX7z(X^BtNz1E
zMLWA>Z1c4~PjDD0-We!9=tm!w&2MY73odQnyM;Tn5WX@J`f6w-bRwiLT$l*3{XJYC
zV(rMK;;LDNxc0Vso}j&i_SEtRmC709fI*KUTS7jM{3H(D8^~$>_~l}y_m{}^>=3wS
z{I0DV8k;V-8vUfFJ$oK~?IHt7&h`M?v7YQTwC^BWum6Cz<&bavsirgV<d!FP?cM%q
zQj-lXKiH3L`X(ttUjGa3zKsp;QyAH-OQ3oV>yuO;_WECTN4zaBc_Lord|kxb_MLjo
z+wnq!<_*p^4tmwJHyHAEguHEGuM+mQpncfeB=)7BAp8yVV}1X~<r=Mxz}g6`jlkLn
ztc}3`>j+%Je2-{Oav|V@b5!OVWW~Hk6{U?*zJX~Y5q~c7_tjRR1;C?P&=$#CFjFI<
z^PPz6|M_7hOY%jxO04?LC*x7_MO1RD#DJ1HqM*ruz5|F_Oa>p9oEd$42*UJ~h|hYF
zgP_d$3gzcSpD-EB$oQ-ul`^-R<5Av6#4@H6qCcv%$5cwlF4GL|N;xR&rTTx)_&e4f
z=pEUP2bT66?Cbly(uQAbJC*K0FwmoPb#(T0^mgr4+J=$|MT;AzzP+<|CqN*7dfJGO
zAvba+pW;#~V<dAYA&|)$$v`L^Z8zeRQku*Z0%L^~epjXv5FlwPo}Yq1;&cZ6ncT>k
zHP0k-`BXMjBj{L{OQz!lkfoDp0|Kc`3ZF)D2A>lsU|lv5H{uXTPU#c5_;gaAN+6ac
z6QRd*x%g=l!R4=wqZxXSPp8H)bQT@rBOs!f9>?-|2#jZ^r;{1OKCVu(2j8xsTU}M<
z!BrV^)O)~i)Yq-NFIHzBe0xfc_V^ZA=9e)ZXauKq=)t#>*Du==_uy^NsH2}pR^FFd
z`}M&4My-AWlpX!x?qb`I%(!0Q{ifEB5AMo+s8;W<-lte9JkSim2Gyc5iypj5;Qh;5
z>4A>{?_0I{%|KtCcJkov<Mf_+;8EcF0V~EsyN%qJYV|G9=BR%Rc01~Mm#unnVX+SW
zQK@Ro67A<M-1Y43r+wTF8==EC{sE~Uwdq4rZ$Cet68@|0q;?QZ;LqhSp65|daWC2Y
ze^1!2o|h8po%;1r{k<amG(%gXilr)*vFJ1oWZ~rhZ2{f1YCS9oKda~cfwZ@;t995=
zm&3fbqJ9&O1Kr9H@j0~z^@`BcKE5dQtJeu#sQK|Uvagd7)Ng{-@6ou>*ZL;u+tQDH
z9lnfuWwkl{0QJpoA1vG6$5%)X)%UbcVqZl)^_Q-nh{U%%^53G~k68s>Ct2xt(%!y5
z{7Kr|`+Hs5)4djvxJy9(choDSu+hIz-|TK#6}J&5Lb2JB_$kzH!t7(!{x+U7@<w4|
zA~25Eiii4!^nvKHn65)2nM+Ql@^~QX#<V`3&SsK%a8T)bBCAiPvt#kJo-nexydE#i
z0G=`@(@7(l2=wml?m^EEMmn8$=IN#5iG<f#=6RPWOi!Oih(*%rn5;21l6j+JUyo?@
zfuYb~M2{Tq$7Y*-;BpNt0eb(_heLzWKD4sbh>KOw4-Om&hX(W`2M!#I#PnDwJP;vw
z;_h`kUl6SYJsKO-t3wkT?4yB+#mCY~phMQYlLb8~PF#tx-`}dL^~M&*#saLp*~Pki
zR-cMz66jx#9zpksR7Nl4lh~PR)2K5TGlNRm86D4hSvGHs4?Uv~$@%O{$MbodOkKz3
z^RQ9Bcy?=gB}U3&LH(C1%Cm9FuIv+>SMdKVoM*FJvbEA@P-w&-?=zf#@c$T!)fmhC
z-m<zA3syYmDTZ{ooed?o<NHzn0CQoEf6=W9%ZpOM?Wg-nBF?)_3E(gmDEDVP=RGB<
z(4=7la_T$dTcrLta{4x4Ja|;IMt(2^O=;z6AHNe=L%BWUIgbiTJjEsA_Ol)HuVWp3
zE3mA}_^QM!1V*yA-_!y;iv=1}#*a$;sKj$WIljIB&r5t*I^^%28HwlbBf?Y8V8_3N
zIvNx1C+~yv5^v8)?DJo=;W-~H+v1~{Ak64$_;*pV#$P!XWFXrAt;BfNeIE-}Jm;4;
z<bd&a9oyU6KPT}#{+x&2m3VtR9zXUsZ^J`_YF5bs?Pf#C?eTwsdTKw%=e#y3@%L?b
zd;CjSPk(jF;a<sq`Ts$?y<L72u|5l)^W+wCie$I9%YQ)|YCp$UWInAtB>r!RrLHob
z^KSnCwk+qL*C)s4d3nbcpY!u&>J$>&n^IL~{kvFUZU0IhF9WnOP;$mGr}?qsInQd7
zc>8?I?yPuyA4}wm`_K8$?uW$FhXMKQz@L>E-)>c6nd38WMjgktnm#S#H?g6tw28tW
kuU#vCiX0QkiKG8>sVzKiysy#w=@frTUf_Jz=G-3t-wtXZEC2ui

literal 0
HcmV?d00001

diff --git a/hpvm/projects/llvm-cbe/test/test095.c b/hpvm/projects/llvm-cbe/test/test095.c
new file mode 100644
index 0000000000..21db272034
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test095.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute an array of structures.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+struct Shows
+    {
+     char show[20];
+     int runlength;
+     int rating;
+};
+
+int main(){
+struct Shows b1[3] = {
+        {"Big Bang Theory",22,6},
+        {"NCIS",45,9},
+    };
+    return b1[0].rating;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test096.c b/hpvm/projects/llvm-cbe/test/test096.c
new file mode 100644
index 0000000000..81661df121
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test096.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE will execute a self referencing structure.
+// *TW
+//===------------------------------------------------------------------------------===//
+#include <stdio.h> //for NULL
+
+struct data{
+   int a;
+   struct data *ptr;
+};
+
+int main(){
+   struct data p=(struct data){.a=3,.ptr=&(struct data){.a=6,.ptr=NULL}};
+   return p.ptr->a;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test097.c b/hpvm/projects/llvm-cbe/test/test097.c
new file mode 100644
index 0000000000..a42e36b6cb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test097.c
@@ -0,0 +1,27 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// This code tests to see that the CBE can handle a simple addition function.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int addby2 ( int x );
+
+int main( ){
+    int n ;
+    n = addby2 ( 4 ) ;
+    return n;
+}
+
+int addby2(int x){
+    int p ;
+    p = x + 2 ;
+    return ( p ) ;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test098.c b/hpvm/projects/llvm-cbe/test/test098.c
new file mode 100644
index 0000000000..70de117e51
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test098.c
@@ -0,0 +1,28 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle static variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int subtrby2 ( int x );
+static int eight = 8;
+static int two = 2;
+
+int main( ){
+    int n ;
+    n = subtrby2 ( eight ) ;
+    return n;
+}
+
+int subtrby2(int x){
+    int p ;
+    p = x - two ;
+    return ( p ) ;
+}
diff --git a/hpvm/projects/llvm-cbe/test/test099.c b/hpvm/projects/llvm-cbe/test/test099.c
new file mode 100644
index 0000000000..1c4713262e
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test099.c
@@ -0,0 +1,20 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle register variables.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int main() {
+    register int counter = 0;
+    counter += 6;
+
+    return 6;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test100.c b/hpvm/projects/llvm-cbe/test/test100.c
new file mode 100644
index 0000000000..db2cd9ea60
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test100.c
@@ -0,0 +1,30 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Test if CBE can handle a recursive function.
+// *TW
+//===------------------------------------------------------------------------------===//
+
+int fibonaci(int i){
+   if(i == 0){
+      return 0;
+   }
+   if(i == 1){
+      return 1;
+   }
+   return fibonaci(i-1) + fibonaci(i-2);
+}
+
+int  main(){
+    int returnval;
+    returnval = fibonaci(6) - 2;
+
+    return returnval;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test101.c b/hpvm/projects/llvm-cbe/test/test101.c
new file mode 100644
index 0000000000..50d18d3ec3
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test101.c
@@ -0,0 +1,37 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute a fibonacci numbers example.
+// Credit: http://en.literateprograms.org/Fibonacci_numbers_(C)
+// *TW
+//===------------------------------------------------------------------------------===//
+
+unsigned int fastfib(unsigned int n);
+
+int main(){
+    return fastfib(6) - 2;
+}
+
+unsigned int fastfib(unsigned int n){
+    unsigned int a[3];
+    unsigned int *p=a;
+    unsigned int i;
+
+    for(i=0; i<=n; ++i) {
+        if(i<2) *p=i;
+        else{
+            if(p==a) *p=*(a+1)+*(a+2);
+            else if(p==a+1) *p=*a+*(a+2);
+            else *p=*a+*(a+1);
+        }
+        if(++p>a+2) p=a;
+    }
+    return p==a?*(p+2):*(p-1);
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test102.c b/hpvm/projects/llvm-cbe/test/test102.c
new file mode 100644
index 0000000000..572ea03103
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test102.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C ----------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===------------------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute a function pointer.
+// *TW
+//
+//===------------------------------------------------------------------------------===//
+
+int subtract(int x, int y) {
+  int z = x - y;
+  return z;
+}
+
+int main() {
+  int (*sabPtr)(int, int) = subtract;
+  return (*sabPtr)(10, 4);
+}
diff --git a/hpvm/projects/llvm-cbe/test/test103.c b/hpvm/projects/llvm-cbe/test/test103.c
new file mode 100644
index 0000000000..6e2329021d
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test103.c
@@ -0,0 +1,23 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C -------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------===//
+//
+// Tests if the CBE will execute Macro Substitution.
+// *TW
+//
+//===---------------------------------------------------------------------===//
+#define A 3
+#define B 3
+#define C A + B
+
+int main(){
+
+   int x = C;
+   return x;
+}
+
diff --git a/hpvm/projects/llvm-cbe/test/test104.c b/hpvm/projects/llvm-cbe/test/test104.c
new file mode 100644
index 0000000000..88884d6857
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test104.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests if the CBE will execute a tail recursion example correctly.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int tail (int n) {
+  if (n == 6)
+    return n;
+  else
+    return tail(n+1);
+}
+
+int main(){
+  return tail(0);
+}
diff --git a/hpvm/projects/llvm-cbe/test/test105.c b/hpvm/projects/llvm-cbe/test/test105.c
new file mode 100644
index 0000000000..7e830d55c5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/test105.c
@@ -0,0 +1,24 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This code tests if the CBE will execute a head recursion example correctly.
+// *TW
+//
+//===----------------------------------------------------------------------===//
+
+int head(int n){
+  if(n == 6)
+    return n;
+  else
+    return head(n+1);
+}
+
+int main(){
+  return head(0);
+}
diff --git a/hpvm/projects/llvm-cbe/test/testCaseInfo.csv b/hpvm/projects/llvm-cbe/test/testCaseInfo.csv
new file mode 100644
index 0000000000..a90aed5646
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/testCaseInfo.csv
@@ -0,0 +1,105 @@
+test001,"Returns a value (6)"
+test002,"For loop with variable x incrementing ++x to 6"
+test003,"While loop with incrementing ++x values up to 6"
+test004,"If/else statement including += and == operators"
+test005,"Nested for loop using ++x"
+test006,"Nested while loop using ++x"
+test007,"Switch statement based on matching ‘x’ and returning 6"
+test008,"Struct statement based on returning a member 6"
+test009,"Array example incrementing from 0 - 10, returning the 6th member of array"
+test010,"Nested switch statement, returning ‘x’ then ‘6’"
+test011,"Addition using variables, x(6) = i(2) + t(4)"
+test012,"Subtraction using variables, x(6) = i(8) - t(2)"
+test013,"Multiplication using variables, x(6) = i(3) * t(2)"
+test014,"Division using variables, x(6) = i(30) / t(5)"
+test015,"Modulus using variables, x(6) = i(26) % t(20)"
+test016,"Unary plus (+a) operator, increase data size of char from 2 to 4"
+test017,"Unary minus (-a) operator, convert 10 to -10 and check all three variables"
+test018,"Increment (++a) operator, ++5 returns 6"
+test019,"Decrement (--a) operator, --7 returns 6"
+test020,"Greater Than (>) Relational Logic Operator, if x>y, return x (6)"
+test021,"Greater Than or Equal (>=) Relational Logic Operator, if x>y, return x (6)"
+test022,"Less Than (<) Relational Logic Operator, if x<y, return x (6)"
+test023,"Less Than or Equal (<=) Logic Operator, if x<=y, return x (6)"
+test024,"Equal (==) Relational Logic Operator, if x==y, return x (6)"
+test025,"Not Equal (!=) Relational Logic Operator, if x!=y, return x (6)"
+test026,"And (&&) Relational Logic Operator, if x==y && x==z, return x (6)"
+test027,"OR (||) Relational Logic Operator, if x==y || x!=z, return x (6)"
+test028,"NOT (~a) Bitwise Operator, b=~(-7)a, return (6)"
+test029,"AND (a&b) Bitwise Operator, c(6)=a(6)&b(15), return (6) "
+test030,"OR (a|b) Bitwise Operator, c(6)=a(2)|b(4), return (6)"
+test031,"XOR (a^b) Bitwise Operator, c(6)=a(9)^b(15), return (6)"
+test032,"Binary Shift Left (a<<b) Bitwise Operator, b(6)=a(3)<<1, return (6)"
+test033,"Binary Shift Right (a>>b) Bitwise Operator, b(6)=a(13)>>1, return (6)"
+test034,"Compound Addition (a+=b) Assignment Operator, a(3)+=b(3), return a(6)"
+test035,"Compound Subtraction (a+=b) Assignment Operator, a(9)-=b(3), return a(6)"
+test036,"Compound Multiplication (a*=) Assignment Operator, a(2)*=b(3), return a(6)"
+test037,"Compound Division (a/=b) Assignment Operator, a(30)/=b(5), return a(6)"
+test038,"Compound Modulus (a%=b) Assignment Operator, a(20)%=b(14), return a(6)"
+test039,"AND (a&=b) Compound Assignment Bitwise Operator, a(6)&=b(15), return a(6)"
+test040,"OR (a|=b) Compound Assignment Bitwise Operator, a(2)|=b(4), return a(6)"
+test041,"XOR (a^=b) Compound Assignment Bitwise Operator, a(9)^=b(15), return a(6)"
+test042,"Binary Shift Left (a<<=b) Compound Assignment B. Operator, a(3)<<=1, return a(6)"
+test043,"Binary Shift Right (a>>=) Compound Assignment B. Operator, a(13)>>=1, return a(6)"
+test044,"Declaring ‘char’, char a(’A’), ia=a, ia-59, return ia(6)"
+test045,"Declaring ‘signed char’, signed char a(’A’), ia=a, ia-59, return ia(6)"
+test046,"Declaring ‘unsigned char’, unsigned char a(’A’), ia=a, ia-59, return ia(6)"
+test047,"Declaring ‘int’, int a(6), return a(6)"
+test048,"Declaring ‘short int’, short int a(6), ia=a, ia=(int)a, return ia(6)"
+test049,"Declaring ‘long int’, long int a(6), ia=a, ia=(int)a, return ia(6)"
+test050,"Declaring ‘signed int’, signed int a(6), ia=a, ia=(int)a, return ia(6)"
+test051,"Declaring ‘unsigned int’, unsigned int a(6), ia=a, ia=(int)a, return ia(6)"
+test052,"Declaring ‘float’, float a(6.0), ia=a, ia=(int)a, return ia(6)"
+test053,"Declaring ‘double’, double a(6.0), ia=a, ia=(int)a, return ia(6)"
+test054,"Declaring ‘long double’, long double a(6.0), ia=a, ia=(int)a, return ia(6)"
+test055,"Declaring ‘short’, short a(6), ia=a, ia=(int)a, return ia(6)"
+test056,"Declaring ‘signed short’, signed short a(6), ia=a, ia=(int)a, return ia(6)"
+test057,"Declaring ‘unsigned short’, unsigned short a(6), ia=a, ia=(int)a, return ia(6)"
+test058,"Declaring ‘signed short int’, signed short int a(6), ia=a, ia=(int)a, return ia(6)"
+test059,"Declaring ‘unsigned short int’, unsigned short int a(6), ia=a, ia=(int)a, return ia(6)"
+test060,"Declaring ‘long’, long a(6), ia=a, ia=(int)a, return ia(6)"
+test061,"Declaring ‘signed long’, signed long a(6), ia=a, ia=(int)a, return ia(6)"
+test062,"Declaring ‘unsigned long’, unsigned long a(6), ia=a, ia=(int)a, return ia(6)"
+test063,"Declaring ‘signed long int’, signed long int a(6), ia=a, ia=(int)a, return ia(6)"
+test064,"Declaring ‘unsigned long int’, unsigned long int a(6), ia=a, ia=(int)a, return ia(6)"
+test065,"Declaring ‘long long’, signed long a(6), ia=a, ia=(int)a, return ia(6)"
+test066,"Declaring ‘long long int’, long long int a(6), ia=a, ia=(int)a, return ia(6)"
+test067,"Declaring ‘signed long long’, signed long long a(6), ia=a, ia=(int)a, return ia(6)"
+test068,"Declaring ‘unsigned long long’, unsigned long long a(6), ia=a, ia=(int)a, return ia(6)"
+test069,"Declaring ‘signed long long int’, signed long long int a(6), ia=a, ia=(int)a, return ia(6)"
+test070,"Declaring ‘unsigned long long int’, unsigned long long int a(6), ia=a, ia=(int)a, return ia(6)"
+test071,"Executes an if statement, returns x(6)"
+test072,"Executes an else/if statement, else option returns 6"
+test073,"Executes a do/while statement, while x==0, return 6"
+test074,"Executes a break/continue statement, x++, if x<15 continue, if x==10 break, return 6"
+test075,"Executes a Goto-Label statement, goto label (skips an infinite loop), return 6"
+test076,"Declares and returns the value of an integer pointer, return 6"
+test077,Declares a char pointer and compares the value to return 6
+test078,"Assigned a NULL pointer and checks to make sure it returns 0, return 6"
+test079,"Declares a double pointer and confirms its value located at address x, return 6"
+test080,"Declares a float pointer and confirms its value located at address x, return 6"
+test081,"Properly uses an address-of value (&) variable and returns the value-at address (*), return 6"
+test082,Tests a pointer to a structure (->) and returns 6
+test083,"Declares an array and uses a pointer to return 6 (cannot announce arrays: a[2]={1,6};)"
+test084,"Increments a pointer via int, Subtracts two memory addresses and adds 2 to return 6"
+test085,"Decrements a pointer via int, Subtracts two memory addresses and adds 2 to return 6"
+test086,"Increments a pointer via char, Subrtracts two memory addresses and adds 2 to return 6"
+test087,"Decrements a pointer via char, Subtracts two memory addresses and adds 2 to return 6"
+test088,Tests a Multi-Dimensional Array Uses a pointer to access address [1][1] and returns 6
+test089,"Tests an executed data-packing structure, returns 6"
+test090,"Tests an executed union and checks if the data size is correct, returns 6"
+test091,Tests an executed union and returns a member (6)
+test092,"Tests to see if the CBE can pass a structure into a function, returns 6"
+test093,"Tests if the CBE will execute a nested structure properly, returns 6"
+test094,"Tests if the CBE will execute a structure using typedef properly, returns 6"
+test095,"Tests if the CBE will execute an array of structures, returns 6"
+test096,"Tests if the CBE will execute a self-referencing structure, returns 6"
+test097,"Tests if the CBE can handle a simple addition function, returns 6"
+test098,"Tests if the CBE can handle static variables, returns 6"
+test099,"Tests if the CBE can handle register variables, returns 6"
+test100,"Tests if the CBE can handle a recursive function, returns 6"
+test101,"Tests if the CBE can handle a fibonacci numbers example, returns 6"
+test102,"Tests if the CBE will execute a function pointer, returns 6"
+test103,"Tests if the CBE will execute Macro Substitution, returns 6"
+test104,"Tests if the CBE will execute a tail recursion example, returns 6"
+test105,"Tests if the CBE will execute a head recursion example, returns 6"
diff --git a/hpvm/projects/llvm-cbe/test/testFile.py b/hpvm/projects/llvm-cbe/test/testFile.py
new file mode 100755
index 0000000000..afc1c49e9b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/testFile.py
@@ -0,0 +1,87 @@
+#!/usr/bin/python
+import os
+import re
+import subprocess
+
+LLVMToolDir = os.getenv('LLVMToolDir')
+if not LLVMToolDir:
+    LLVMToolDir = '.'
+
+cexe_res = []
+ll_res = []
+cbe_res = []
+failure_list = []
+
+def getList(fileExt):
+  fl = []
+  for name in os.listdir("."):
+    if re.search(fileExt, name):
+      fl.append(name)
+  fl.sort()
+  return fl
+
+def genResults(fileExt, fl):
+  for names in fl:
+    if os.path.isfile(names):
+      if (fileExt == ".cexe"):
+        res = subprocess.call(["./%s" % (names)])
+        cexe_res.append(res) # append for each optimization level
+        cexe_res.append(res)
+        cexe_res.append(res)
+        cexe_res.append(res)
+
+      elif (fileExt == ".ll"):
+        res = subprocess.call([LLVMToolDir + "/lli", names])
+        ll_res.append(res)
+
+      elif (fileExt == ".cbe"):
+        res = subprocess.call(["./%s" % (names)])
+        cbe_res.append(res)
+
+      if (res != 6 and res != 25):
+	catstring = names + ":\tFailure [" + str(res) + "]"
+        failure_list.append(catstring)
+
+def main():
+  print "Hunting for bugs... Please wait..."
+
+  cexeRegex = ".cexe$"
+  cexe = ".cexe"
+  file_list = getList(cexeRegex)
+  genResults(cexe, file_list)
+  print 'Running tests:', file_list
+
+  irRegex = ".ll$"
+  llIR = ".ll"
+  file_list = getList(irRegex)
+  genResults(llIR, file_list)
+
+  cbeRegex = ".cbe$"
+  cbe = ".cbe"
+  file_list = getList(cbeRegex)
+  genResults(cbe, file_list)
+
+  print 'cexe_res:', cexe_res
+  print 'll_res:  ', ll_res
+  print 'cbe_res: ', cbe_res
+
+  if (cexe_res == ll_res == cbe_res):
+    print("Success!")
+
+  elif (cexe_res != ll_res == cbe_res):
+    print("Failure Detected between C and IR! Incorrect Return Values!")
+    for bug in failure_list:
+      print(bug)
+
+  elif (cexe_res == ll_res != cbe_res):
+    print("Failure Detected between IR and CBE! Incorrect Return Values!")
+    for bug in failure_list:
+      print(bug)
+
+  elif (cexe_res != ll_res != cbe_res):
+    print("Discrepancy between all three types! Incorrect Return Values!")
+    for bug in failure_list:
+      print(bug)
+
+if __name__ == "__main__":
+  main()
diff --git a/hpvm/projects/llvm-cbe/test/testbad.c b/hpvm/projects/llvm-cbe/test/testbad.c
new file mode 100644
index 0000000000..a7456dc2b5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/test/testbad.c
@@ -0,0 +1,17 @@
+//===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Does not return 6, will always fail. Exception for 25 so it will succeed.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+    return 25;
+}
diff --git a/hpvm/projects/llvm-cbe/tools/CMakeLists.txt b/hpvm/projects/llvm-cbe/tools/CMakeLists.txt
new file mode 100644
index 0000000000..492fbdc988
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(llvm-cbe)
+#add_llvm_tool_subdirectory(llvm-cbe)
\ No newline at end of file
diff --git a/hpvm/projects/llvm-cbe/tools/Makefile b/hpvm/projects/llvm-cbe/tools/Makefile
new file mode 100644
index 0000000000..aadc4be5ad
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/Makefile
@@ -0,0 +1,14 @@
+##===- projects/sample/tools/Makefile ----------------------*- Makefile -*-===##
+
+#
+# Relative path to the top of the source tree.
+#
+LEVEL := ../../..
+include $(LEVEL)/Makefile.config
+
+#
+# List all of the subdirectories that we will compile.
+#
+DIRS := llvm-cbe
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/CMakeLists.txt b/hpvm/projects/llvm-cbe/tools/llvm-cbe/CMakeLists.txt
new file mode 100644
index 0000000000..a4eacb02b5
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Support plugins.
+set(LLVM_NO_DEAD_STRIP 1)
+
+set(LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
+  Analysis
+  AsmParser
+  AsmPrinter
+  BitReader
+  CBackendCodeGen
+  CBackendInfo
+  CodeGen
+  Core
+  IRReader
+  MC
+  ScalarOpts
+  SelectionDAG
+  Support
+  Target
+  )
+
+
+add_llvm_tool(llvm-cbe
+  llvm-cbe.cpp
+  )
+export_executable_symbols(llvm-cbe)
+## Support plugins.
+#set(LLVM_NO_DEAD_STRIP 1)
+#
+#set(LLVM_LINK_COMPONENTS
+#  ${LLVM_TARGETS_TO_BUILD}
+#  BitReader
+#  AsmParser
+#  IRReader
+#  CBackendInfo
+#  CBackendCodeGen
+#  )
+#
+#
+#add_llvm_tool(llvm-cbe
+#  llvm-cbe.cpp
+#  )
+#export_executable_symbols(llvm-cbe)
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/LLVMBuild.txt b/hpvm/projects/llvm-cbe/tools/llvm-cbe/LLVMBuild.txt
new file mode 100644
index 0000000000..2d04a9ee54
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/LLVMBuild.txt
@@ -0,0 +1,38 @@
+;===- ./tools/llc/LLVMBuild.txt --------------------------------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Tool
+name = llc
+parent = Tools
+required_libraries =
+ Analysis
+ AsmParser
+ AsmPrinter
+ BitReader
+ CBackendCodeGen
+ CBackendInfo
+ CodeGen
+ Core
+ IRReader
+ MC
+ ScalarOpts
+ SelectionDAG
+ Support
+ Target
+ all-targets
+;required_libraries =  BitReader AsmParser IRReader all-targets
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/Makefile b/hpvm/projects/llvm-cbe/tools/llvm-cbe/Makefile
new file mode 100644
index 0000000000..47cd976dc1
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/Makefile
@@ -0,0 +1,21 @@
+##===- projects/sample/tools/sample/Makefile ---------------*- Makefile -*-===##
+
+#
+# Indicate where we are relative to the top of the source tree.
+#
+LEVEL := ../../../..
+include $(LEVEL)/Makefile.config
+
+#
+# Give the name of the tool.
+#
+TOOLNAME := llvm-cbe
+
+#
+# List libraries that we'll need
+# We use LIBS because sample is a dynamic library.
+#
+USEDLIBS := LLVMCBackendCodeGen.a LLVMCBackendInfo.a
+LINK_COMPONENTS := all-targets bitreader asmparser irreader
+
+include $(PROJ_SRC_ROOT)/Makefile.rules
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp
new file mode 100644
index 0000000000..6c47501825
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp
@@ -0,0 +1,363 @@
+//===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This is the llc code generator driver. It provides a convenient
+// command-line interface for generating native assembly-language code
+// or C code, given LLVM bitcode.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+#if LLVM_VERSION_MAJOR >= 7
+#include "llvm/CodeGen/CommandFlags.inc"
+#else
+#include "llvm/CodeGen/CommandFlags.def"
+#endif
+#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
+#include "llvm/CodeGen/LinkAllCodegenComponents.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IRReader/IRReader.h"
+#include "llvm/MC/SubtargetFeature.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Target/TargetMachine.h"
+#include <memory>
+using namespace llvm;
+
+extern "C" void LLVMInitializeCBackendTarget();
+extern "C" void LLVMInitializeCBackendTargetInfo();
+extern "C" void LLVMInitializeCBackendTargetMC();
+
+// General options for llc.  Other pass-specific options are specified
+// within the corresponding llc passes, and target-specific options
+// and back-end code generation options are specified with the target machine.
+//
+static cl::opt<std::string>
+    InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+
+static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
+                                           cl::value_desc("filename"));
+
+static cl::opt<unsigned>
+    TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
+                     cl::value_desc("N"),
+                     cl::desc("Repeat compilation N times for timing"));
+
+// Determine optimization level.
+static cl::opt<char>
+    OptLevel("O",
+             cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+                      "(default = '-O2')"),
+             cl::Prefix, cl::ZeroOrMore, cl::init(' '));
+
+static cl::opt<std::string>
+    TargetTriple("mtriple", cl::desc("Override target triple for module"));
+
+cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+                       cl::desc("Do not verify input module"));
+
+static int compileModule(char **, LLVMContext &);
+
+// GetFileNameRoot - Helper function to get the basename of a filename.
+static inline std::string GetFileNameRoot(const std::string &InputFilename) {
+  std::string IFN = InputFilename;
+  std::string outputFilename;
+  int Len = IFN.length();
+  if ((Len > 2) && IFN[Len - 3] == '.' &&
+      ((IFN[Len - 2] == 'b' && IFN[Len - 1] == 'c') ||
+       (IFN[Len - 2] == 'l' && IFN[Len - 1] == 'l'))) {
+    outputFilename = std::string(IFN.begin(), IFN.end() - 3); // s/.bc/.s/
+  } else {
+    outputFilename = IFN;
+  }
+  return outputFilename;
+}
+
+static ToolOutputFile *GetOutputStream(const char *TargetName,
+                                       Triple::OSType OS,
+                                       const char *ProgName) {
+  // If we don't yet have an output filename, make one.
+  if (OutputFilename.empty()) {
+    if (InputFilename == "-")
+      OutputFilename = "-";
+    else {
+      OutputFilename = GetFileNameRoot(InputFilename);
+
+      switch (FileType) {
+      case TargetMachine::CGFT_AssemblyFile:
+        if (TargetName[0] == 'c') {
+          if (TargetName[1] == 0)
+            OutputFilename += ".cl";
+          else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+            OutputFilename += ".cpp";
+          else
+            OutputFilename += ".s";
+        } else
+          OutputFilename += ".s";
+        break;
+      case TargetMachine::CGFT_ObjectFile:
+        if (OS == Triple::Win32)
+          OutputFilename += ".obj";
+        else
+          OutputFilename += ".o";
+        break;
+      case TargetMachine::CGFT_Null:
+        OutputFilename += ".null";
+        break;
+      }
+    }
+  }
+
+  // Decide if we need "binary" output.
+  bool Binary = false;
+  switch (FileType) {
+  case TargetMachine::CGFT_AssemblyFile:
+    break;
+  case TargetMachine::CGFT_ObjectFile:
+  case TargetMachine::CGFT_Null:
+    Binary = true;
+    break;
+  }
+
+  // Open the file.
+  std::error_code error;
+  sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
+  if (Binary)
+    OpenFlags |= sys::fs::F_Text;
+  ToolOutputFile *FDOut =
+      new ToolOutputFile(OutputFilename.c_str(), error, OpenFlags);
+  if (error) {
+    errs() << error.message() << '\n';
+    delete FDOut;
+    return 0;
+  }
+
+  return FDOut;
+}
+
+static LLVMContext TheContext;
+
+// main - Entry point for the llc compiler.
+//
+int main(int argc, char **argv) {
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
+  PrettyStackTraceProgram X(argc, argv);
+
+  // Enable debug stream buffering.
+  EnableDebugBuffering = true;
+
+  llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+
+  // Initialize targets first, so that --version shows registered targets.
+  InitializeAllTargets();
+  InitializeAllTargetMCs();
+  InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
+
+  LLVMInitializeCBackendTarget();
+  LLVMInitializeCBackendTargetInfo();
+  LLVMInitializeCBackendTargetMC();
+
+  // Initialize codegen and IR passes used by llc so that the -print-after,
+  // -print-before, and -stop-after options work.
+  PassRegistry *Registry = PassRegistry::getPassRegistry();
+  initializeCore(*Registry);
+  initializeCodeGen(*Registry);
+  initializeLoopStrengthReducePass(*Registry);
+  initializeLowerIntrinsicsPass(*Registry);
+  initializeUnreachableBlockElimLegacyPassPass(*Registry);
+
+	// Adding necessary passes for loop generation
+	initializeLoopInfoWrapperPassPass(*Registry);
+  initializePostDominatorTreeWrapperPassPass(*Registry);
+  initializeScalarEvolutionWrapperPassPass(*Registry);
+  initializeDominatorTreeWrapperPassPass(*Registry);
+  initializeAssumptionCacheTrackerPass(*Registry);
+
+  // Register the target printer for --version.
+  cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+
+  cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
+
+  // Compile the module TimeCompilations times to give better compile time
+  // metrics.
+  for (unsigned I = TimeCompilations; I; --I)
+    if (int RetVal = compileModule(argv, TheContext))
+      return RetVal;
+  return 0;
+}
+
+static int compileModule(char **argv, LLVMContext &Context) {
+  // Load the module to be compiled...
+  SMDiagnostic Err;
+
+  std::unique_ptr<Module> M;
+
+  Module *mod = 0;
+  Triple TheTriple;
+
+  bool SkipModule =
+      MCPU == "help" || (!MAttrs.empty() && MAttrs.front() == "help");
+
+  // If user just wants to list available options, skip module loading
+  if (!SkipModule) {
+    M = parseIRFile(InputFilename, Err, Context);
+    mod = M.get();
+    if (mod == 0) {
+      Err.print(argv[0], errs());
+      return 1;
+    }
+
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      mod->setTargetTriple(Triple::normalize(TargetTriple));
+    TheTriple = Triple(mod->getTargetTriple());
+  } else {
+    TheTriple = Triple(Triple::normalize(TargetTriple));
+  }
+
+  if (TheTriple.getTriple().empty())
+    TheTriple.setTriple(sys::getDefaultTargetTriple());
+
+  // Get the target specific parser.
+  std::string Error;
+  // Override MArch
+  MArch = "c";
+  const Target *TheTarget =
+      TargetRegistry::lookupTarget(MArch, TheTriple, Error);
+  if (!TheTarget) {
+    errs() << argv[0] << ": " << Error << "\n";
+    return 1;
+  }
+
+  // Package up features to be passed to target/subtarget
+  std::string FeaturesStr;
+  if (MAttrs.size()) {
+    SubtargetFeatures Features;
+    for (unsigned i = 0; i != MAttrs.size(); ++i)
+      Features.AddFeature(MAttrs[i]);
+    FeaturesStr = Features.getString();
+  }
+
+  CodeGenOpt::Level OLvl = CodeGenOpt::Default;
+
+  switch (OptLevel) {
+  default:
+    errs() << argv[0] << ": invalid optimization level.\n";
+    return 1;
+  case ' ':
+    break;
+  case '0':
+    OLvl = CodeGenOpt::None;
+    break;
+  case '1':
+    OLvl = CodeGenOpt::Less;
+    break;
+  case '2':
+    OLvl = CodeGenOpt::Default;
+    break;
+  case '3':
+    OLvl = CodeGenOpt::Aggressive;
+    break;
+  }
+
+  TargetOptions Options;
+  Options.AllowFPOpFusion = FuseFPOps;
+  Options.UnsafeFPMath = EnableUnsafeFPMath;
+  Options.NoInfsFPMath = EnableNoInfsFPMath;
+  Options.NoNaNsFPMath = EnableNoNaNsFPMath;
+  Options.HonorSignDependentRoundingFPMathOption =
+      EnableHonorSignDependentRoundingFPMath;
+  if (FloatABIForCalls != FloatABI::Default)
+    Options.FloatABIType = FloatABIForCalls;
+  Options.NoZerosInBSS = DontPlaceZerosInBSS;
+  Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt;
+  Options.StackAlignmentOverride = OverrideStackAlignment;
+
+  // Jackson Korba 9/30/14
+  // OwningPtr<targetMachine>
+  std::unique_ptr<TargetMachine> target(TheTarget->createTargetMachine(
+      TheTriple.getTriple(), MCPU, FeaturesStr, Options, getRelocModel(),
+      getCodeModel(), OLvl));
+  assert(target.get() && "Could not allocate target machine!");
+  assert(mod && "Should have exited after outputting help!");
+  TargetMachine &Target = *target.get();
+
+  // Disable .loc support for older OS X versions.
+  if (TheTriple.isMacOSX() && TheTriple.isMacOSXVersionLT(10, 6)) {
+  }
+  // TODO: Find a replacement to this function
+  /* Greg Simpson 6-09-13
+  no member named setMCUseLoc
+  removed statement
+  Target.setMCUseLoc(false);  */
+
+  // Jackson Korba 9/30/14
+  std::unique_ptr<ToolOutputFile> Out(
+      GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
+  if (!Out)
+    return 1;
+
+  // Build up all of the passes that we want to do to the module.
+  legacy::PassManager PM;
+
+  // Add an appropriate TargetLibraryInfo pass for the module's triple.
+  TargetLibraryInfoWrapperPass *TLI =
+      new TargetLibraryInfoWrapperPass(TheTriple);
+  PM.add(TLI);
+
+  // Add intenal analysis passes from the target machine.
+  PM.add(createTargetTransformInfoWrapperPass(Target.getTargetIRAnalysis()));
+
+  if (RelaxAll) {
+    if (FileType != TargetMachine::CGFT_ObjectFile)
+      errs() << argv[0]
+             << ": warning: ignoring -mc-relax-all because filetype != obj\n";
+  }
+
+  // Ask the target to add backend passes as necessary.
+  if (Target.addPassesToEmitFile(PM, Out->os(),
+#if LLVM_VERSION_MAJOR >= 7
+                                 nullptr,
+#endif
+                                 FileType, NoVerify)) {
+    errs() << argv[0] << ": target does not support generation of this"
+           << " file type!\n";
+    return 1;
+  }
+
+  // Before executing passes, print the final values of the LLVM options.
+  cl::PrintOptionValues();
+
+  PM.run(*mod);
+
+  // Declare success.
+  Out->keep();
+
+  return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp~ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp~
new file mode 100644
index 0000000000..a86a11ce6f
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.cpp~
@@ -0,0 +1,557 @@
+//===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This is the llc code generator driver. It provides a convenient
+// command-line interface for generating native assembly-language code
+// or C code, given LLVM bitcode.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
+#include "llvm/CodeGen/LinkAllCodegenComponents.h"
+#include "llvm/CodeGen/MIRParser/MIRParser.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/DiagnosticPrinter.h"
+#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
+#include "llvm/IRReader/IRReader.h"
+#include "llvm/MC/SubtargetFeature.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
+#include "llvm/Transforms/Utils/Cloning.h"
+#include <memory>
+using namespace llvm;
+
+extern "C" void LLVMInitializeCBackendTarget();
+extern "C" void LLVMInitializeCBackendTargetInfo();
+extern "C" void LLVMInitializeCBackendTargetMC();
+// General options for llc.  Other pass-specific options are specified
+// within the corresponding llc passes, and target-specific options
+// and back-end code generation options are specified with the target machine.
+//
+static cl::opt<std::string>
+InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+
+static cl::opt<std::string>
+OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
+
+static cl::opt<unsigned>
+TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
+                 cl::value_desc("N"),
+                 cl::desc("Repeat compilation N times for timing"));
+
+static cl::opt<bool>
+NoIntegratedAssembler("no-integrated-as", cl::Hidden,
+                      cl::desc("Disable integrated assembler"));
+
+static cl::opt<bool>
+    PreserveComments("preserve-as-comments", cl::Hidden,
+                     cl::desc("Preserve Comments in outputted assembly"),
+                     cl::init(true));
+
+// Determine optimization level.
+static cl::opt<char>
+OptLevel("O",
+         cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+                  "(default = '-O2')"),
+         cl::Prefix,
+         cl::ZeroOrMore,
+         cl::init(' '));
+
+static cl::opt<std::string>
+TargetTriple("mtriple", cl::desc("Override target triple for module"));
+
+static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+                              cl::desc("Do not verify input module"));
+
+static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
+                                             cl::desc("Disable simplify-libcalls"));
+
+static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
+                                    cl::desc("Show encoding in .s output"));
+
+static cl::opt<bool> EnableDwarfDirectory(
+    "enable-dwarf-directory", cl::Hidden,
+    cl::desc("Use .file directives with an explicit directory."));
+
+static cl::opt<bool> AsmVerbose("asm-verbose",
+                                cl::desc("Add comments to directives."),
+                                cl::init(true));
+
+static cl::opt<bool>
+    CompileTwice("compile-twice", cl::Hidden,
+                 cl::desc("Run everything twice, re-using the same pass "
+                          "manager and verify the result is the same."),
+                 cl::init(false));
+
+static cl::opt<bool> DiscardValueNames(
+    "discard-value-names",
+    cl::desc("Discard names from Value (other than GlobalValue)."),
+    cl::init(false), cl::Hidden);
+
+static cl::opt<std::string> StopAfter("stop-after",
+                            cl::desc("Stop compilation after a specific pass"),
+                            cl::value_desc("pass-name"),
+                                      cl::init(""));
+static cl::opt<std::string> StartAfter("start-after",
+                          cl::desc("Resume compilation after a specific pass"),
+                          cl::value_desc("pass-name"),
+                          cl::init(""));
+
+namespace {
+static ManagedStatic<std::vector<std::string>> RunPassNames;
+
+struct RunPassOption {
+  void operator=(const std::string &Val) const {
+    if (Val.empty())
+      return;
+    SmallVector<StringRef, 8> PassNames;
+    StringRef(Val).split(PassNames, ',', -1, false);
+    for (auto PassName : PassNames)
+      RunPassNames->push_back(PassName);
+  }
+};
+}
+
+static RunPassOption RunPassOpt;
+
+static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
+    "run-pass",
+    cl::desc("Run compiler only for specified passes (comma separated list)"),
+    cl::value_desc("pass-name"), cl::ZeroOrMore, cl::location(RunPassOpt));
+
+static int compileModule(char **, LLVMContext &);
+
+static std::unique_ptr<tool_output_file>
+GetOutputStream(const char *TargetName, Triple::OSType OS,
+                const char *ProgName) {
+  // If we don't yet have an output filename, make one.
+  if (OutputFilename.empty()) {
+    if (InputFilename == "-")
+      OutputFilename = "-";
+    else {
+      // If InputFilename ends in .bc or .ll, remove it.
+      StringRef IFN = InputFilename;
+      if (IFN.endswith(".bc") || IFN.endswith(".ll"))
+        OutputFilename = IFN.drop_back(3);
+      else if (IFN.endswith(".mir"))
+        OutputFilename = IFN.drop_back(4);
+      else
+        OutputFilename = IFN;
+
+      switch (FileType) {
+      case TargetMachine::CGFT_AssemblyFile:
+        if (TargetName[0] == 'c') {
+          if (TargetName[1] == 0)
+            OutputFilename += ".cl";
+//            OutputFilename += ".cbe.c";
+          else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+            OutputFilename += ".cpp";
+          else
+            OutputFilename += ".s";
+        } else
+          OutputFilename += ".s";
+        break;
+      case TargetMachine::CGFT_ObjectFile:
+        if (OS == Triple::Win32)
+          OutputFilename += ".obj";
+        else
+          OutputFilename += ".o";
+        break;
+      case TargetMachine::CGFT_Null:
+        OutputFilename += ".null";
+        break;
+      }
+    }
+  }
+
+  // Decide if we need "binary" output.
+  bool Binary = false;
+  switch (FileType) {
+  case TargetMachine::CGFT_AssemblyFile:
+    break;
+  case TargetMachine::CGFT_ObjectFile:
+  case TargetMachine::CGFT_Null:
+    Binary = true;
+    break;
+  }
+
+  // Open the file.
+  std::error_code EC;
+  sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
+  if (!Binary)
+    OpenFlags |= sys::fs::F_Text;
+  auto FDOut = llvm::make_unique<tool_output_file>(OutputFilename, EC,
+                                                   OpenFlags);
+  if (EC) {
+    errs() << EC.message() << '\n';
+    return nullptr;
+  }
+
+  return FDOut;
+}
+
+static void DiagnosticHandler(const DiagnosticInfo &DI, void *Context) {
+  bool *HasError = static_cast<bool *>(Context);
+  if (DI.getSeverity() == DS_Error)
+    *HasError = true;
+
+  DiagnosticPrinterRawOStream DP(errs());
+  errs() << LLVMContext::getDiagnosticMessagePrefix(DI.getSeverity()) << ": ";
+  DI.print(DP);
+  errs() << "\n";
+}
+
+// main - Entry point for the llc compiler.
+//
+int main(int argc, char **argv) {
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
+  PrettyStackTraceProgram X(argc, argv);
+
+  // Enable debug stream buffering.
+  EnableDebugBuffering = true;
+
+  LLVMContext Context;
+  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
+
+  // Initialize targets first, so that --version shows registered targets.
+  InitializeAllTargets();
+  InitializeAllTargetMCs();
+  InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
+
+  LLVMInitializeCBackendTarget();
+  LLVMInitializeCBackendTargetInfo();
+  LLVMInitializeCBackendTargetMC();
+  // Initialize codegen and IR passes used by llc so that the -print-after,
+  // -print-before, and -stop-after options work.
+  PassRegistry *Registry = PassRegistry::getPassRegistry();
+  initializeCore(*Registry);
+  initializeCodeGen(*Registry);
+  initializeLoopStrengthReducePass(*Registry);
+  initializeLowerIntrinsicsPass(*Registry);
+
+  initializeLoopInfoWrapperPassPass(*Registry);
+  initializePostDominatorTreeWrapperPassPass(*Registry);
+  initializeScalarEvolutionWrapperPassPass(*Registry);
+  initializeDominatorTreeWrapperPassPass(*Registry);
+  initializeAssumptionCacheTrackerPass(*Registry);
+  //initializeUnreachableBlockElimLegacyPassPass(*Registry);
+
+  // Register the target printer for --version.
+  cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+
+  cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
+
+  Context.setDiscardValueNames(DiscardValueNames);
+
+  // Set a diagnostic handler that doesn't exit on the first error
+  bool HasError = false;
+  Context.setDiagnosticHandler(DiagnosticHandler, &HasError);
+
+  // Compile the module TimeCompilations times to give better compile time
+  // metrics.
+  for (unsigned I = TimeCompilations; I; --I)
+    if (int RetVal = compileModule(argv, Context))
+      return RetVal;
+  return 0;
+}
+
+static bool addPass(PassManagerBase &PM, const char *argv0,
+                    StringRef PassName, TargetPassConfig &TPC) {
+  if (PassName == "none")
+    return false;
+
+  const PassRegistry *PR = PassRegistry::getPassRegistry();
+  const PassInfo *PI = PR->getPassInfo(PassName);
+  if (!PI) {
+    errs() << argv0 << ": run-pass " << PassName << " is not registered.\n";
+    return true;
+  }
+
+  Pass *P;
+  if (PI->getTargetMachineCtor())
+    P = PI->getTargetMachineCtor()(&TPC.getTM<TargetMachine>());
+  else if (PI->getNormalCtor())
+    P = PI->getNormalCtor()();
+  else {
+    errs() << argv0 << ": cannot create pass: " << PI->getPassName() << "\n";
+    return true;
+  }
+  std::string Banner = std::string("After ") + std::string(P->getPassName());
+  PM.add(P);
+  TPC.printAndVerify(Banner);
+
+  return false;
+}
+
+static int compileModule(char **argv, LLVMContext &Context) {
+  // Load the module to be compiled...
+  SMDiagnostic Err;
+  std::unique_ptr<Module> M;
+  std::unique_ptr<MIRParser> MIR;
+  Triple TheTriple;
+
+  bool SkipModule = MCPU == "help" ||
+                    (!MAttrs.empty() && MAttrs.front() == "help");
+
+  // If user just wants to list available options, skip module loading
+  if (!SkipModule) {
+    //if (StringRef(InputFilename).endswith_lower(".mir")) {
+      //MIR = createMIRParserFromFile(InputFilename, Err, Context);
+      //if (MIR)
+        //M = MIR->parseLLVMModule();
+    //} else
+      M = parseIRFile(InputFilename, Err, Context);
+    if (!M) {
+      Err.print(argv[0], errs());
+      return 1;
+    }
+
+    // Verify module immediately to catch problems before doInitialization() is
+    // called on any passes.
+    if (!NoVerify && verifyModule(*M, &errs())) {
+      errs() << argv[0] << ": " << InputFilename
+             << ": error: input module is broken!\n";
+      return 1;
+    }
+
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      M->setTargetTriple(Triple::normalize(TargetTriple));
+    TheTriple = Triple(M->getTargetTriple());
+  } else {
+    TheTriple = Triple(Triple::normalize(TargetTriple));
+  }
+
+  if (TheTriple.getTriple().empty())
+    TheTriple.setTriple(sys::getDefaultTargetTriple());
+
+  // Get the target specific parser.
+  std::string Error;
+  // Override MArch
+  MArch = "c"; //FIX ME
+  const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
+                                                         Error);
+  if (!TheTarget) {
+    errs() << argv[0] << ": " << Error;
+    return 1;
+  }
+
+  std::string CPUStr = getCPUStr(), FeaturesStr = getFeaturesStr();
+
+  CodeGenOpt::Level OLvl = CodeGenOpt::Default;
+  switch (OptLevel) {
+  default:
+    errs() << argv[0] << ": invalid optimization level.\n";
+    return 1;
+  case ' ': break;
+  case '0': OLvl = CodeGenOpt::None; break;
+  case '1': OLvl = CodeGenOpt::Less; break;
+  case '2': OLvl = CodeGenOpt::Default; break;
+  case '3': OLvl = CodeGenOpt::Aggressive; break;
+  }
+
+  TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
+  Options.DisableIntegratedAS = NoIntegratedAssembler;
+  Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+  Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+  Options.MCOptions.AsmVerbose = AsmVerbose;
+  Options.MCOptions.PreserveAsmComments = PreserveComments;
+
+//  std::unique_ptr<TargetMachine> Target(
+  TargetMachine *Target(
+      TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
+                                     Options, getRelocModel(), CMModel, OLvl));
+
+  assert(Target && "Could not allocate target machine!");
+
+  // If we don't have a module then just exit now. We do this down
+  // here since the CPU/Feature help is underneath the target machine
+  // creation.
+  if (SkipModule)
+    return 0;
+
+  assert(M && "Should have exited if we didn't have a module!");
+  if (FloatABIForCalls != FloatABI::Default)
+    Options.FloatABIType = FloatABIForCalls;
+
+  // Figure out where we are going to send the output.
+  std::unique_ptr<tool_output_file> Out =
+      GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
+  if (!Out) return 1;
+
+  // Build up all of the passes that we want to do to the module.
+  legacy::PassManager PM;
+
+  // Add an appropriate TargetLibraryInfo pass for the module's triple.
+  TargetLibraryInfoImpl TLII(Triple(M->getTargetTriple()));
+
+  // The -disable-simplify-libcalls flag actually disables all builtin optzns.
+  if (DisableSimplifyLibCalls)
+    TLII.disableAllFunctions();
+  PM.add(new TargetLibraryInfoWrapperPass(TLII));
+
+  // Add the target data from the target machine, if it exists, or the module.
+  M->setDataLayout(Target->createDataLayout());
+
+  // Override function attributes based on CPUStr, FeaturesStr, and command line
+  // flags.
+  setFunctionAttributes(CPUStr, FeaturesStr, *M);
+
+  if (RelaxAll.getNumOccurrences() > 0 &&
+      FileType != TargetMachine::CGFT_ObjectFile)
+    errs() << argv[0]
+             << ": warning: ignoring -mc-relax-all because filetype != obj";
+
+  {
+    raw_pwrite_stream *OS = &Out->os();
+
+    // Manually do the buffering rather than using buffer_ostream,
+    // so we can memcmp the contents in CompileTwice mode
+    SmallVector<char, 0> Buffer;
+    std::unique_ptr<raw_svector_ostream> BOS;
+    if ((FileType != TargetMachine::CGFT_AssemblyFile &&
+         !Out->os().supportsSeeking()) ||
+        CompileTwice) {
+      BOS = make_unique<raw_svector_ostream>(Buffer);
+      OS = BOS.get();
+    }
+
+    AnalysisID StartBeforeID = nullptr;
+    AnalysisID StartAfterID = nullptr;
+    AnalysisID StopAfterID = nullptr;
+    const PassRegistry *PR = PassRegistry::getPassRegistry();
+    if (!RunPassNames->empty()) {
+      if (!StartAfter.empty() || !StopAfter.empty()) {
+        errs() << argv[0] << ": start-after and/or stop-after passes are "
+                             "redundant when run-pass is specified.\n";
+        return 1;
+      }
+      if (!MIR) {
+        errs() << argv[0] << ": run-pass needs a .mir input.\n";
+        return 1;
+      }
+      LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine*>(Target);
+      TargetPassConfig *TPC = LLVMTM->createPassConfig(PM);
+      PM.add(TPC);
+      
+//      LLVMTM.addMachineModuleInfo(PM);
+//      LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
+      MachineModuleInfo *MMI = new MachineModuleInfo(LLVMTM);
+      MMI->setMachineFunctionInitializer(MIR.get());
+      PM.add(MMI);
+      
+      TPC->printAndVerify("");
+
+      for (const std::string &RunPassName : *RunPassNames) {
+        if (addPass(PM, argv[0], RunPassName, *TPC))
+          return 1;
+      }
+      PM.add(createPrintMIRPass(*OS));
+    } else {
+      if (!StartAfter.empty()) {
+        const PassInfo *PI = PR->getPassInfo(StartAfter);
+        if (!PI) {
+          errs() << argv[0] << ": start-after pass is not registered.\n";
+          return 1;
+        }
+        StartAfterID = PI->getTypeInfo();
+      }
+      if (!StopAfter.empty()) {
+        const PassInfo *PI = PR->getPassInfo(StopAfter);
+        if (!PI) {
+          errs() << argv[0] << ": stop-after pass is not registered.\n";
+          return 1;
+        }
+        StopAfterID = PI->getTypeInfo();
+      }
+
+      // Ask the target to add backend passes as necessary.
+      if (Target->addPassesToEmitFile(PM, *OS, FileType, NoVerify,
+                                      StartBeforeID, StartAfterID, StopAfterID,
+                                      MIR.get())) {
+        errs() << argv[0] << ": target does not support generation of this"
+               << " file type!\n";
+        return 1;
+      }
+    }
+
+    // Before executing passes, print the final values of the LLVM options.
+    cl::PrintOptionValues();
+
+    // If requested, run the pass manager over the same module again,
+    // to catch any bugs due to persistent state in the passes. Note that
+    // opt has the same functionality, so it may be worth abstracting this out
+    // in the future.
+    SmallVector<char, 0> CompileTwiceBuffer;
+    if (CompileTwice) {
+      std::unique_ptr<Module> M2(llvm::CloneModule(M.get()));
+      PM.run(*M2);
+      CompileTwiceBuffer = Buffer;
+      Buffer.clear();
+    }
+
+    PM.run(*M);
+
+    auto HasError = *static_cast<bool *>(Context.getDiagnosticContext());
+    if (HasError)
+      return 1;
+
+    // Compare the two outputs and make sure they're the same
+    if (CompileTwice) {
+      if (Buffer.size() != CompileTwiceBuffer.size() ||
+          (memcmp(Buffer.data(), CompileTwiceBuffer.data(), Buffer.size()) !=
+           0)) {
+        errs()
+            << "Running the pass manager twice changed the output.\n"
+               "Writing the result of the second run to the specified output\n"
+               "To generate the one-run comparison binary, just run without\n"
+               "the compile-twice option\n";
+        Out->os() << Buffer;
+        Out->keep();
+        return 1;
+      }
+    }
+
+    if (BOS) {
+      Out->os() << Buffer;
+    }
+  }
+
+  // Declare success.
+  Out->keep();
+
+  return 0;
+} 
\ No newline at end of file
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.julia b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.julia
new file mode 100644
index 0000000000..0b55b0bdeb
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.julia
@@ -0,0 +1,356 @@
+//===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This is the llc code generator driver. It provides a convenient
+// command-line interface for generating native assembly-language code
+// or C code, given LLVM bitcode.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+#if LLVM_VERSION_MAJOR >= 7
+#include "llvm/CodeGen/CommandFlags.inc"
+#else
+#include "llvm/CodeGen/CommandFlags.def"
+#endif
+#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
+#include "llvm/CodeGen/LinkAllCodegenComponents.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IRReader/IRReader.h"
+#include "llvm/MC/SubtargetFeature.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Target/TargetMachine.h"
+#include <memory>
+using namespace llvm;
+
+extern "C" void LLVMInitializeCBackendTarget();
+extern "C" void LLVMInitializeCBackendTargetInfo();
+extern "C" void LLVMInitializeCBackendTargetMC();
+
+// General options for llc.  Other pass-specific options are specified
+// within the corresponding llc passes, and target-specific options
+// and back-end code generation options are specified with the target machine.
+//
+static cl::opt<std::string>
+    InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+
+static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
+                                           cl::value_desc("filename"));
+
+static cl::opt<unsigned>
+    TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
+                     cl::value_desc("N"),
+                     cl::desc("Repeat compilation N times for timing"));
+
+// Determine optimization level.
+static cl::opt<char>
+    OptLevel("O",
+             cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+                      "(default = '-O2')"),
+             cl::Prefix, cl::ZeroOrMore, cl::init(' '));
+
+static cl::opt<std::string>
+    TargetTriple("mtriple", cl::desc("Override target triple for module"));
+
+cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+                       cl::desc("Do not verify input module"));
+
+static int compileModule(char **, LLVMContext &);
+
+// GetFileNameRoot - Helper function to get the basename of a filename.
+static inline std::string GetFileNameRoot(const std::string &InputFilename) {
+  std::string IFN = InputFilename;
+  std::string outputFilename;
+  int Len = IFN.length();
+  if ((Len > 2) && IFN[Len - 3] == '.' &&
+      ((IFN[Len - 2] == 'b' && IFN[Len - 1] == 'c') ||
+       (IFN[Len - 2] == 'l' && IFN[Len - 1] == 'l'))) {
+    outputFilename = std::string(IFN.begin(), IFN.end() - 3); // s/.bc/.s/
+  } else {
+    outputFilename = IFN;
+  }
+  return outputFilename;
+}
+
+static ToolOutputFile *GetOutputStream(const char *TargetName,
+                                       Triple::OSType OS,
+                                       const char *ProgName) {
+  // If we don't yet have an output filename, make one.
+  if (OutputFilename.empty()) {
+    if (InputFilename == "-")
+      OutputFilename = "-";
+    else {
+      OutputFilename = GetFileNameRoot(InputFilename);
+
+      switch (FileType) {
+      case TargetMachine::CGFT_AssemblyFile:
+        if (TargetName[0] == 'c') {
+          if (TargetName[1] == 0)
+            OutputFilename += ".cbe.c";
+          else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+            OutputFilename += ".cpp";
+          else
+            OutputFilename += ".s";
+        } else
+          OutputFilename += ".s";
+        break;
+      case TargetMachine::CGFT_ObjectFile:
+        if (OS == Triple::Win32)
+          OutputFilename += ".obj";
+        else
+          OutputFilename += ".o";
+        break;
+      case TargetMachine::CGFT_Null:
+        OutputFilename += ".null";
+        break;
+      }
+    }
+  }
+
+  // Decide if we need "binary" output.
+  bool Binary = false;
+  switch (FileType) {
+  case TargetMachine::CGFT_AssemblyFile:
+    break;
+  case TargetMachine::CGFT_ObjectFile:
+  case TargetMachine::CGFT_Null:
+    Binary = true;
+    break;
+  }
+
+  // Open the file.
+  std::error_code error;
+  sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
+  if (Binary)
+    OpenFlags |= sys::fs::F_Text;
+  ToolOutputFile *FDOut =
+      new ToolOutputFile(OutputFilename.c_str(), error, OpenFlags);
+  if (error) {
+    errs() << error.message() << '\n';
+    delete FDOut;
+    return 0;
+  }
+
+  return FDOut;
+}
+
+static LLVMContext TheContext;
+
+// main - Entry point for the llc compiler.
+//
+int main(int argc, char **argv) {
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
+  PrettyStackTraceProgram X(argc, argv);
+
+  // Enable debug stream buffering.
+  EnableDebugBuffering = true;
+
+  llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+
+  // Initialize targets first, so that --version shows registered targets.
+  InitializeAllTargets();
+  InitializeAllTargetMCs();
+  InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
+
+  LLVMInitializeCBackendTarget();
+  LLVMInitializeCBackendTargetInfo();
+  LLVMInitializeCBackendTargetMC();
+
+  // Initialize codegen and IR passes used by llc so that the -print-after,
+  // -print-before, and -stop-after options work.
+  PassRegistry *Registry = PassRegistry::getPassRegistry();
+  initializeCore(*Registry);
+  initializeCodeGen(*Registry);
+  initializeLoopStrengthReducePass(*Registry);
+  initializeLowerIntrinsicsPass(*Registry);
+  initializeUnreachableBlockElimLegacyPassPass(*Registry);
+
+  // Register the target printer for --version.
+  cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+
+  cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
+
+  // Compile the module TimeCompilations times to give better compile time
+  // metrics.
+  for (unsigned I = TimeCompilations; I; --I)
+    if (int RetVal = compileModule(argv, TheContext))
+      return RetVal;
+  return 0;
+}
+
+static int compileModule(char **argv, LLVMContext &Context) {
+  // Load the module to be compiled...
+  SMDiagnostic Err;
+
+  std::unique_ptr<Module> M;
+
+  Module *mod = 0;
+  Triple TheTriple;
+
+  bool SkipModule =
+      MCPU == "help" || (!MAttrs.empty() && MAttrs.front() == "help");
+
+  // If user just wants to list available options, skip module loading
+  if (!SkipModule) {
+    M = parseIRFile(InputFilename, Err, Context);
+    mod = M.get();
+    if (mod == 0) {
+      Err.print(argv[0], errs());
+      return 1;
+    }
+
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      mod->setTargetTriple(Triple::normalize(TargetTriple));
+    TheTriple = Triple(mod->getTargetTriple());
+  } else {
+    TheTriple = Triple(Triple::normalize(TargetTriple));
+  }
+
+  if (TheTriple.getTriple().empty())
+    TheTriple.setTriple(sys::getDefaultTargetTriple());
+
+  // Get the target specific parser.
+  std::string Error;
+  // Override MArch
+  MArch = "c";
+  const Target *TheTarget =
+      TargetRegistry::lookupTarget(MArch, TheTriple, Error);
+  if (!TheTarget) {
+    errs() << argv[0] << ": " << Error << "\n";
+    return 1;
+  }
+
+  // Package up features to be passed to target/subtarget
+  std::string FeaturesStr;
+  if (MAttrs.size()) {
+    SubtargetFeatures Features;
+    for (unsigned i = 0; i != MAttrs.size(); ++i)
+      Features.AddFeature(MAttrs[i]);
+    FeaturesStr = Features.getString();
+  }
+
+  CodeGenOpt::Level OLvl = CodeGenOpt::Default;
+
+  switch (OptLevel) {
+  default:
+    errs() << argv[0] << ": invalid optimization level.\n";
+    return 1;
+  case ' ':
+    break;
+  case '0':
+    OLvl = CodeGenOpt::None;
+    break;
+  case '1':
+    OLvl = CodeGenOpt::Less;
+    break;
+  case '2':
+    OLvl = CodeGenOpt::Default;
+    break;
+  case '3':
+    OLvl = CodeGenOpt::Aggressive;
+    break;
+  }
+
+  TargetOptions Options;
+  Options.AllowFPOpFusion = FuseFPOps;
+  Options.UnsafeFPMath = EnableUnsafeFPMath;
+  Options.NoInfsFPMath = EnableNoInfsFPMath;
+  Options.NoNaNsFPMath = EnableNoNaNsFPMath;
+  Options.HonorSignDependentRoundingFPMathOption =
+      EnableHonorSignDependentRoundingFPMath;
+  if (FloatABIForCalls != FloatABI::Default)
+    Options.FloatABIType = FloatABIForCalls;
+  Options.NoZerosInBSS = DontPlaceZerosInBSS;
+  Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt;
+  Options.StackAlignmentOverride = OverrideStackAlignment;
+
+  // Jackson Korba 9/30/14
+  // OwningPtr<targetMachine>
+  std::unique_ptr<TargetMachine> target(TheTarget->createTargetMachine(
+      TheTriple.getTriple(), MCPU, FeaturesStr, Options, getRelocModel(),
+      getCodeModel(), OLvl));
+  assert(target.get() && "Could not allocate target machine!");
+  assert(mod && "Should have exited after outputting help!");
+  TargetMachine &Target = *target.get();
+
+  // Disable .loc support for older OS X versions.
+  if (TheTriple.isMacOSX() && TheTriple.isMacOSXVersionLT(10, 6)) {
+  }
+  // TODO: Find a replacement to this function
+  /* Greg Simpson 6-09-13
+  no member named setMCUseLoc
+  removed statement
+  Target.setMCUseLoc(false);  */
+
+  // Jackson Korba 9/30/14
+  std::unique_ptr<ToolOutputFile> Out(
+      GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
+  if (!Out)
+    return 1;
+
+  // Build up all of the passes that we want to do to the module.
+  legacy::PassManager PM;
+
+  // Add an appropriate TargetLibraryInfo pass for the module's triple.
+  TargetLibraryInfoWrapperPass *TLI =
+      new TargetLibraryInfoWrapperPass(TheTriple);
+  PM.add(TLI);
+
+  // Add intenal analysis passes from the target machine.
+  PM.add(createTargetTransformInfoWrapperPass(Target.getTargetIRAnalysis()));
+
+  if (RelaxAll) {
+    if (FileType != TargetMachine::CGFT_ObjectFile)
+      errs() << argv[0]
+             << ": warning: ignoring -mc-relax-all because filetype != obj\n";
+  }
+
+  // Ask the target to add backend passes as necessary.
+  if (Target.addPassesToEmitFile(PM, Out->os(),
+#if LLVM_VERSION_MAJOR >= 7
+                                 nullptr,
+#endif
+                                 FileType, NoVerify)) {
+    errs() << argv[0] << ": target does not support generation of this"
+           << " file type!\n";
+    return 1;
+  }
+
+  // Before executing passes, print the final values of the LLVM options.
+  cl::PrintOptionValues();
+
+  PM.run(*mod);
+
+  // Declare success.
+  Out->keep();
+
+  return 0;
+}
diff --git a/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.old b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.old
new file mode 100644
index 0000000000..55b19ff85b
--- /dev/null
+++ b/hpvm/projects/llvm-cbe/tools/llvm-cbe/llvm-cbe.old
@@ -0,0 +1,559 @@
+//===-- llc.cpp - Implement the LLVM Native Code Generator ----------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This is the llc code generator driver. It provides a convenient
+// command-line interface for generating native assembly-language code
+// or C code, given LLVM bitcode.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/TargetLibraryInfo.h"
+#include "llvm/CodeGen/CommandFlags.inc"
+#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
+#include "llvm/CodeGen/LinkAllCodegenComponents.h"
+#include "llvm/CodeGen/MIRParser/MIRParser.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/TargetPassConfig.h"
+#include "llvm/CodeGen/TargetSubtargetInfo.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/IR/DiagnosticPrinter.h"
+#include "llvm/IR/IRPrintingPasses.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
+#include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
+#include "llvm/IRReader/IRReader.h"
+#include "llvm/MC/SubtargetFeature.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/TargetRegistry.h"
+#include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/Utils/Cloning.h"
+#include <memory>
+using namespace llvm;
+
+extern "C" void LLVMInitializeCBackendTarget();
+extern "C" void LLVMInitializeCBackendTargetInfo();
+extern "C" void LLVMInitializeCBackendTargetMC();
+// General options for llc.  Other pass-specific options are specified
+// within the corresponding llc passes, and target-specific options
+// and back-end code generation options are specified with the target machine.
+//
+static cl::opt<std::string>
+InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+
+static cl::opt<std::string>
+OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
+
+static cl::opt<unsigned>
+TimeCompilations("time-compilations", cl::Hidden, cl::init(1u),
+                 cl::value_desc("N"),
+                 cl::desc("Repeat compilation N times for timing"));
+
+static cl::opt<bool>
+NoIntegratedAssembler("no-integrated-as", cl::Hidden,
+                      cl::desc("Disable integrated assembler"));
+
+static cl::opt<bool>
+    PreserveComments("preserve-as-comments", cl::Hidden,
+                     cl::desc("Preserve Comments in outputted assembly"),
+                     cl::init(true));
+
+// Determine optimization level.
+static cl::opt<char>
+OptLevel("O",
+         cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+                  "(default = '-O2')"),
+         cl::Prefix,
+         cl::ZeroOrMore,
+         cl::init(' '));
+
+static cl::opt<std::string>
+TargetTriple("mtriple", cl::desc("Override target triple for module"));
+
+static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+                              cl::desc("Do not verify input module"));
+
+static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
+                                             cl::desc("Disable simplify-libcalls"));
+
+static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
+                                    cl::desc("Show encoding in .s output"));
+
+static cl::opt<bool> EnableDwarfDirectory(
+    "enable-dwarf-directory", cl::Hidden,
+    cl::desc("Use .file directives with an explicit directory."));
+
+static cl::opt<bool> AsmVerbose("asm-verbose",
+                                cl::desc("Add comments to directives."),
+                                cl::init(true));
+
+static cl::opt<bool>
+    CompileTwice("compile-twice", cl::Hidden,
+                 cl::desc("Run everything twice, re-using the same pass "
+                          "manager and verify the result is the same."),
+                 cl::init(false));
+
+static cl::opt<bool> DiscardValueNames(
+    "discard-value-names",
+    cl::desc("Discard names from Value (other than GlobalValue)."),
+    cl::init(false), cl::Hidden);
+
+static cl::opt<std::string> StopAfter("stop-after",
+                            cl::desc("Stop compilation after a specific pass"),
+                            cl::value_desc("pass-name"),
+                                      cl::init(""));
+static cl::opt<std::string> StartAfter("start-after",
+                          cl::desc("Resume compilation after a specific pass"),
+                          cl::value_desc("pass-name"),
+                          cl::init(""));
+
+namespace {
+static ManagedStatic<std::vector<std::string>> RunPassNames;
+
+struct RunPassOption {
+  void operator=(const std::string &Val) const {
+    if (Val.empty())
+      return;
+    SmallVector<StringRef, 8> PassNames;
+    StringRef(Val).split(PassNames, ',', -1, false);
+    for (auto PassName : PassNames)
+      RunPassNames->push_back(PassName);
+  }
+};
+}
+
+static RunPassOption RunPassOpt;
+
+static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
+    "run-pass",
+    cl::desc("Run compiler only for specified passes (comma separated list)"),
+    cl::value_desc("pass-name"), cl::ZeroOrMore, cl::location(RunPassOpt));
+
+static int compileModule(char **, LLVMContext &);
+
+static std::unique_ptr<tool_output_file>
+GetOutputStream(const char *TargetName, Triple::OSType OS,
+                const char *ProgName) {
+  // If we don't yet have an output filename, make one.
+  if (OutputFilename.empty()) {
+    if (InputFilename == "-")
+      OutputFilename = "-";
+    else {
+      // If InputFilename ends in .bc or .ll, remove it.
+      StringRef IFN = InputFilename;
+      if (IFN.endswith(".bc") || IFN.endswith(".ll"))
+        OutputFilename = IFN.drop_back(3);
+      else if (IFN.endswith(".mir"))
+        OutputFilename = IFN.drop_back(4);
+      else
+        OutputFilename = IFN;
+
+      switch (FileType) {
+      case TargetMachine::CGFT_AssemblyFile:
+        if (TargetName[0] == 'c') {
+          if (TargetName[1] == 0)
+            OutputFilename += ".cl";
+//            OutputFilename += ".cbe.c";
+          else if (TargetName[1] == 'p' && TargetName[2] == 'p')
+            OutputFilename += ".cpp";
+          else
+            OutputFilename += ".s";
+        } else
+          OutputFilename += ".s";
+        break;
+      case TargetMachine::CGFT_ObjectFile:
+        if (OS == Triple::Win32)
+          OutputFilename += ".obj";
+        else
+          OutputFilename += ".o";
+        break;
+      case TargetMachine::CGFT_Null:
+        OutputFilename += ".null";
+        break;
+      }
+    }
+  }
+
+  // Decide if we need "binary" output.
+  bool Binary = false;
+  switch (FileType) {
+  case TargetMachine::CGFT_AssemblyFile:
+    break;
+  case TargetMachine::CGFT_ObjectFile:
+  case TargetMachine::CGFT_Null:
+    Binary = true;
+    break;
+  }
+
+  // Open the file.
+  std::error_code EC;
+  sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
+  if (!Binary)
+    OpenFlags |= sys::fs::F_Text;
+  auto FDOut = llvm::make_unique<tool_output_file>(OutputFilename, EC,
+                                                   OpenFlags);
+  if (EC) {
+    errs() << EC.message() << '\n';
+    return nullptr;
+  }
+
+  return FDOut;
+}
+
+static void DiagnosticHandler(const DiagnosticInfo &DI, void *Context) {
+  bool *HasError = static_cast<bool *>(Context);
+  if (DI.getSeverity() == DS_Error)
+    *HasError = true;
+
+  DiagnosticPrinterRawOStream DP(errs());
+  errs() << LLVMContext::getDiagnosticMessagePrefix(DI.getSeverity()) << ": ";
+  DI.print(DP);
+  errs() << "\n";
+}
+
+// main - Entry point for the llc compiler.
+//
+int main(int argc, char **argv) {
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
+  PrettyStackTraceProgram X(argc, argv);
+
+  // Enable debug stream buffering.
+  EnableDebugBuffering = true;
+
+  LLVMContext Context;
+  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.
+
+  // Initialize targets first, so that --version shows registered targets.
+  InitializeAllTargets();
+  InitializeAllTargetMCTargetMachineCs();
+  InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
+
+  LLVMInitializeCBackendTarget();
+  LLVMInitializeCBackendTargetInfo();
+  LLVMInitializeCBackendTargetMC();
+  // Initialize codegen and IR passes used by llc so that the -print-after,
+  // -print-before, and -stop-after options work.
+  PassRegistry *Registry = PassRegistry::getPassRegistry();
+  initializeCore(*Registry);
+  initializeCodeGen(*Registry);
+  initializeLoopStrengthReducePass(*Registry);
+  initializeLowerIntrinsicsPass(*Registry);
+
+  initializeLoopInfoWrapperPassPass(*Registry);
+  initializePostDominatorTreeWrapperPassPass(*Registry);
+  initializeScalarEvolutionWrapperPassPass(*Registry);
+  initializeDominatorTreeWrapperPassPass(*Registry);
+  initializeAssumptionCacheTrackerPass(*Registry);
+  //initializeUnreachableBlockElimLegacyPassPass(*Registry);
+
+  // Register the target printer for --version.
+  cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+
+  cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
+
+  Context.setDiscardValueNames(DiscardValueNames);
+
+  // Set a diagnostic handler that doesn't exit on the first error
+  bool HasError = false;
+  Context.setDiagnosticHandler(DiagnosticHandler, &HasError);
+
+  // Compile the module TimeCompilations times to give better compile time
+  // metrics.
+  for (unsigned I = TimeCompilations; I; --I)
+    if (int RetVal = compileModule(argv, Context))
+      return RetVal;
+  return 0;
+}
+
+static bool addPass(PassManagerBase &PM, const char *argv0,
+                    StringRef PassName, TargetPassConfig &TPC) {
+  if (PassName == "none")
+    return false;
+
+  const PassRegistry *PR = PassRegistry::getPassRegistry();
+  const PassInfo *PI = PR->getPassInfo(PassName);
+  if (!PI) {
+    errs() << argv0 << ": run-pass " << PassName << " is not registered.\n";
+    return true;
+  }
+
+  Pass *P;
+  if (PI->getTargetMachineCtor())
+    P = PI->getTargetMachineCtor()(&TPC.getTM<TargetMachine>());
+  else if (PI->getNormalCtor())
+    P = PI->getNormalCtor()();
+  else {
+    errs() << argv0 << ": cannot create pass: " << PI->getPassName() << "\n";
+    return true;
+  }
+  std::string Banner = std::string("After ") + std::string(P->getPassName());
+  PM.add(P);
+  TPC.printAndVerify(Banner);
+
+  return false;
+}
+
+static int compileModule(char **argv, LLVMContext &Context) {
+  // Load the module to be compiled...
+  SMDiagnostic Err;
+  std::unique_ptr<Module> M;
+  std::unique_ptr<MIRParser> MIR;
+  Triple TheTriple;
+
+  bool SkipModule = MCPU == "help" ||
+                    (!MAttrs.empty() && MAttrs.front() == "help");
+
+  // If user just wants to list available options, skip module loading
+  if (!SkipModule) {
+    //if (StringRef(InputFilename).endswith_lower(".mir")) {
+      //MIR = createMIRParserFromFile(InputFilename, Err, Context);
+      //if (MIR)
+        //M = MIR->parseLLVMModule();
+    //} else
+      M = parseIRFile(InputFilename, Err, Context);
+    if (!M) {
+      Err.print(argv[0], errs());
+      return 1;
+    }
+
+    // Verify module immediately to catch problems before doInitialization() is
+    // called on any passes.
+    if (!NoVerify && verifyModule(*M, &errs())) {
+      errs() << argv[0] << ": " << InputFilename
+             << ": error: input module is broken!\n";
+      return 1;
+    }
+
+    // If we are supposed to override the target triple, do so now.
+    if (!TargetTriple.empty())
+      M->setTargetTriple(Triple::normalize(TargetTriple));
+    TheTriple = Triple(M->getTargetTriple());
+  } else {
+    TheTriple = Triple(Triple::normalize(TargetTriple));
+  }
+
+  if (TheTriple.getTriple().empty())
+    TheTriple.setTriple(sys::getDefaultTargetTriple());
+
+  // Get the target specific parser.
+  std::string Error;
+  // Override MArch
+
+  // NOTE: The Backend is selected HERE
+  MArch = "c"; //FIX ME
+  const Target *TheTarget = TargetRegistry::lookupTarget(MArch, TheTriple,
+                                                         Error);
+  if (!TheTarget) {
+    errs() << argv[0] << ": " << Error;
+    return 1;
+  }
+
+  std::string CPUStr = getCPUStr(), FeaturesStr = getFeaturesStr();
+
+  CodeGenOpt::Level OLvl = CodeGenOpt::Default;
+  switch (OptLevel) {
+  default:
+    errs() << argv[0] << ": invalid optimization level.\n";
+    return 1;
+  case ' ': break;
+  case '0': OLvl = CodeGenOpt::None; break;
+  case '1': OLvl = CodeGenOpt::Less; break;
+  case '2': OLvl = CodeGenOpt::Default; break;
+  case '3': OLvl = CodeGenOpt::Aggressive; break;
+  }
+
+  TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
+  Options.DisableIntegratedAS = NoIntegratedAssembler;
+  Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+  Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+  Options.MCOptions.AsmVerbose = AsmVerbose;
+  Options.MCOptions.PreserveAsmComments = PreserveComments;
+
+//  std::unique_ptr<TargetMachine> Target(
+  TargetMachine *Target(
+      TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
+                                     Options, getRelocModel(), CMModel, OLvl));
+
+  assert(Target && "Could not allocate target machine!");
+
+  // If we don't have a module then just exit now. We do this down
+  // here since the CPU/Feature help is underneath the target machine
+  // creation.
+  if (SkipModule)
+    return 0;
+
+  assert(M && "Should have exited if we didn't have a module!");
+  if (FloatABIForCalls != FloatABI::Default)
+    Options.FloatABIType = FloatABIForCalls;
+
+  // Figure out where we are going to send the output.
+  std::unique_ptr<tool_output_file> Out =
+      GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
+  if (!Out) return 1;
+
+  // Build up all of the passes that we want to do to the module.
+  legacy::PassManager PM;
+
+  // Add an appropriate TargetLibraryInfo pass for the module's triple.
+  TargetLibraryInfoImpl TLII(Triple(M->getTargetTriple()));
+
+  // The -disable-simplify-libcalls flag actually disables all builtin optzns.
+  if (DisableSimplifyLibCalls)
+    TLII.disableAllFunctions();
+  PM.add(new TargetLibraryInfoWrapperPass(TLII));
+
+  // Add the target data from the target machine, if it exists, or the module.
+  M->setDataLayout(Target->createDataLayout());
+
+  // Override function attributes based on CPUStr, FeaturesStr, and command line
+  // flags.
+  setFunctionAttributes(CPUStr, FeaturesStr, *M);
+
+  if (RelaxAll.getNumOccurrences() > 0 &&
+      FileType != TargetMachine::CGFT_ObjectFile)
+    errs() << argv[0]
+             << ": warning: ignoring -mc-relax-all because filetype != obj";
+
+  {
+    raw_pwrite_stream *OS = &Out->os();
+
+    // Manually do the buffering rather than using buffer_ostream,
+    // so we can memcmp the contents in CompileTwice mode
+    SmallVector<char, 0> Buffer;
+    std::unique_ptr<raw_svector_ostream> BOS;
+    if ((FileType != TargetMachine::CGFT_AssemblyFile &&
+         !Out->os().supportsSeeking()) ||
+        CompileTwice) {
+      BOS = make_unique<raw_svector_ostream>(Buffer);
+      OS = BOS.get();
+    }
+
+    AnalysisID StartBeforeID = nullptr;
+    AnalysisID StartAfterID = nullptr;
+    AnalysisID StopAfterID = nullptr;
+    const PassRegistry *PR = PassRegistry::getPassRegistry();
+    if (!RunPassNames->empty()) {
+      if (!StartAfter.empty() || !StopAfter.empty()) {
+        errs() << argv[0] << ": start-after and/or stop-after passes are "
+                             "redundant when run-pass is specified.\n";
+        return 1;
+      }
+      if (!MIR) {
+        errs() << argv[0] << ": run-pass needs a .mir input.\n";
+        return 1;
+      }
+      LLVMTargetMachine *LLVMTM = static_cast<LLVMTargetMachine*>(Target);
+      TargetPassConfig *TPC = LLVMTM->createPassConfig(PM);
+      PM.add(TPC);
+      
+//      LLVMTM.addMachineModuleInfo(PM);
+//      LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
+      MachineModuleInfo *MMI = new MachineModuleInfo(LLVMTM);
+      MMI->setMachineFunctionInitializer(MIR.get());
+      PM.add(MMI);
+      
+      TPC->printAndVerify("");
+
+      for (const std::string &RunPassName : *RunPassNames) {
+        if (addPass(PM, argv[0], RunPassName, *TPC))
+          return 1;
+      }
+      PM.add(createPrintMIRPass(*OS));
+    } else {
+      if (!StartAfter.empty()) {
+        const PassInfo *PI = PR->getPassInfo(StartAfter);
+        if (!PI) {
+          errs() << argv[0] << ": start-after pass is not registered.\n";
+          return 1;
+        }
+        StartAfterID = PI->getTypeInfo();
+      }
+      if (!StopAfter.empty()) {
+        const PassInfo *PI = PR->getPassInfo(StopAfter);
+        if (!PI) {
+          errs() << argv[0] << ": stop-after pass is not registered.\n";
+          return 1;
+        }
+        StopAfterID = PI->getTypeInfo();
+      }
+
+      // Ask the target to add backend passes as necessary.
+      if (Target->addPassesToEmitFile(PM, *OS, FileType, NoVerify,
+                                      StartBeforeID, StartAfterID, StopAfterID,
+                                      MIR.get())) {
+        errs() << argv[0] << ": target does not support generation of this"
+               << " file type!\n";
+        return 1;
+      }
+    }
+
+    // Before executing passes, print the final values of the LLVM options.
+    cl::PrintOptionValues();
+
+    // If requested, run the pass manager over the same module again,
+    // to catch any bugs due to persistent state in the passes. Note that
+    // opt has the same functionality, so it may be worth abstracting this out
+    // in the future.
+    SmallVector<char, 0> CompileTwiceBuffer;
+    if (CompileTwice) {
+      std::unique_ptr<Module> M2(llvm::CloneModule(M.get()));
+      PM.run(*M2);
+      CompileTwiceBuffer = Buffer;
+      Buffer.clear();
+    }
+
+    PM.run(*M);
+
+    auto HasError = *static_cast<bool *>(Context.getDiagnosticContext());
+    if (HasError)
+      return 1;
+
+    // Compare the two outputs and make sure they're the same
+    if (CompileTwice) {
+      if (Buffer.size() != CompileTwiceBuffer.size() ||
+          (memcmp(Buffer.data(), CompileTwiceBuffer.data(), Buffer.size()) !=
+           0)) {
+        errs()
+            << "Running the pass manager twice changed the output.\n"
+               "Writing the result of the second run to the specified output\n"
+               "To generate the one-run comparison binary, just run without\n"
+               "the compile-twice option\n";
+        Out->os() << Buffer;
+        Out->keep();
+        return 1;
+      }
+    }
+
+    if (BOS) {
+      Out->os() << Buffer;
+    }
+  }
+
+  // Declare success.
+  Out->keep();
+
+  return 0;
+} 
-- 
GitLab