Saturday, 10 December 2016

How to change colors for vim syntax highlighting when use clang-format style

Note I copied the ./utils/vim/vimrc in llvm source to the default .vimrc in my home directory. If you just want to change the ./utils/vim/vimrc  file, you can do it there.

(1) Open  ~/.vimrc file    (or Open  ./utils/vim/vimrc)
(2) Find and change the following line:
From:
  highlight LongLine ctermbg=DarkYellow  guibg=DarkYellow
To:
  highlight LongLine ctermbg=LightBlue  guibg=DarkYellow

Friday, 9 December 2016

How to calculate the summation of all the numbers in first column of a file

Calculate the summation of all the number in the first (1) column in file test.stats and print out the result.
cat test.stats |  awk '{s+=$1} END {printf "%.0f\n", s}'

clang build VERBOSE and debug llvm

44. How to show clang build verbose message? Like the detailed build command and options?
add VERBOSE=1, like:
make VERBOSE=1

45. How to debug llvm without gdb?
add option:
 -mllvm -debug -mllvm -print-after-all -mllvm -print-before-all
This is give you enough information to start with.

Thursday, 8 December 2016

Adding a block to a function


A function consists of basic blocks. A basic block has an entry point. A basic block consists of a number of IR instructions, the last instruction being a terminator instruction. It has single exit point. LLVM provides the BasicBlock class to create and handle basic blocks. A basic block might have an entry point as its label, which indicates where to insert the next instructions. We can use the IRBuilder object to hold these new basic block IR.

Wednesday, 7 December 2016

Check Compilation Pass Info

41. How to check the compilation pass info for clang for PPC?
Check file PPCTargetMachine.cpp and
./include/llvm/CodeGen/Passes.h
Top-level implementation for the PowerPC target.