home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / adaptor / src / include / depgraph.h < prev    next >
C/C++ Source or Header  |  1993-07-08  |  4KB  |  123 lines

  1. # ifndef yyDepGraph
  2. # define yyDepGraph
  3.  
  4. # if defined __STDC__ | defined __cplusplus
  5. # define ARGS(parameters)    parameters
  6. # else
  7. # define ARGS(parameters)    ()
  8. # endif
  9.  
  10.  
  11. # ifndef bool
  12. # define bool char
  13. # endif
  14. # define NoDepGraph (tDepGraph) 0L
  15. # define kDepNode 1
  16. # define kDepEdge 2
  17.  
  18. typedef unsigned char DepGraph_tKind;
  19. typedef unsigned short DepGraph_tMark;
  20. typedef unsigned short DepGraph_tLabel;
  21. typedef union DepGraph_Node * tDepGraph;
  22. typedef void (* DepGraph_tProcTree) ();
  23. /* line 14 "fortran.dg" */
  24.  
  25.  
  26. #include "pred.h"
  27. #include "Sets.h"
  28.  
  29. /* Note : All Functions DepNode, DepEdge :
  30.    mDepNode, mDepEdge, ...                   */
  31.  
  32. #define tDepNode tDepGraph
  33. #define tDepEdge tDepGraph
  34.  
  35. #define DepNodeUse 0
  36. #define DepNodeDef 1
  37. #define DepNodeMod 2
  38.  
  39. #define MaxDepNode 500     /* only for one graph */
  40. #define MaxDepEdge 1000    /* only for one graph */
  41.  
  42. typedef int DepNodeIndex;
  43.       /* Index of a DepNode in a Graph : 1..MaxDepNode */
  44.  
  45. typedef int DepEdgeIndex;
  46.       /* Index of a DepEdge in a Graph : 1..MaxDepEdge */
  47.  
  48. typedef tSet DepNodeSet;
  49.  
  50. void DepCreateGraph ( /* Tree N */ );
  51.  
  52. /* generates a new dependence graph for unit, identified by N
  53.    dependence graph is opened                                  */
  54.  
  55. void DepCloseGraph ();
  56.  
  57. void DepDestroyGraph ( /* Tree N */ );
  58.  
  59. void DepOpenGraph (/* Tree N */);
  60.  
  61. /* Inserting Node or Edge in a opened dependence graph
  62.    (at this time this must be the last created graph)    */
  63.  
  64. DepNodeIndex DepGraphNodeInsert ( /* tDepNode DN */);
  65.  
  66. DepEdgeIndex DepGraphEdgeInsert ( /* tDepEdge DE */);
  67.  
  68. tDepNode DepGraphGetNode ( /* dn : DepNodeIndex */ );
  69.        /* the reverse to DepGraphNodeInsert */
  70.  
  71. tDepEdge DepGraphGetEdge ( /* DepEdgeIndex */ );
  72.        /* the reverse to DepGraphEdgeInsert */
  73.  
  74. /* Queries for the nodes of a dependence graph */
  75.  
  76. void DepGraphAllNodes (/* int *count, DepNodeSet *Defs, *Uses */);
  77.       /* all nodes of the opened dependence graph */
  78.  
  79. DepNodeIndex DepGraphSearchNode ( /* tTree access */ );
  80.       /* searching with the ast for a variable access */
  81.  
  82. /* Queries for the edges of a dependence graph */
  83.  
  84. int DepGraphAllEdges ();
  85.       /* returns number of edges in the openend dependence graph */
  86.  
  87. void DepGraphSearchEdge ( /* DepNodeIndex dn1, dn2; short *found;
  88.                              DepEdgeIndex *de                     */ );
  89.       /* searching edge (predicate) for given source and target */
  90.  
  91.  
  92. # ifndef DepGraph_NodeHead
  93. # define DepGraph_NodeHead
  94. # endif
  95. typedef struct { DepGraph_tKind yyKind; DepGraph_tMark yyMark; DepGraph_NodeHead } DepGraph_tNodeHead;
  96. typedef struct { DepGraph_tNodeHead yyHead; tIdent Name; int NodeKind; tTree Access; tTree Stat; tTree OuterLoops; } yDepNode;
  97. typedef struct { DepGraph_tNodeHead yyHead; int Source; int Target; Predicate Pred; } yDepEdge;
  98.  
  99. union DepGraph_Node {
  100.  DepGraph_tKind Kind;
  101.  DepGraph_tNodeHead yyHead;
  102.  yDepNode DepNode;
  103.  yDepEdge DepEdge;
  104. };
  105.  
  106. extern tDepGraph DepGraphRoot;
  107. extern unsigned long DepGraph_HeapUsed;
  108. extern char * DepGraph_PoolFreePtr, * DepGraph_PoolMaxPtr;
  109. extern unsigned short DepGraph_NodeSize [2 + 1];
  110. extern char * DepGraph_NodeName [2 + 1];
  111.  
  112. extern tDepGraph DepGraph_Alloc ();
  113. extern tDepGraph MakeDepGraph ARGS((DepGraph_tKind yyKind));
  114. extern bool DepGraph_IsType ARGS((register tDepGraph yyt, register DepGraph_tKind yyKind));
  115.  
  116. extern tDepGraph mDepNode ARGS((tIdent pName, int pNodeKind, tTree pAccess, tTree pStat, tTree pOuterLoops));
  117. extern tDepGraph mDepEdge ARGS((int pSource, int pTarget, Predicate pPred));
  118.  
  119. extern void BeginDepGraph ();
  120. extern void CloseDepGraph ();
  121.  
  122. # endif
  123.