J3/05-160 Date: 9-Feb-2005 To: J3 From: Bill Long/HPC Subject: Pointers and Targets Processor speeds have increased to very much faster rates than memory speeds, and compilers have improved to the point where most code sequences are nearly perfectly optimized. Pointers and targets complicate aliasing analysis. Therefore, more information regarding aliasing is essential for very high computational rates. Title: Pointers and Targets Submitted By: J3 Status: For Consideration References: 04-131 Basic Functionality: -------------------- Improve aliasing analysis by indicating pointers to targets and targets of pointers. Rationale: ---------- Compilers must generate code which allows data to be kept in the fastest memory closest to functional units for highly optimized code sequences. Conservative assumptions regarding aliasing prevent it, providing information to allow more aggressive analysis allows it. Estimated Impact: ----------------- Compilers would have to recognize lists in two new places and they should be able to detect textual falsehoods, but they need not use this information when generating code. High quality implementations will do so. A forward reference must be accepted, because both pointer and target cannot be declared in the same statement. If no other accepted feature proposal provides for such forwared references, this proposal implicitly contains a proposal to allow such forward references. Detailed Specification: ----------------------- Allow the programmer to list the targets of pointers and the pointers to targets, as follows: Modify the TARGET declaration syntax by optionally placing a parenthesized list of pointers after it. For example: real, target( pa) :: ta This indicates that only pointer pa will be associated with target ta. The variable pa shall have the pointer attribute and have characteristics such that it could be associated with ta. If pa is declared subsequently, that declaration shall confirm the required characteristics. Modify the POINTER declaration syntax analogously: real, pointer( ta) :: pa This indicates that pointer pa will only be associated with target ta. The variable ta shall have the target attribute and have characteristics such that it is a valid target for pa. If ta is declared subsequently, that declaration shall confirm the required characteristics. A set of declarations with pointer or target lists shall not be inconsistent. Note that for the two example declarations above, one (pa or ta) must contain a forward reference. The circumstances where one declaration of the two above is allowed to be in a different compilation unit should be resolved by J3. The POINTER and TARGET statements are modified to allow the same new syntax as the corresponding attribute specifiers. In general, TARGET [ ( ) ] and POINTER [ ( ) ] Examples: ! targets of a pointer real, pointer( t1, t2) :: ptr real, target :: t1, t2 real, target :: tgt ! accepted: ptr => t2 ! not accepted: ptr => tgt ! ----------------------------- ! pointer to a target real, pointer :: ptr real, target( ptr) :: t1, t2 real, target :: tgt ! accepted: ptr => t2 ! not accepted: ptr => tgt ! ----------------------------- ! symmetrically constrained declarations real, pointer( t1, t2) :: ptr real, target( ptr) :: t1, t2 History: Original paper was 04-131 at J3 meeting 167.