This lab is about creating a transformation pass with LLVM.
You can largely base your code off of the example code
described in the video and available
For this lab, you should extend / alter the cool pass
to create a new analysis pass. It should accept the argument
cooler-pass and print out, for each function in the
analyzed code, the number of basic blocks in each function
(Hint: you can get the list of blocks using
and get the size of the result).
For example, the output of the code on fact.ll is:
_Z4facti has 4 blocks main has 1 blocks
Assuming that you keep the library name as libCoolPass, this would be invoked by
Create a tarball consisting of a single directory with all of your work in it,
such as code or written answers.
If you have any auxiliary files (READMEs, Makefiles, etc.), be sure
to include those as well.
Name your work directory l13 and name
the tarball l13.tgz.
Upload your tarball to the L13 Canvas assignment.
Labs will be graded under one of following criteria:
You will automatically be given full credit for the labwork if the GTA
determines that your participation in the lab was meaningful - i.e. you
attended the lab session and used the time to make a good-faith attempt to
complete the work. It is the sole discretion of the GTA to determine
if you put in sufficient effort. Even if you expect an effort-based grade,
you should turn in your (possibly incomplete) work.
If you do not participant meaningfully in lab (i.e. you do not attend the
lab session), your grade will be assessed based on the correctness of your
Advice: How to Approach Labs
The two-criteria grading scheme above is designed to avoid wasting your time.
You should not feel obligated to attend the lab, and in fact should only
do so if you want help from the GTA on the labwork assignment
or whatever project is currently in progress. Here's a handy flowchart
for how I suggest you approach lab: