We implemented our method in the SUIF2 research compiler framework[7]. Within this framework, the method works on each ProcedureDefinition. All annotations are appended to the ProcedureSymbol corresponding to the ProcedureDefinition. In a ProcedureDefinition, the method first looks for any occurrence of StoreStatement or any occurrence of StoreVariableStatement with a global variable as the destination. If such a case is found, the method annotates the procedure as unreusable and terminates. If the opposite occurs, then the method proceeds to look for any occurrence of LoadExpression or any occurrence of LoadVariableExpression with a global variable as source in the ProcedureDefinition. The method stores a value to remember this fact, but in both cases it does not terminate. Instead, it goes through each CallExpression and CallStatement. For each call where the symbol of the function being called is available (i.e. not a call through function pointers), the method checks the annotation for the corresponding ProcedureSymbol. If the ProcedureSymbol contains no annotation for results, then we run the method on its ProcedureDefinition. Functions containing no definition (i.e. functions defined in other compilation unit or available in a library) are considered unreusable. We refer to the previous section for how we determine the attribute of the currently analyzed function based on both the stores or loads and function calls.
To enable our analysis results to be passed to GCC, we have to convert the SUIF representation to C. In particular, we need to modify the s2c program that comes in the SUIF2 distribution so that the SUIF annotations are converted properly to the GCC attribute annotations, similar to the example in figure 2. This involves modifying the macro file defining the rules for converting SUIF representation to C (nci/suif/suif2b/basesuif/s2c/c_text.mac in a standard SUIF2 distribution).