gdbserver does not expose combined ymm* registers but rather XSAVE-style
split xmm* and ymm*h portions. Extend value_regs to support combining
multiple registers and use it to create user-friendly ymm* registers
that are combined from split xmm* and ymm*h portions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I like the solution with multiple value_regs.
However, I am wondering if instead of the various piecemeal maps we couldn't just have one uber-map to rule them all. I'm imagining something like
enum (class?) RegKind { GPR, FPR, XMM, ...}; struct RegData { size_t index; StringRef name; SmallVector<StringRef> subregs; }; map<pair<RegKind, unsigned>, RegData> reg_map = makeRegMap(); // whichever kind of a map // or possibly, map<RegKind, map<unsigned, RegData>> = ... for (const auto &kv : reg_map) subreg_name_set.insert(kv.second.subregs.begin(), kv.second.subregs.end()); for (const auto &x : llvm::enumerate(regs)) { llvm::StringRef reg_name = x.value().name.GetStringRef(); if (llvm::is_contained(subreg_name_set, reg_name)) return; if (Optional<pair<RegKind, size_t>> reg = get_reg(reg_name)) reg_map[reg].index = x.index(); } ...
This would allow us to factor out two tedious jobs (constructing the register map and identifying registers) into separate functions, leaving only the only (simplified, I hope) core logic for the main function. The get_reg function could use whichever method is easiest for the translation of register names, or even a combination of methods (a StringSwitch for gprs and some consume_fronts for the regularly-named registers).
WDYT?
lldb/source/Plugins/ABI/X86/ABIX86.cpp | ||
---|---|---|
235 | For a simple list like this, I'd probably remove the trailing comma to have clang-format format it more succinctly. |
I'm not sure what exactly you're proposing and whether your proposal would work but I think it's a step in the right direction.
Let's start by reiterating what we need:
- A way to iterate over all subregisters of given RegKind, sorted by base register index, yielding base register index and subregister name (map<RegKind, vector<...>>.
- A way to match register name against all *expected* subregisters in order to abort if any of them exists (set<StringRef>).
- A way to match register name against all known base registers and store their indices (map<StringRef, ...>).
- We should be able to construct all of the above from some readable input.
lldb/source/Plugins/ABI/X86/ABIX86.cpp | ||
---|---|---|
235 | Heh, I was wondering why clang-format chooses one format sometimes, and the other sometimes but it wouldn't occur to me that it's due to the trailing comma ;-). |
Looks good. Thanks for your patience.
lldb/source/Plugins/ABI/X86/ABIX86.cpp | ||
---|---|---|
36–64 | anonymous namespace here |
anonymous namespace here