Some of the transforms implemented by the CPPC compiler are semantic-directed. These require certain semantic information about which function calls implement certain semantics and how. Since source code in imperative languages is not intrinsically semantic, it is necessary to provide semantic information to the compiler. The mechanism for supplying this information is extensible and not tied to specific implementations of a semantic, fulfilling the portability target present in CPPC.
The compiler reads this semantic information from XML files having a given, simple format. Take a look at the "linux-module.xml" in the "compiler/semantic-meta" subdirectory. Each of this files is called a "semantic module", and contains semantic information about a collection of related procedures. Each procedure can have any number of semantic tags, each one of them having a "role" identifier and, optionally, a number of attributes that give further information on how the procedure implements the given semantic.
Look, for example, at the UNIX fopen and open functions. Both accept two parameters: a path string and modifiers on how to open the file, and both return a reference to the opened file. This information is passed to the compiler in the semantic description of the functions. This reference is different for each one of them, a FILE * for the fopen function and an integer for open. The given "DescriptorType" attribute tells the compiler which type of file descriptor does the function return.
Besides semantic information, these files also contain data flow information. The input, output and input-output parameter tags contain information about the outcome, in terms of data flow, of the call to a certain procedure. This is useful for optimizing the amount of information saved to disk by providing some information about opaque function calls to the data flow analyses.
The current release of CPPC includes semantic modules for common POSIX functions, MPI, and common Fortran intrinsics. If you intend to provide support for a specific family of functions not included with CPPC, follow these steps: