Posts

Showing posts from March, 2025

Stage 1 Completed

Project Stage 1 Completed! For the first stage of my SPO600 project, I created a custom GCC pass that prints out the name of each function being compiled, along with the number of basic blocks and GIMPLE statements in that function. This gave me a deeper look into how the compiler breaks down high-level code during the compilation process. Setting Up My Environment I used the recommended three-directory setup: ~/git/gcc/         # GCC source directory ~/gcc-build-001/   # Build directory ~/gcc-test-001/    # Install/test directory I followed the official GCC documentation to configure the build: ../git/gcc/configure --prefix=$HOME/gcc-test-001 --enable-languages=c --disable-bootstrap --disable-multilib time make -j$(nproc) |& tee build.log The build process took a while at first, but using make for incremental rebuilds really saved time later. I made sure to always build inside a screen session so I wouldn't lose progress if my SSH connection dro...

Project Stage 1 Diving In!

  Project Stage 1 – Understanding GCC Passes and Setting things UP Alright, time to dive into the SPO600 course project! In Stage 1, our goal is to create a basic GCC pass that can analyze a program during compilation and print out some useful info. This is my first time working this closely with the GCC compiler, and let me just say, it’s a deep rabbit hole. But it’s also been really interesting figuring things out. In this post, I’ll talk about: What the project is about How I approached it Some of the issues I ran into and how I fixed them What’s This Project About? GCC processes code in multiple steps called passes . These passes can analyze and transform code at various intermediate stages before turning it into machine code. For this project, I had to: Iterate through each function being compiled Print the name of each function Count how many basic blocks are in each function Count how many GIMPLE statements are in each function These details come from GCC's internal repre...