[llvm] [LLVM][TableGen] Change CallingConvEmitter to use const RecordKeeper (PR #108955)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 05:00:43 PDT 2024


================
@@ -32,27 +32,31 @@ class CallingConvEmitter {
   std::map<std::string, std::set<std::string>> DelegateToMap;
 
 public:
-  explicit CallingConvEmitter(RecordKeeper &R) : Records(R) {}
+  explicit CallingConvEmitter(const RecordKeeper &R) : Records(R) {}
 
   void run(raw_ostream &o);
 
 private:
-  void EmitCallingConv(Record *CC, raw_ostream &O);
-  void EmitAction(Record *Action, unsigned Indent, raw_ostream &O);
+  void EmitCallingConv(const Record *CC, raw_ostream &O);
+  void EmitAction(const Record *Action, unsigned Indent, raw_ostream &O);
   void EmitArgRegisterLists(raw_ostream &O);
 };
 } // End anonymous namespace
 
 void CallingConvEmitter::run(raw_ostream &O) {
   emitSourceFileHeader("Calling Convention Implementation Fragment", O);
 
-  std::vector<Record *> CCs = Records.getAllDerivedDefinitions("CallingConv");
+  ArrayRef<const Record *> CCs =
+      Records.getAllDerivedDefinitions("CallingConv");
 
   // Emit prototypes for all of the non-custom CC's so that they can forward ref
   // each other.
-  Records.startTimer("Emit prototypes");
+
+  // TODO: Factor out timer support out of RecordKeeper.
----------------
jurahul wrote:

@tmatheson-arm FYI, this comment. I'll hold off on committing this and use your second suggestion to mmkae these functions const.

https://github.com/llvm/llvm-project/pull/108955


More information about the llvm-commits mailing list