Posts

Showing posts from December, 2024

Project Stage 3: Tidy & Wrap

Introduction In this stage, I aimed to address the feedback provided by the professor and resolve the errors encountered in the previous stages of the GCC pass project. However, despite my efforts, I have faced significant challenges that have hindered my progress. Process and Steps Taken Building and Testing the Demo Pass - I started by building and testing the provided demo pass to understand its functionality. - However, I encountered several issues during this process, which are detailed below. Modifying the Pass 1. Adding Diagnostic Dumps :    - I attempted to modify the pass to include diagnostic dumps to demonstrate its execution.    - Example code snippet:      ```cpp      if (dump_file)        {          fprintf (dump_file, "===== Dummy Pass Diagnostic Dump =====\n");        }      ``` 2. Iterating Through Code Being Compiled :    - I updat...

Project Stage 2: Clone-Pruning Analysis Pass

  Project Stage 2 Goal In Stage 2 of my project, the goal was to create a pass for the GCC compiler that would analyze the program and identify cloned functions. It would then compare these cloned functions to check if they are very similar, and decide whether they should be removed (pruned) or kept. The decision would be shown in the GCC diagnostic dump as either "PRUNE" or "NOPRUNE." Step 1: Creating the Dummy Pass I started by creating a simple dummy pass that would only output basic messages. This was to make sure everything was working properly before I added more complex logic. Step 2: Iterating Through the Program Code Once the dummy pass was working, I moved on to the next step. This involved writing logic to go through the functions in the program being compiled. GCC uses an intermediate representation called GIMPLE, and I used this to read through and prepare the functions for the next steps. Step 3: Identifying Cloned Functions In this step, I added the l...