Posts

Project Stage 3: Clone-Prune Analysis Across Architectures

Image
  Welcome to the final stage of my GCC compiler project series! This blog documents my journey through Stage 3: Clone-Prune Analysis , where I implemented a custom compiler pass to detect and compare function clones across architectures. Below, I walk through the objective, challenges faced, implementation details, test results, and key takeaways. Project Objective The primary goal for Stage 3 was to create a Clone-Prune Analysis Pass that detects cloned functions generated by the compiler and determines whether they are functionally identical or should be pruned. The pass must: Work across multiple cloned functions, not just one. Skip resolver functions created by the GCC. Output analysis results that are architecture-independent . Generate diagnostic logs for verification. The pass was tested on both x86_64 and aarch64 architectures. Implementation Overview Setting Up the Pass To implement the clone-prune analysis, I: Declared the pass factory in tree-pass.h : gimple_opt_pass...