[lld] r205377 - De-virtualize InputGraph's member functions.

Rui Ueyama ruiu at google.com
Tue Apr 1 17:14:34 PDT 2014


Author: ruiu
Date: Tue Apr  1 19:14:33 2014
New Revision: 205377

URL: http://llvm.org/viewvc/llvm-project?rev=205377&view=rev
Log:
De-virtualize InputGraph's member functions.

There's no class derived from InputGraph. Making member functions virtual
just makes it a bit inefficient.

Modified:
    lld/trunk/include/lld/Core/InputGraph.h

Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=205377&r1=205376&r2=205377&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Tue Apr  1 19:14:33 2014
@@ -55,22 +55,20 @@ public:
   InputGraph() : _ordinal(0), _nextElementIndex(0) {}
 
   /// \brief Adds a node into the InputGraph
-  virtual bool addInputElement(std::unique_ptr<InputElement>);
+  bool addInputElement(std::unique_ptr<InputElement>);
 
   /// \brief Set Ordinals for all the InputElements that form the InputGraph
-  virtual bool assignOrdinals();
+  bool assignOrdinals();
 
   /// Normalize the InputGraph. It visits all nodes in the tree to replace a
   /// node with its children if it's shouldExpand() returnst true.
-  virtual void normalize();
-
-  virtual ~InputGraph() {}
+  void normalize();
 
   /// \brief Do postprocessing of the InputGraph if there is a need for the
   /// to provide additional information to the user, also rearranges
   /// InputElements by their ordinals. If a user wants to place an input file
   /// at the desired position, the user can do that.
-  virtual void doPostProcess();
+  void doPostProcess();
 
   range<InputElementIterT> inputElements() {
     return make_range(_inputArgs.begin(), _inputArgs.end());
@@ -125,12 +123,12 @@ public:
   /// Return the Element Type for an Input Element
   virtual Kind kind() const { return _kind; }
 
-  virtual void setOrdinal(int64_t ordinal) {
+  void setOrdinal(int64_t ordinal) {
     if (_ordinal != -1)
       _ordinal = ordinal;
   }
 
-  virtual int64_t getOrdinal() const { return _ordinal; }
+  int64_t getOrdinal() const { return _ordinal; }
 
   /// \brief Dump the Input Element
   virtual bool dump(raw_ostream &diagnostics) { return true; }
@@ -152,8 +150,6 @@ public:
   /// \brief Reset the next index
   virtual void resetNextIndex() = 0;
 
-  /// Normalize functions
-
   /// Returns true if we want to replace this node with children.
   virtual bool shouldExpand() const { return false; }
 





More information about the llvm-commits mailing list