In this article, I will get into the IR generated by the llvm-g++ along with the systemc library.
Understand the installation flow of PinaVM
The project is to mimic the idea of PinaVM, but I have to repeat the first few steps to understand the relationship between llvm-g++ and systemc library. Check out the /doc/install document for details.
One limit is that you have to use LLVM 2.6, which may suffer incompatible features with the latest version.
Start from autoconf part, which is Step 3 in the manual
1. autoconf
What the autoconf do is to seek a file named configure.ac (or configure.in for backward compatibility), and then runs the M4 macro processor to create the configure script.
2. configrue
command ./configure --with-tools-dir=$DOWNLOAD
Part of the output:
configure: Summary of variables:The code in the configure.ac file:
DOWNLOAD_AND_COMPILE_DIR: /home/chenrui/Desktop/pinavm/download
INSTALL_PATH_LLVM: /home/chenrui/Desktop/pinavm/lib/llvm-2.7
INSTALL_PATH_LLVMGCC: /home/chenrui/Desktop/pinavm/lib/llvm-gcc
INSTALL_PATH_SYSTEMC_LLVM: /home/chenrui/Desktop/pinavm/lib/systemc-2.2.0-llvm
INSTALL_PATH_SYSTEMC_GCC: /home/chenrui/Desktop/pinavm/lib/systemc-2.2.0-gcc
configure: creating ./config.status
config.status: creating config.mk
config.status: creating config.sh
DOWNLOAD_AND_COMPILE_DIR="${TOOLS_DIR}/download"So the "--with-tools-dir" means specifying the $DOWNLOAD directory for ${TOOLS_DIR}.
INSTALL_PATH_LLVM=${TOOLS_DIR}/lib/llvm-2.7
INSTALL_PATH_LLVMGCC=${TOOLS_DIR}/lib/llvm-gcc
INSTALL_PATH_SYSTEMC_LLVM=${TOOLS_DIR}/lib/systemc-2.2.0-llvm
INSTALL_PATH_SYSTEMC_GCC=${TOOLS_DIR}/lib/systemc-2.2.0-gcc
Another part of configure.ac:
# Defining files to be generatedThen config.mk and config.sh will be generated.
AC_CONFIG_FILES([config.mk
config.sh])
NOTE: normally, AC_CONFIG_FILES([Makefile]) is used(ref link).
Motivation to use SystemC and LLVM
I have done a simple literal translator with SystemC-to-VHDL translator with ANTLR, and I think it needs tremendous effort to crack the whole C++ grammar.
Besides, sc2v and gsc and many tools are based on their self-made compilers, which suffers a severe issue that only a small set of systemc grammar can be compiled.
Based on this understanding, it is very important to immigrate the translation method from ANTLR literal way to llvm-g++ based.
Generate simple backend first.
Another idea about working with C++ & Systemc with LLVM is that I can generate a VHDL experiment backend for test first and then connect it to the systemc frontend.
So little articles and documents about how to use PinaVM, especially in China. Now my work needs a SystemC front-end, and I think PinaVM is the better, so hope you will contribute more articles about PinaVM. Good job, best wishes.
ReplyDeleteThe 5 Best Casinos in Palm Springs - JTM Hub
ReplyDeleteBest 5 Casinos in Palm Springs · Las 군포 출장안마 Vegas Sands, 대전광역 출장마사지 the casino's 계룡 출장안마 most successful operator and The 상주 출장마사지 best Palm Springs casinos: Casino 부천 출장샵 in Palm Springs.