[PATCH] D88355: [DWARFYAML] Make the opcode_base and the standard_opcode_lengths fields optional.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 05:57:25 PDT 2020


Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:556-560
+getStandardOpcodeLengths(uint16_t Version, Optional<uint8_t> OpcodeBase) {
+  if (OpcodeBase)
+    return std::vector<uint8_t>(*OpcodeBase > 0 ? *OpcodeBase - 1 : 0);
+  return std::vector<uint8_t>{0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1};
+}
----------------
jhenderson wrote:
> You don't use the `Version` parameter, it looks like? I think you should - define the values based on the specified version, perhaps defaulting to v4 if the version is unknown (actually, I'd probably default to whatever the latest is, but that's academic, as v4 and v5 have the same standard opcodes).
I like the latter approach. When I generate the DWARFv2 line table using `clang -gdwarf-2 a.c`, the opcode_base field of the generated line table is 13 as well. I think making `getStandardOpcodeLengths` return the standard_opcode_lengths according to the latest DWARF spec is fine here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88355



More information about the llvm-commits mailing list