An annotation provides additional information that may be helpful to the compiler in generating better executables.
Annotations can be attached to nodes of the Clef AST or Scribble CFG.
Removal of an annotation does not invalidate the program representation.
Annotations may be provided by both the user and the Scale compiler.
A confidence factor is provided for every annotation.
Annotations may also be supplied to the Scale compiler via text files. In the case of annotations
for pure functions, files have been created for the C library and Fortran library.
The format for an annotation is
- pure functions - analysis phases may be bypassed depending on the level of pureness:
Pure function annotations are added by an analysis phase to the routines being compiled and may be specified via files for external routines.
- modifies global variables
- references global variables
- modifies locations specified by arguments
- commutable user-defined functions - arguments (A, B) may be swapped with arguments (C,D)
SUBROUTINE INNERPRD(V1, LV1, V2, LV2, RESULT)
DIMENSION V1(LV1), V2(LV2)
In this example, the INNERPRD routine performs an inner-product calculation on two vectors in Fortran.
If arguments V1&LV1 are switched with V2&LV2, the result is the same.
annotation-class-name class-name annotation-information;
Java's reflection capability is used to apply annotations specified by a text file.
- specifies the type of annotation,
- specifies the class of the instance to be annotated, and, in this example,
- species the particular class instance and other information specifiec to the annotation.
Return to Scale home page.
(Last changed: March 21, 2007.)