Previous: , Up: Loop Analysis and Representation   [Contents][Index]


15.8 Data Dependency Analysis

The code for the data dependence analysis can be found in tree-data-ref.c and its interface and data structures are described in tree-data-ref.h. The function that computes the data dependences for all the array and pointer references for a given loop is compute_data_dependences_for_loop. This function is currently used by the linear loop transform and the vectorization passes. Before calling this function, one has to allocate two vectors: a first vector will contain the set of data references that are contained in the analyzed loop body, and the second vector will contain the dependence relations between the data references. Thus if the vector of data references is of size n, the vector containing the dependence relations will contain n*n elements. However if the analyzed loop contains side effects, such as calls that potentially can interfere with the data references in the current analyzed loop, the analysis stops while scanning the loop body for data references, and inserts a single chrec_dont_know in the dependence relation array.

The data references are discovered in a particular order during the scanning of the loop body: the loop body is analyzed in execution order, and the data references of each statement are pushed at the end of the data reference array. Two data references syntactically occur in the program in the same order as in the array of data references. This syntactic order is important in some classical data dependence tests, and mapping this order to the elements of this array avoids costly queries to the loop body representation.

Three types of data references are currently handled: ARRAY_REF, INDIRECT_REF and COMPONENT_REF. The data structure for the data reference is data_reference, where data_reference_p is a name of a pointer to the data reference structure. The structure contains the following elements:

The structure describing the relation between two data references is data_dependence_relation and the shorter name for a pointer to such a structure is ddr_p. This structure contains:

Several functions for pretty printing the information extracted by the data dependence analysis are available: dump_ddrs prints with a maximum verbosity the details of a data dependence relations array, dump_dist_dir_vectors prints only the classical distance and direction vectors for a data dependence relations array, and dump_data_references prints the details of the data references contained in a data reference array.


Previous: , Up: Loop Analysis and Representation   [Contents][Index]