]> granicus.if.org Git - llvm/commitdiff
Mark dump() methods as const. NFC
authorSam Clegg <sbc@chromium.org>
Wed, 21 Jun 2017 22:19:17 +0000 (22:19 +0000)
committerSam Clegg <sbc@chromium.org>
Wed, 21 Jun 2017 22:19:17 +0000 (22:19 +0000)
Add const qualifier to any dump() method where adding one
was trivial.

Differential Revision: https://reviews.llvm.org/D34481

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305963 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
include/llvm/CodeGen/DIE.h
include/llvm/CodeGen/LexicalScopes.h
include/llvm/CodeGen/MachineScheduler.h
include/llvm/MC/MCAssembler.h
include/llvm/MC/MCFragment.h
include/llvm/MC/MCSection.h
include/llvm/Transforms/Scalar/GVN.h
lib/CodeGen/AsmPrinter/DIE.cpp
lib/CodeGen/LiveDebugVariables.cpp
lib/CodeGen/LiveDebugVariables.h
lib/CodeGen/MachineScheduler.cpp
lib/MC/MCFragment.cpp
lib/MC/MCSection.cpp
lib/Target/SystemZ/SystemZMachineScheduler.h
lib/Transforms/Scalar/GVN.cpp

index 5ed5faa2c415013e97243a43255fa15b6bb7ef00..f809fc97fe593981f1e53471c6f8e5272ecbcd5b 100644 (file)
@@ -121,8 +121,8 @@ public:
   /// Print the abbreviation using the specified asm printer.
   void Emit(const AsmPrinter *AP) const;
 
-  void print(raw_ostream &O);
-  void dump();
+  void print(raw_ostream &O) const;
+  void dump() const;
 };
 
 //===--------------------------------------------------------------------===//
@@ -780,7 +780,7 @@ public:
   DIEValue findAttribute(dwarf::Attribute Attribute) const;
 
   void print(raw_ostream &O, unsigned IndentCount = 0) const;
-  void dump();
+  void dump() const;
 };
 
 //===--------------------------------------------------------------------===//
index 79fa12ec2fbbbd95ef16b41c59f172c025ea27a2..3ba503487823dfaf824e30eae3f961a18b1e8bdf 100644 (file)
@@ -196,7 +196,7 @@ public:
   }
 
   /// dump - Print data structures to dbgs().
-  void dump();
+  void dump() const;
 
   /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
   LexicalScope *getOrCreateAbstractScope(const DILocalScope *Scope);
index 3b02ec400abac3485b43deb8828ce1116eed98c0..34cbffa78203ab10b507d4fb1cd69c4f61192a0b 100644 (file)
@@ -203,7 +203,7 @@ public:
                           MachineBasicBlock::iterator End,
                           unsigned NumRegionInstrs) {}
 
-  virtual void dumpPolicy() {}
+  virtual void dumpPolicy() const {}
 
   /// Check if pressure tracking is needed before building the DAG and
   /// initializing this strategy. Called after initPolicy.
@@ -555,7 +555,7 @@ public:
     return Queue.begin() + idx;
   }
 
-  void dump();
+  void dump() const;
 };
 
 /// Summarize the unscheduled region.
@@ -756,7 +756,7 @@ public:
   SUnit *pickOnlyChoice();
 
 #ifndef NDEBUG
-  void dumpScheduledState();
+  void dumpScheduledState() const;
 #endif
 };
 
@@ -890,7 +890,7 @@ public:
                   MachineBasicBlock::iterator End,
                   unsigned NumRegionInstrs) override;
 
-  void dumpPolicy() override;
+  void dumpPolicy() const override;
 
   bool shouldTrackPressure() const override {
     return RegionPolicy.ShouldTrackPressure;
index 63f7057a7076f263115c3dd40808bf8b4971f794..a7e37817db134fcb6a8b071d160eb1477cdd6bcd 100644 (file)
@@ -413,7 +413,7 @@ public:
 
   /// @}
 
-  void dump();
+  void dump() const;
 };
 
 /// \brief Compute the amount of padding required before the fragment \p F to
index 0aca922e3cf5823b939af8db78336e55cb981a81..284ca50e19d5bddfd67e7582cda66586f3ffb12e 100644 (file)
@@ -130,7 +130,7 @@ public:
   /// \brief Return true if given frgment has FT_Dummy type.
   bool isDummy() const { return Kind == FT_Dummy; }
 
-  void dump();
+  void dump() const;
 };
 
 class MCDummyFragment : public MCFragment {
index cc306d47250d4fa2afaaaa1867c8e0995a591b18..2771b1e67eaba7f9d49c3566349401432fd9c9b7 100644 (file)
@@ -167,7 +167,7 @@ public:
 
   MCSection::iterator getSubsectionInsertionPoint(unsigned Subsection);
 
-  void dump();
+  void dump() const;
 
   virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
                                     raw_ostream &OS,
index 589aaaca02fe17585308c39adffa5847de2d8cb3..f25ab40640dfce6174dcba9296b0736421fa4ee2 100644 (file)
@@ -209,7 +209,7 @@ private:
   // Other helper routines
   bool processInstruction(Instruction *I);
   bool processBlock(BasicBlock *BB);
-  void dump(DenseMap<uint32_t, Value *> &d);
+  void dump(DenseMap<uint32_t, Value *> &d) const;
   bool iterateOnFunction(Function &F);
   bool performPRE(Function &F);
   bool performScalarPRE(Instruction *I);
index 30bfd7c94e68b91ff0cca047e7bc4402838fbade..886e6e264b3ec104b129135de0b7e5a1f1b34351 100644 (file)
@@ -105,7 +105,7 @@ void DIEAbbrev::Emit(const AsmPrinter *AP) const {
 }
 
 LLVM_DUMP_METHOD
-void DIEAbbrev::print(raw_ostream &O) {
+void DIEAbbrev::print(raw_ostream &O) const {
   O << "Abbreviation @"
     << format("0x%lx", (long)(intptr_t)this)
     << "  "
@@ -128,7 +128,7 @@ void DIEAbbrev::print(raw_ostream &O) {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void DIEAbbrev::dump() {
+LLVM_DUMP_METHOD void DIEAbbrev::dump() const {
   print(dbgs());
 }
 #endif
@@ -268,7 +268,7 @@ void DIE::print(raw_ostream &O, unsigned IndentCount) const {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void DIE::dump() {
+LLVM_DUMP_METHOD void DIE::dump() const {
   print(dbgs());
 }
 #endif
index bbd783367c9e874afb33c11f356c51046172b428..0c76478af551f9721043c41fc5467de97ca75992 100644 (file)
@@ -1006,7 +1006,7 @@ bool LiveDebugVariables::doInitialization(Module &M) {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void LiveDebugVariables::dump() {
+LLVM_DUMP_METHOD void LiveDebugVariables::dump() const {
   if (pImpl)
     static_cast<LDVImpl*>(pImpl)->print(dbgs());
 }
index afe87a52544d8e3445be4264e312b2624a93f863..1d7e3d4371a24f039a8db1ed337405435649e364 100644 (file)
@@ -59,7 +59,7 @@ public:
   void emitDebugValues(VirtRegMap *VRM);
 
   /// dump - Print data structures to dbgs().
-  void dump();
+  void dump() const;
 
 private:
 
index 7a6e7546a0de7541312efd43b73de95fc4b8a965..eaba9a58557c37c526a82ad00efb23280f79a26d 100644 (file)
@@ -542,7 +542,7 @@ void MachineSchedulerBase::print(raw_ostream &O, const Module* m) const {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void ReadyQueue::dump() {
+LLVM_DUMP_METHOD void ReadyQueue::dump() const {
   dbgs() << "Queue " << Name << ": ";
   for (const SUnit *SU : Queue)
     dbgs() << SU->NodeNum << " ";
@@ -2309,7 +2309,7 @@ SUnit *SchedBoundary::pickOnlyChoice() {
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
 // This is useful information to dump after bumpNode.
 // Note that the Queue contents are more useful before pickNodeFromQueue.
-LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() {
+LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() const {
   unsigned ResFactor;
   unsigned ResCount;
   if (ZoneCritResIdx) {
@@ -2648,7 +2648,7 @@ void GenericScheduler::initPolicy(MachineBasicBlock::iterator Begin,
   }
 }
 
-void GenericScheduler::dumpPolicy() {
+void GenericScheduler::dumpPolicy() const {
   // Cannot completely remove virtual function even in release mode.
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
   dbgs() << "GenericScheduler RegionPolicy: "
index f3d0eb55eecd4c6db2ef1a20e041a02c520f8552..a7b505b68a09fc223aa65ad04b25dfb967861f13 100644 (file)
@@ -307,7 +307,7 @@ raw_ostream &operator<<(raw_ostream &OS, const MCFixup &AF) {
 } // end namespace llvm
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void MCFragment::dump() {
+LLVM_DUMP_METHOD void MCFragment::dump() const {
   raw_ostream &OS = errs();
 
   OS << "<";
@@ -445,19 +445,19 @@ LLVM_DUMP_METHOD void MCFragment::dump() {
   OS << ">";
 }
 
-LLVM_DUMP_METHOD void MCAssembler::dump() {
+LLVM_DUMP_METHOD void MCAssembler::dump() const{
   raw_ostream &OS = errs();
 
   OS << "<MCAssembler\n";
   OS << "  Sections:[\n    ";
-  for (iterator it = begin(), ie = end(); it != ie; ++it) {
+  for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
     if (it != begin()) OS << ",\n    ";
     it->dump();
   }
   OS << "],\n";
   OS << "  Symbols:[";
 
-  for (symbol_iterator it = symbol_begin(), ie = symbol_end(); it != ie; ++it) {
+  for (const_symbol_iterator it = symbol_begin(), ie = symbol_end(); it != ie; ++it) {
     if (it != symbol_begin()) OS << ",\n           ";
     OS << "(";
     it->dump();
index b961cb3968e86a2736c1efa22cfba421feda7427..d141dd6627c466a5f5eab8f4890151a5c9fd08aa 100644 (file)
@@ -86,7 +86,7 @@ MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void MCSection::dump() {
+LLVM_DUMP_METHOD void MCSection::dump() const {
   raw_ostream &OS = errs();
 
   OS << "<MCSection";
index 12357e0348a9ec95c82a583555b621cd57b02252..3dfef388691e73ff548e37ca833806b2cd74c50c 100644 (file)
@@ -72,7 +72,7 @@ class SystemZPostRASchedStrategy : public MachineSchedStrategy {
   // A set of SUs with a sorter and dump method.
   struct SUSet : std::set<SUnit*, SUSorter> {
     #ifndef NDEBUG
-    void dump(SystemZHazardRecognizer &HazardRec);
+    void dump(SystemZHazardRecognizer &HazardRec) const;
     #endif
   };
 
index 0490d93f64553808f7ac922d1be42c5941739c8a..f1d7efb14b98097dd70f2673ba24bb02db2cf855 100644 (file)
@@ -602,7 +602,7 @@ PreservedAnalyses GVN::run(Function &F, FunctionAnalysisManager &AM) {
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void GVN::dump(DenseMap<uint32_t, Value*>& d) {
+LLVM_DUMP_METHOD void GVN::dump(DenseMap<uint32_t, Value*>& d) const {
   errs() << "{\n";
   for (DenseMap<uint32_t, Value*>::iterator I = d.begin(),
        E = d.end(); I != E; ++I) {