[PATCH] D125421: [TableGen] Add generation of argument register lists

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 17:18:18 PDT 2022


nickdesaulniers added inline comments.


================
Comment at: llvm/utils/TableGen/CallingConvEmitter.cpp:332-353
+restart:
+  for (EntryTy &Entry : DelegateToMap) {
+    StringRef RegName = Entry.first();
+    std::set<std::string> &Registers = Entry.second;
+    if (!Registers.empty())
+      continue;
+
----------------
nickdesaulniers wrote:
> i.e. I _think_ you could avoid the goto here with:
> 
> ```
> for (auto *It = DelgateToMap.begin(), E = DelegateToMap.end(); Entry != E; ++E) {
>   StringRef Regname = It->first();
>   ...
>   DelegateToMap.erase(RegName.str());
> }
> ```
> if DelegateToMap was a std::map.
> https://stackoverflow.com/a/54004916
> (Iterator invalidation being the weak point to range-for)
> for (auto *It = DelgateToMap.begin(), E = DelegateToMap.end(); Entry != E; ++E) {

Sorry, only renamed one of the expressions, should have been
```
for (auto *It = DelgateToMap.begin(), E = DelegateToMap.end(); It != E; ++It) {
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125421/new/

https://reviews.llvm.org/D125421



More information about the llvm-commits mailing list