next up previous
Next: A Description of Up: adding a directive/assertion Previous: Terminology

Adding a new assertion

The following steps must be taken to add an assertion to Polaris:

  1. Add an value to the enum AssertionType list in base/Directive/Assertion.h. For instance, in adding an assertion to hold the names of the shared variables used within a loop, AS_SHARED was added to that list.
  2. Add a .h file to define a class to hold the new assertion type, and add a #include line for it in the file base/Directive/Assertion.all.h. The .h file can probably be modeled after one of the existing .h files.

    The programmer must (at present) choose between two types of assertions: an ExpressionAssertion and a StringAssertion. The former contains a list of expressions and the latter contains a list of character strings. The new assertion class must be derived from one of these two base classes (which are in turn both derived from class Assertion).

    For the AS_SHARED assertions, since they contain lists of variable names, the AssertPrivate.h file was used as a model.

  3. Add a section to the file base/Directive/Assertion.cc to implement the member functions declared in the class definition .h file mentioned above. This can probably be modeled after existing code in that file.

    For the AS_SHARED assertions, the AssertPrivate section was used as a model.

  4. Add a case in each routine Directive::generate_ output_language _directive() in base/Directive/Directive.cc for the assertion type being added. The output language CSRD should directly display the directive. A new routine should be added to Directive.cc for each unique way of displaying the new assertion. These routines are named in the form generate_ output_language_ assertion-type _directive. If a particular output language does not have a way to represent the new asssertion, it should use the CSRD$ form.

    For the AS_SHARED assertions, the routine to generate SGI directives ( Directive::generate_sgi_directive), and the routine to generate CSRD directives ( Directive::generate_csrd_directive) were modified to produce the proper directives from the AssertShared assertions.

  5. The parser.g file must be altered to enable it to accept the new directives on input. This file is a PCCTS input file. The format of this file is very specialized (described in ???), but there is lots of code in there, and the developer can likely find something to use as a model for whatever needs to be done.

    For the SGI SHARE clause to the C$DOACROSS directive, code was added to the parser_sgi_doacross routine to recognize it, and construct the appropriate AssertShared assertion.

  6. For each new routine added to Directive.cc, add a declaration for it to base/Directive/Directive.h.


next up previous
Next: A Description of Up: adding a directive/assertion Previous: Terminology



Jay Hoeflinger
Mon Apr 21 11:52:18 CDT 1997