LLVM Utilities and Hacks

Combining all of your bitcode files into one file. LLVM passes operate on modules which are the equivalent of a single source code file. If your pass needs to analyze the whole program at one time without moving from file to file, then you will want to combine all of them together. Use the following steps to accomplish this.

1. Run the existing Clang tool on each source file, using -emit-llvm to generate a .bc file for each module.
2. Run llvm-link to merge them into a single .bc file.

Generating source code that generates a bitcode file. The program LLC will allow you to take a .bc file and convert it into a C++ source file, whose output is the original .bc file. This would come in handy if you wanted to see which llvm classes and methods are being used to generate the llvm IR that you will be writing a pass for. Do accomplish this use the following steps.

1. Run the existing Clang tool on each source file, using -emit-llvm to generate a .bc file for each module.
2. Run llc -march=cpp on every .bc file to generate a .cpp file for each.