From 7ca012dbc3f476da48b38e1d688e7699de80e3d6 Mon Sep 17 00:00:00 2001 From: Ivan Krysak Date: Thu, 2 Mar 2023 15:02:39 +0200 Subject: [PATCH] Minor improvements --- include/revng/ADT/GenericGraph.h | 18 +++++++++--------- .../EarlyFunctionAnalysis/ControlFlowGraph.h | 4 +++- lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp | 4 ++-- lib/Yield/CallGraphs/CallGraphSlices.cpp | 2 +- lib/Yield/ControlFlow/Extraction.cpp | 2 +- lib/Yield/ControlFlow/SVG.cpp | 2 +- .../GraphPreparation.cpp | 8 ++++---- .../HorizontalPositions.cpp | 2 +- .../LaneDistribution.cpp | 2 +- .../Support/SugiyamaStyleGraphLayout/Layout.h | 2 +- .../NodeClassification.h | 2 +- .../SugiyamaStyleGraphLayout/NodeRanking.h | 2 +- .../PermutationSelection.cpp | 2 +- 13 files changed, 27 insertions(+), 25 deletions(-) diff --git a/include/revng/ADT/GenericGraph.h b/include/revng/ADT/GenericGraph.h index 8dbe8674c..ce043e512 100644 --- a/include/revng/ADT/GenericGraph.h +++ b/include/revng/ADT/GenericGraph.h @@ -30,23 +30,23 @@ /// of implementation simplicity this node stores COPIES of the labels. /// It's only suitable to be used with cheap to copy labels which are never /// mutated. There are plans on making them explicitly immutable (TODO), -/// as such you can consider label mutation a deprecated behaviour. +/// as such you can consider label mutation a deprecated behavior. /// /// - MutableEdgeNode - a double-linked node with dynamically allocated /// labels. It is similar to BidirectionalNode except it stores edge labels /// on the heap. It's slower and uses more memory but allows for safe label /// modification as well as controls that nodes and edges are removed -/// safely, with the other "halfs" cleaned up as well. +/// safely, with the other "halves" cleaned up as well. /// Note that it's disallowed to have a mutable edge graph without edge /// labels. Use `BidirectionalNode` in those cases. /// /// - The node you're going to write - No-one knows the needs of your -/// project better than you. That's why the best datastructure is the one +/// project better than you. That's why the best data structure is the one /// you are going to write. So just inherit one of our nodes, or even copy /// it and modify it so that it suits your graphs as nicely as possible. /// /// On the side-note, we're providing a couple of helpful concepts to help -/// differenciate different node types. This is helpful in the projects that +/// differentiate different node types. This is helpful in the projects that /// use multiple different graph architectures side by side. template @@ -155,7 +155,7 @@ namespace revng::detail { /// \note At this step Forward edge has not been declared yet, thus we accept a /// template parameter that has the same signature as ForwardEdge that /// will be declared later. This allows us to use it as if it was -/// delcared, provided that only the real ForwardEdge is used as this +/// declared, provided that only the real ForwardEdge is used as this /// argument. template>; @@ -70,6 +70,8 @@ inline ParsedSuccessor parseSuccessor(const T &Edge, } } +// clang-format off + /// A function for converting EFA's internal CFG representation into a generic /// graph. /// diff --git a/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp b/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp index 993690d36..4fe25bc13 100644 --- a/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp +++ b/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp @@ -714,7 +714,7 @@ FunctionSummary CFGAnalyzer::milkInfo(OutlinedFunction *OutlinedFunction, efa::BasicBlock Block = blockFromIndirectBranchInfo(CI, CFG); // Is this a tail call? If so, we are very interested in the FSO since - // it's useful to determin the FSO of the caller + // it's useful to determine the FSO of the caller auto *CalledSymbolArgument = CI->getArgOperand(CalledSymbolIndex); StringRef CalledSymbol = extractFromConstantStringPtr(CalledSymbolArgument); auto [Summary, IsTailCall] = Oracle.getCallSite(OutlinedFunction->Address, @@ -931,7 +931,7 @@ FunctionSummary CFGAnalyzer::analyze(llvm::BasicBlock *Entry) { // prologue / epilogue. When the subtraction between their entry and end // values is found to be zero (after running an LLVM optimization // pipeline), we may infer if the function returns correctly, the stack - // is left unanaltered, etc. Hence, upon every original indirect jump + // is left unaltered, etc. Hence, upon every original indirect jump // (candidate exit point), a marker of this kind is installed: // // jumps to RA, SP, rax, rbx, rbp diff --git a/lib/Yield/CallGraphs/CallGraphSlices.cpp b/lib/Yield/CallGraphs/CallGraphSlices.cpp index 0a49215f0..e0152ed86 100644 --- a/lib/Yield/CallGraphs/CallGraphSlices.cpp +++ b/lib/Yield/CallGraphs/CallGraphSlices.cpp @@ -87,7 +87,7 @@ makeTreeImpl(const yield::Graph &Input, const BasicBlockID &SlicePoint) { // Manually adding `Entry` to the result graphs guarantees that it's never // empty. Since we only ever iterate on edges, this will guarantee that the - // produced graph is not emptry even in the cases where `Entry` has no edges. + // produced graph is not empty even in the cases where `Entry` has no edges. Result.setEntryNode(FindOrAddHelper(*Entry)); // Fill in the `Result` graph. diff --git a/lib/Yield/ControlFlow/Extraction.cpp b/lib/Yield/ControlFlow/Extraction.cpp index 2a71fc532..2c0d4e7cd 100644 --- a/lib/Yield/ControlFlow/Extraction.cpp +++ b/lib/Yield/ControlFlow/Extraction.cpp @@ -38,7 +38,7 @@ yield::cfg::extractFromInternal(const yield::Function &Function, Result.setEntryNode(RootNode); } - // Colour taken and refused edges. + // Colour 'taken' and 'refused' edges. for (const auto &BasicBlock : Function.ControlFlowGraph()) { auto NodeIterator = Table.find(BasicBlock.ID()); revng_assert(NodeIterator != Table.end()); diff --git a/lib/Yield/ControlFlow/SVG.cpp b/lib/Yield/ControlFlow/SVG.cpp index cd115ec35..e38300c47 100644 --- a/lib/Yield/ControlFlow/SVG.cpp +++ b/lib/Yield/ControlFlow/SVG.cpp @@ -208,7 +208,7 @@ static Viewbox calculateViewbox(const yield::Graph &Graph) { /// A really simple arrow head marker generator. /// -/// \param Name: the id of the marker as refered to by the objects using it. +/// \param Name: the id of the marker as referred to by the objects using it. /// \param Size: the size of the marker. It sets both width and height to force /// the marker to be square-shaped. /// \param Concave: the size of the concave at the rear side of the arrow. diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/GraphPreparation.cpp b/lib/Yield/Support/SugiyamaStyleGraphLayout/GraphPreparation.cpp index 85ed01669..a5d587c08 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/GraphPreparation.cpp +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/GraphPreparation.cpp @@ -175,7 +175,7 @@ static RankDelta delta(NodeView LHS, NodeView RHS, const RankContainer &Ranks) { return std::abs(RankDelta(Ranks.at(LHS)) - RankDelta(Ranks.at(RHS))); } -// Returns a list of edges that span accross more than a single layer. +// Returns a list of edges that span across more than a single layer. static std::vector pickLongEdges(InternalGraph &Graph, const RankContainer &Ranks) { std::vector Result; @@ -220,7 +220,7 @@ void partition(const std::vector &Edges, } /// To simplify the ranking algorithms, if there's more than one entry point, -/// an artifitial entry node is added. This new node has a single edge per +/// an artificial entry node is added. This new node has a single edge per /// real entry point. static void ensureSingleEntry(InternalGraph &Graph, RankContainer *MaybeRanks = nullptr) { @@ -280,9 +280,9 @@ RankContainer partitionLongEdges(InternalGraph &Graph, }; // Because a long edge can also be a backwards edge, edges that are certainly - // long need to be removed first, so that DFS-based rankind algorithms don't + // long need to be removed first, so that DFS-based ranking algorithms don't // mistakenly take any undesired shortcuts. Simple BFS ranking used - // internally to differencite such "certainly long" edges. + // internally to differentiate such "certainly long" edges. // Rank nodes based on a BreadthFirstSearch pass-through. revng_assert(HasSingleEntryPoint(Graph)); diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/HorizontalPositions.cpp b/lib/Yield/Support/SugiyamaStyleGraphLayout/HorizontalPositions.cpp index f282eb390..41e3c2714 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/HorizontalPositions.cpp +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/HorizontalPositions.cpp @@ -65,7 +65,7 @@ void setHorizontalCoordinates(const LayerContainer &Layers, } // At this point, the layout is very left heavy. - // To conteract this, nodes are pushed to the right if their neighbours are + // To counteract this, nodes are pushed to the right if their neighbours are // very far away and the successors are also on the right. // The positions are weighted based on the successor positions. for (size_t Iteration = 0; Iteration < IterationCount; ++Iteration) { diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/LaneDistribution.cpp b/lib/Yield/Support/SugiyamaStyleGraphLayout/LaneDistribution.cpp index 0c6fd497f..81741c29d 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/LaneDistribution.cpp +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/LaneDistribution.cpp @@ -26,7 +26,7 @@ static bool facesRight(const DirectedEdgeView &Edge) { /// that helps to minimize the number of crossings. /// When directions are the same, edges are sorted based on the horizontal /// coordinates of their ends (the edge that needs to go further is placed -/// closer to the outside of the laning section). +/// closer to the outside of the lane section). static bool compareHorizontalLanes(const DirectedEdgeView &LHS, const DirectedEdgeView &RHS) { bool LHSFacesRight = facesRight(LHS); diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/Layout.h b/lib/Yield/Support/SugiyamaStyleGraphLayout/Layout.h index b8974798d..330b79db8 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/Layout.h +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/Layout.h @@ -61,7 +61,7 @@ void setHorizontalCoordinates(const LayerContainer &Layers, void setStaticOffsetHorizontalCoordinates(const LayerContainer &Layers, float MarginSize); -/// Distributes "touching" edges accross lanes to minimize the crossing count. +/// Distributes "touching" edges across lanes to minimize the crossing count. LaneContainer assignLanes(InternalGraph &Graph, const SegmentContainer &LinearSegments, const LayoutContainer &Layout); diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeClassification.h b/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeClassification.h index 088545699..f0bd6f391 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeClassification.h +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeClassification.h @@ -39,7 +39,7 @@ class NodeClassifierStorage } // namespace detail /// It is used to classify the nodes by selecting the right cluster depending -/// on its neighbors. This helps to make routes with edges routed accross +/// on its neighbors. This helps to make routes with edges routed across /// multiple "virtual" nodes that require less bends. template class NodeClassifier : public detail::NodeClassifierStorage { diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeRanking.h b/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeRanking.h index 209760ef3..c5baff023 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeRanking.h +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/NodeRanking.h @@ -16,7 +16,7 @@ RankContainer rankNodes(InternalGraph &Graph, int64_t DiamondBound); /// Updates node ranking after the graph was modified. /// -/// Garanties ranking consistency i.e. that each node has +/// Guaranties ranking consistency i.e. that each node has /// a rank greater than its predecessors. /// /// Be careful, rank order is NOT preserved. diff --git a/lib/Yield/Support/SugiyamaStyleGraphLayout/PermutationSelection.cpp b/lib/Yield/Support/SugiyamaStyleGraphLayout/PermutationSelection.cpp index 0d97d2cd2..b6ffa3b60 100644 --- a/lib/Yield/Support/SugiyamaStyleGraphLayout/PermutationSelection.cpp +++ b/lib/Yield/Support/SugiyamaStyleGraphLayout/PermutationSelection.cpp @@ -411,7 +411,7 @@ LayerContainer selectPermutation(InternalGraph &Graph, // Iteration counts are chosen arbitrarily. If the computation time was not // an issue, we could keep iterating until convergence, but since it's not - // the case, we have to choose a stoping point. + // the case, we have to choose a stopping point. // // The iteration count logarithmically depends on the layer number. size_t Iterations = std::log2(InitialLayers.size());