next up previous contents external
Next: Creating new resources Up: Using the PIPS data Previous: Using the PIPS data

Loading and storing resources

Since the only useful operations are to get a resource from or to put a resource into PIPSDBM , the programmer interface is reduced to

string db_get_resource(string resource_name, string module_name, bool genuine)
void db_put_resource(string resource_name, string module_name, void* value)

The first function returns a pointer to the data structure ressource_name for module module_name. If genuine is TRUE , the programmer gets the genuine resource. That means that modifying it will modify the resource used by subsequent users. The genuine flag with a value TRUE is useful to modify a resource or to use it read-only for example. When using it as a scratch-pad or modifying it to transform it in another resource , one must ask for a copy of the genuine resource with the value FALSE for flag genuine.

For our dead code elimination, we need to modify the module code, thus we need to get the genuine resource and put it back into PIPSDBM . The information about the code used to simplify it is used on a read only basis, that means that the genuine resources can be accessed to avoid useless copies since we do not modify them. DBR_CODE (the abstract syntaxic tree of the module), DBR_PROPER_EFFECTS (the proper effects of the statements of the module) and DBR_PRECONDITIONS (the preconditions for the statements of the modules). We can now write the main function for our dead code elimination as shown on Figure 6 with the use of PIPSDBM .

   figure1163
Figure: Excerpt of the main function of the dead code elimination phase .


next up previous contents external
Next: Creating new resources Up: Using the PIPS data Previous: Using the PIPS data

Ronan KERYELL
vendredi, 20 décembre 1996, 16:25:47 MET