@@ -145,15 +145,17 @@ class t_metadata_dict_iterator {
145
145
146
146
class EdgeWalker {
147
147
public:
148
- void initialize (const t_rr_graph_storage* nodes) {
148
+ void initialize (const t_rr_graph_storage* nodes, RRGraphView* rr_graph ) {
149
149
nodes_ = nodes;
150
+ rr_graph_ = rr_graph;
150
151
num_edges_ = 0 ;
151
152
current_src_inode_ = 0 ;
152
153
current_edge_ = 0 ;
153
154
current_idx_ = 0 ;
154
155
156
+ // TODO: Once rr_graph_storage is fully shadowed by RRGraphView, the cached nodes_ will be removed.
155
157
for (const auto & node : *nodes) {
156
- num_edges_ += nodes_ ->num_edges (node.id ());
158
+ num_edges_ += rr_graph_ ->num_edges (node.id ());
157
159
}
158
160
}
159
161
@@ -181,7 +183,7 @@ class EdgeWalker {
181
183
current_edge_ += 1 ;
182
184
}
183
185
184
- if (current_edge_ >= nodes_ ->num_edges (RRNodeId (current_src_inode_))) {
186
+ if (current_edge_ >= rr_graph_ ->num_edges (RRNodeId (current_src_inode_))) {
185
187
// Done with current_src_inode_, advance to the end of the
186
188
// node list, or the next node with at least 1 edge.
187
189
current_edge_ = 0 ;
@@ -194,7 +196,7 @@ class EdgeWalker {
194
196
VTR_ASSERT (current_idx_ + 1 == num_edges_);
195
197
return current_idx_++;
196
198
}
197
- } while (nodes_ ->num_edges (RRNodeId (current_src_inode_)) < 1 );
199
+ } while (rr_graph_ ->num_edges (RRNodeId (current_src_inode_)) < 1 );
198
200
}
199
201
200
202
VTR_ASSERT (current_src_inode_ < nodes_->size ());
@@ -204,6 +206,7 @@ class EdgeWalker {
204
206
205
207
private:
206
208
const t_rr_graph_storage* nodes_;
209
+ RRGraphView* rr_graph_;
207
210
size_t num_edges_;
208
211
size_t current_src_inode_;
209
212
size_t current_edge_;
@@ -999,7 +1002,7 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
999
1002
1000
1003
inline EdgeWalker get_rr_graph_rr_edges (void *& /* ctx*/ ) final {
1001
1004
EdgeWalker walker;
1002
- walker.initialize (rr_nodes_);
1005
+ walker.initialize (rr_nodes_,rr_graph_ );
1003
1006
return walker;
1004
1007
}
1005
1008
0 commit comments