Lines Matching defs:edge

1 //===- OptimalEdgeProfiling.cpp - Insert counters for opt. edge profiling -===//
10 // This pass instruments the specified program with counters for edge profiling.
15 #define DEBUG_TYPE "insert-optimal-edge-profiling"
55 INITIALIZE_PASS_BEGIN(OptimalEdgeProfiler, "insert-optimal-edge-profiling",
56 "Insert optimal instrumentation for edge profiling",
60 INITIALIZE_PASS_END(OptimalEdgeProfiler, "insert-optimal-edge-profiling",
61 "Insert optimal instrumentation for edge profiling",
78 errs() << "WARNING: cannot insert edge profiling into a module"
85 // For the entry block a virtual edge (0,entry) is reserved, for each block
86 // with no successors an edge (BB,0) is reserved. These edges are necessary
93 // Reserve space for (0,entry) edge.
100 // Reserve space for (BB,0) edge.
108 // In the profiling output a counter for each edge is reserved, but only few
110 // calulating the maximum spanning tree again, instead each edge counter that
111 // is not used is initialised with -1 to signal that this edge counter has to
112 // be calculated from other edge counters on reading the profile info back
132 // Calculate a Maximum Spanning Tree with the edge weights determined by
145 // Check if (0,entry) not in the MST. If not, instrument edge
147 // the edge is in the MST the counter is initialised to -1.
150 ProfileInfo::Edge edge = ProfileInfo::getEdge(0, entry);
151 if (!std::binary_search(MST.begin(), MST.end(), edge)) {
152 printEdgeCounter(edge, entry, i);
160 // edge, this blocks do not have to be instrumented.
167 // Okay, we have to add a counter of each outgoing edge not in MST. If
168 // the outgoing edge is not critical don't split it, just insert the
169 // counter in the source or destination of the edge. Also, if the block
170 // has no successors, the virtual edge (BB,0) is processed.
173 ProfileInfo::Edge edge = ProfileInfo::getEdge(BB, 0);
174 if (!std::binary_search(MST.begin(), MST.end(), edge)) {
175 printEdgeCounter(edge, BB, i);
184 ProfileInfo::Edge edge = ProfileInfo::getEdge(BB,Succ);
185 if (!std::binary_search(MST.begin(), MST.end(), edge)) {
187 // If the edge is critical, split it.
193 // Okay, we are guaranteed that the edge is no longer critical. If
198 printEdgeCounter(edge, BB, i);
202 printEdgeCounter(edge, Succ, i);