xref: /llvm-project/polly/lib/External/isl/isl_scheduler_clustering.h (revision a749e09e184b2b0b6dde71af01c82dd427b3e3e2)
1*a749e09eSMichael Kruse #ifndef ISL_SCHEDULER_CLUSTERING_H
2*a749e09eSMichael Kruse #define ISL_SCHEDULER_CLUSTERING_H
3*a749e09eSMichael Kruse 
4*a749e09eSMichael Kruse #include "isl_scheduler.h"
5*a749e09eSMichael Kruse 
6*a749e09eSMichael Kruse /* Clustering information used by isl_schedule_node_compute_wcc_clustering.
7*a749e09eSMichael Kruse  *
8*a749e09eSMichael Kruse  * "n" is the number of SCCs in the original dependence graph
9*a749e09eSMichael Kruse  * "scc" is an array of "n" elements, each representing an SCC
10*a749e09eSMichael Kruse  * of the original dependence graph.  All entries in the same cluster
11*a749e09eSMichael Kruse  * have the same number of schedule rows.
12*a749e09eSMichael Kruse  * "scc_cluster" maps each SCC index to the cluster to which it belongs,
13*a749e09eSMichael Kruse  * where each cluster is represented by the index of the first SCC
14*a749e09eSMichael Kruse  * in the cluster.  Initially, each SCC belongs to a cluster containing
15*a749e09eSMichael Kruse  * only that SCC.
16*a749e09eSMichael Kruse  *
17*a749e09eSMichael Kruse  * "scc_in_merge" is used by merge_clusters_along_edge to keep
18*a749e09eSMichael Kruse  * track of which SCCs need to be merged.
19*a749e09eSMichael Kruse  *
20*a749e09eSMichael Kruse  * "cluster" contains the merged clusters of SCCs after the clustering
21*a749e09eSMichael Kruse  * has completed.
22*a749e09eSMichael Kruse  *
23*a749e09eSMichael Kruse  * "scc_node" is a temporary data structure used inside copy_partial.
24*a749e09eSMichael Kruse  * For each SCC, it keeps track of the number of nodes in the SCC
25*a749e09eSMichael Kruse  * that have already been copied.
26*a749e09eSMichael Kruse  */
27*a749e09eSMichael Kruse struct isl_clustering {
28*a749e09eSMichael Kruse 	int n;
29*a749e09eSMichael Kruse 	struct isl_sched_graph *scc;
30*a749e09eSMichael Kruse 	struct isl_sched_graph *cluster;
31*a749e09eSMichael Kruse 	int *scc_cluster;
32*a749e09eSMichael Kruse 	int *scc_node;
33*a749e09eSMichael Kruse 	int *scc_in_merge;
34*a749e09eSMichael Kruse };
35*a749e09eSMichael Kruse 
36*a749e09eSMichael Kruse __isl_give isl_schedule_node *isl_schedule_node_compute_wcc_clustering(
37*a749e09eSMichael Kruse 	__isl_take isl_schedule_node *node, struct isl_sched_graph *graph);
38*a749e09eSMichael Kruse 
39*a749e09eSMichael Kruse #endif
40