[PATCH] D139616: [TableGen] Emit table mapping physical registers to base classes

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 22:23:45 PST 2022


foad added inline comments.


================
Comment at: llvm/utils/TableGen/RegisterInfoEmitter.cpp:1622
+          else
+            return LHSOrder < RHSOrder;
+        }
----------------
critson wrote:
> foad wrote:
> > critson wrote:
> > > foad wrote:
> > > > This is `return std::tie(LHS->getBaseClassOrder(), LHS->EnumValue) < std::tie(RHS->getBaseClassOrder(), RHS->EnumValue)`
> > > `std::tie` cannot handle `std::optional` argument it seems, so I have done this with `std::pair` instead.
> > Comparing the `std::optional`s themselves is a bit silly when you have already checked that they both have a value. I would suggest just adding a `*`: `std::tie(*LHS->getBaseClassOrder(), LHS->EnumValue) ...`
> I agree the optionals can be dereferenced, but we still cannot use `std::tie` as they resulting value is not an l-value.  I really don't think it matters to use `std::pair` here (or `std::tuple`), this code is executed once during tablegen on a maximum of 254 values.
Ack. I had misunderstood std::tie.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139616



More information about the llvm-commits mailing list