[llvm] [GC] Support bidirectional iterator in GCStrategyMap (PR #99316)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 23:10:16 PDT 2024


================
@@ -151,15 +151,46 @@ class GCFunctionInfo {
   size_t live_size(const iterator &p) const { return roots_size(); }
 };
 
-struct GCStrategyMap {
+class GCStrategyMap {
   StringMap<std::unique_ptr<GCStrategy>> StrategyMap;
+  SmallVector<GCStrategy *, 1> StrategyList; // For bidirectional iterator.
----------------
paperchalice wrote:

We need a flat map here:
https://github.com/llvm/llvm-project/blob/3b78dfa10c4b77581cc29c4510aefe919ae660ba/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L521-L525
https://github.com/llvm/llvm-project/blob/3b78dfa10c4b77581cc29c4510aefe919ae660ba/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L2469-L2471
Indexed by name here because GC printers need it (see `OCamlGCPrinter.cpp`).

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


More information about the llvm-commits mailing list