My Personal Info


Technical Tips

  • how to build a debug and assertion version of LLVM: ./configure --disable-optimized --enable-assertions
  • the option to know execution details of LLVM llc: --debug-pass={Structure, Executions, Details}
  • Emacs outline mode
    1. enter outline mode: M-x outline-mode
    2. hide the body of all entries: C-c C-t
    3. reveals all hidden material: C-c C-a
  • run a program on a specific CPU core: schedtool -a 0x1 -e Program ( 0x1 means CPU0, 0x2 means CPU1, 0x4 means CPU2)
  • build llvm gold plugin
    1. download binutils source code package, llvm source code package, and llvm-gcc frondend executable package
    2. build gold from binutils source code package with configure options --enable-gold --enable-plugins, and use to replace ld in the bin directory
    3. build llvm from llvm source code package with a configure option --with-binutils-include=/path/to/binutils/src/include
    4. unzip llvm-gcc frondend executable package
    5. copy /path/to/llvm/install/lib/ to /path/to/llvm-gcc-frontend/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/
    6. add all executable directories to PATH
    7. add /path/to/llvm/install/lib to LD_LIBRARY_PATH and export it
    8. call llvm-gcc -O4 -c to generate bit-code objective files, and call llvm-gcc -use-gold-plugin to do link-time optimizations and generate the final executable
  • cache info is in /sys/devices/system/cpu/cpu0/cache/index0. "cpu+(a number)" is for a specific physical thread. "index+(a number)" is for a specific cache like L1 data/inst cache or L2 unified cache.
  • the sizeof() information
N-bit machine void* char int unsigned int long unsigned long long long unsigned long longSorted ascending float double long double
32 4 1 4 4 4 4 8 8 4 8 12
64 8 1 4 4 8 8 8 8 4 8 16

  • how to (re)start ssh server: sudo /etc/init.d/ssh restart
  • how to output a single LLVM bitcode file:
    llvm-gcc -O4 -c xxx1.c -o xxx1.bc
    llvm-link xxx1.bc xxx2.bc ... -o yyy.bc
    opt -std-link-opts yyy.bc -o zzz.bc
  • run matlab without gui: matlab -nodesktop, the