[llvm] [LLVM][TableGen] Change DAGISel code to use const RecordKeeper (PR #109038)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 04:50:58 PDT 2024


================
@@ -132,7 +132,8 @@ struct PatternSortingPredicate {
 } // End anonymous namespace
 
 void DAGISelEmitter::run(raw_ostream &OS) {
-  Records.startTimer("Parse patterns");
+  RecordKeeper &MutableRC = const_cast<RecordKeeper &>(Records);
----------------
jurahul wrote:

I agree that the timer functionality should be factored out of RecordKeeper (I have a TODO comment to that effect in on of my other PRs) and that's the best long-term solution. Meanwhile, making the timer functions const and hiding the cast inside is better than const_cast<>, so I'll change that. 

For this set of files, we don't gain much, but the end goal is to make all TG backends use a const RecordKeeper which will vend out const pointers to Records (and then also make Record members that just return pointers to others also return const pointers etc.)

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


More information about the llvm-commits mailing list