Posts

Showing posts from April, 2025

PROJECT STAGE3

Image
 Introduction: For Stage III, my goal is to further validate and demonstrate that my project can accurately process multiple cloned functions in a single program and make individual PRUNE/NOPRUNE recommendations for each one. In fact, my project has already supported this functionality since Stage II. To identify cloned functions, I extract the base function name from fun->decl, then iterate over all functions in the program using FOR_EACH_FUNCTION(node) while ensuring each has a valid name. I check if a function’s name starts with the base name and includes a dot (.) afterward, which typically signifies a clone. I also skip any functions containing .resolver in their name. Functions that meet these criteria are printed as cloned functions. This approach allows the detection of multiple clones, assuming they follow GCC’s naming conventions. To enable this analysis, DUMP_ALL must be set to 1 to activate all GCC dumps. For this stage, I will create test cases with at least two clo...

PROJECT STAGE2

Image
Introduction: In this task, I am required to create a pass for the GCC compiler that analyzes cloned functions in a program and determines whether or not they should be pruned. The goal is to identify cloned functions and compare them to see if they are "substantially the same" or different. I will find which functions are cloned and then analyze the differences between the two versions of the function. If the functions are identical except for things like variable names or labels, I will indicate that the function can be pruned. If they are different, I will indicate that the function should not be pruned. The functions are cloned using the FMV (Function Multi-Versioning) mechanism, which automatically handles function versioning. My pass must be positioned late in the compilation process, after optimizations are complete. To compare the cloned functions, I can either examine each statement or use a hash/signature to check if they are the same. Comparing Cloned Function Vers...