OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [ddg.h] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* DDG - Data Dependence Graph - interface.
2
   Copyright (C) 2004, 2007
3
   Free Software Foundation, Inc.
4
   Contributed by Ayal Zaks and Mustafa Hagog <zaks,mustafa@il.ibm.com>
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify it under
9
the terms of the GNU General Public License as published by the Free
10
Software Foundation; either version 3, or (at your option) any later
11
version.
12
 
13
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14
WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16
for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
#ifndef GCC_DDG_H
23
#define GCC_DDG_H
24
 
25
/* For sbitmap.  */
26
#include "sbitmap.h"
27
/* For basic_block.  */
28
#include "basic-block.h"
29
/* For struct df.  */
30
#include "df.h"
31
 
32
typedef struct ddg_node *ddg_node_ptr;
33
typedef struct ddg_edge *ddg_edge_ptr;
34
typedef struct ddg *ddg_ptr;
35
typedef struct ddg_scc *ddg_scc_ptr;
36
typedef struct ddg_all_sccs *ddg_all_sccs_ptr;
37
 
38
typedef enum {TRUE_DEP, OUTPUT_DEP, ANTI_DEP} dep_type;
39
typedef enum {REG_OR_MEM_DEP, REG_DEP, MEM_DEP, REG_AND_MEM_DEP}
40
             dep_data_type;
41
 
42
/* The following two macros enables direct access to the successors and
43
   predecessors bitmaps held in each ddg_node.  Do not make changes to
44
   these bitmaps, unless you want to change the DDG.  */
45
#define NODE_SUCCESSORS(x)  ((x)->successors)
46
#define NODE_PREDECESSORS(x)  ((x)->predecessors)
47
 
48
/* A structure that represents a node in the DDG.  */
49
struct ddg_node
50
{
51
  /* Each node has a unique CUID index.  These indices increase monotonically
52
     (according to the order of the corresponding INSN in the BB), starting
53
     from 0 with no gaps.  */
54
  int cuid;
55
 
56
  /* The insn represented by the node.  */
57
  rtx insn;
58
 
59
  /* A note preceding INSN (or INSN itself), such that all insns linked
60
     from FIRST_NOTE until INSN (inclusive of both) are moved together
61
     when reordering the insns.  This takes care of notes that should
62
     continue to precede INSN.  */
63
  rtx first_note;
64
 
65
  /* Incoming and outgoing dependency edges.  */
66
  ddg_edge_ptr in;
67
  ddg_edge_ptr out;
68
 
69
  /* Each bit corresponds to a ddg_node according to its cuid, and is
70
     set iff the node is a successor/predecessor of "this" node.  */
71
  sbitmap successors;
72
  sbitmap predecessors;
73
 
74
  /* For general use by algorithms manipulating the ddg.  */
75
  union {
76
    int count;
77
    void *info;
78
  } aux;
79
};
80
 
81
/* A structure that represents an edge in the DDG.  */
82
struct ddg_edge
83
{
84
  /* The source and destination nodes of the dependency edge.  */
85
  ddg_node_ptr src;
86
  ddg_node_ptr dest;
87
 
88
  /* TRUE, OUTPUT or ANTI dependency.  */
89
  dep_type type;
90
 
91
  /* REG or MEM dependency.  */
92
  dep_data_type data_type;
93
 
94
  /* Latency of the dependency.  */
95
  int latency;
96
 
97
  /* The distance: number of loop iterations the dependency crosses.  */
98
  int distance;
99
 
100
  /* The following two fields are used to form a linked list of the in/out
101
     going edges to/from each node.  */
102
  ddg_edge_ptr next_in;
103
  ddg_edge_ptr next_out;
104
 
105
  /* For general use by algorithms manipulating the ddg.  */
106
  union {
107
    int count;
108
    void *info;
109
  } aux;
110
};
111
 
112
/* This structure holds the Data Dependence Graph for a basic block.  */
113
struct ddg
114
{
115
  /* The basic block for which this DDG is built.  */
116
  basic_block bb;
117
 
118
  /* Number of instructions in the basic block.  */
119
  int num_nodes;
120
 
121
  /* Number of load/store instructions in the BB - statistics.  */
122
  int num_loads;
123
  int num_stores;
124
 
125
  /* This array holds the nodes in the graph; it is indexed by the node
126
     cuid, which follows the order of the instructions in the BB.  */
127
  ddg_node_ptr nodes;
128
 
129
  /* The branch closing the loop.  */
130
  ddg_node_ptr closing_branch;
131
 
132
  /* Build dependence edges for closing_branch, when set.  In certain cases,
133
     the closing branch can be dealt with separately from the insns of the
134
     loop, and then no such deps are needed.  */
135
  int closing_branch_deps;
136
 
137
  /* Array and number of backarcs (edges with distance > 0) in the DDG.  */
138
  ddg_edge_ptr *backarcs;
139
  int num_backarcs;
140
};
141
 
142
 
143
/* Holds information on an SCC (Strongly Connected Component) of the DDG.  */
144
struct ddg_scc
145
{
146
  /* A bitmap that represents the nodes of the DDG that are in the SCC.  */
147
  sbitmap nodes;
148
 
149
  /* Array and number of backarcs (edges with distance > 0) in the SCC.  */
150
  ddg_edge_ptr *backarcs;
151
  int num_backarcs;
152
 
153
  /* The maximum of (total_latency/total_distance) over all cycles in SCC.  */
154
  int recurrence_length;
155
};
156
 
157
/* This structure holds the SCCs of the DDG.  */
158
struct ddg_all_sccs
159
{
160
  /* Array that holds the SCCs in the DDG, and their number.  */
161
  ddg_scc_ptr *sccs;
162
  int num_sccs;
163
 
164
  ddg_ptr ddg;
165
};
166
 
167
 
168
ddg_ptr create_ddg (basic_block, struct df *, int closing_branch_deps);
169
void free_ddg (ddg_ptr);
170
 
171
void print_ddg (FILE *, ddg_ptr);
172
void vcg_print_ddg (FILE *, ddg_ptr);
173
void print_ddg_edge (FILE *, ddg_edge_ptr);
174
 
175
ddg_node_ptr get_node_of_insn (ddg_ptr, rtx);
176
 
177
void find_successors (sbitmap result, ddg_ptr, sbitmap);
178
void find_predecessors (sbitmap result, ddg_ptr, sbitmap);
179
 
180
ddg_all_sccs_ptr create_ddg_all_sccs (ddg_ptr);
181
void free_ddg_all_sccs (ddg_all_sccs_ptr);
182
 
183
int find_nodes_on_paths (sbitmap result, ddg_ptr, sbitmap from, sbitmap to);
184
int longest_simple_path (ddg_ptr, int from, int to, sbitmap via);
185
 
186
#endif /* GCC_DDG_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.