)]}'
{
  "commit": "ce66e61c785a024d217cd71c95fd1eb9aa5f3ea8",
  "tree": "909d1b69c4adf6eba38b60b591200fbb00d958e6",
  "parents": [
    "2ed77dddba2e7f2d4e45ee8606e9b22acb6fb1f3"
  ],
  "author": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Fri Aug 07 10:28:19 2026 +0200"
  },
  "committer": {
    "name": "Kyrylo Tkachov",
    "email": "ktkachov@nvidia.com",
    "time": "Mon Sep 14 12:46:30 2026 +0200"
  },
  "message": "genextract: drive insn_extract from the operand path table\n\ngenextract already knows each operand\u0027s location as a path string, built\nby walk_rtx while it descends the pattern: a digit selects an XEXP and a\nletter an XVECEXP.  print_path then expanded those strings back into C,\nso insn_extract became one switch with an arm per insn code.  Patterns\nthat extract alike share an arm, but the labels still cost a line each:\non aarch64, 16068 case labels selecting 649 distinct bodies, 782KB of\nlabels against 252KB of bodies, all inside a single 1MB function.  On\nriscv64 it is 45386 labels.\n\nEmit the path strings as data and walk them instead.  Three tables\nreplace the switch.\n\nextract_method_of_code[] maps an insn code to an extraction method.\nMethod 0 means the code has no pattern to extract from, which is the\nerror case the old default arm handled, and method 1 means an old-style\ndefine_peephole, whose operand count is only known at run time:\n\n  static const unsigned short extract_method_of_code[] \u003d {\n    0, 650, 650, 649, 649, 648, 647, 646, 646, 646, ...\n\nextract_methods[] gives each method its operand and dup counts and its\noffsets into the path and dup-number pools:\n\n  static const struct extract_method_d extract_methods[] \u003d {\n    ...\n    { 51, 0, 4, 0 },        /* 4 operands, no dups, paths at offset 51 */\n\nand extract_paths[] holds the paths themselves, NUL separated, operands\nfirst and dups second.  \"1c\" is XVECEXP (XEXP (pat, 1), 0, 2), because\n\u00271\u0027 selects XEXP 1 and \u0027c\u0027 selects XVECEXP element 2:\n\n  static const char extract_paths[] \u003d\n    \"1c0\\0001c1\\0001d\\0001e\\0001f\\0001c\\0001d\\0001e\\000...\n\nSo the arm that used to read\n\n  case 16029:  /* aarch64_sme_fmopsvnx8hivnx16qi */\n  case 16028:  /* aarch64_sme_fmopavnx8hivnx16qi */\n  ...                               /* 34 more labels */\n  case 15740:  /* aarch64_sme_fmopavnx4sivnx16qi */\n    ro[0] \u003d *(ro_loc[0] \u003d \u0026XVECEXP (XEXP (pat, 1), 0, 2));\n    ro[1] \u003d *(ro_loc[1] \u003d \u0026XVECEXP (XEXP (pat, 1), 0, 3));\n    ro[2] \u003d *(ro_loc[2] \u003d \u0026XVECEXP (XEXP (pat, 1), 0, 4));\n    ro[3] \u003d *(ro_loc[3] \u003d \u0026XVECEXP (XEXP (pat, 1), 0, 5));\n    ro[4] \u003d *(ro_loc[4] \u003d \u0026XVECEXP (XEXP (pat, 1), 0, 6));\n    break;\n\nis now one shared entry \"1c\\0001d\\0001e\\0001f\\0001g\" in extract_paths[],\none row in extract_methods[], and 36 entries in extract_method_of_code[]\nthat name it.  insn_extract itself becomes a loop over the method\u0027s\noperands, calling follow_extract_path once each.\n\nThe terminator is spelled \\000 rather than \\0 because the next character\nis often a digit, which a shorter octal escape would absorb.\n\ninsn-extract.cc drops from 1.04MB/21139 lines to 124KB/1823 lines on\naarch64, 2.25MB to 246KB on riscv64, 750KB to 100KB on x86_64 and 170KB\nto 26KB on avr.  Compile time falls by 92% and peak memory\nfrom 332MB to 166MB.\n\ninsn_extract is hot, so the I measured that there\u0027s no non-noise impact\non compile time over a bunch of input files.\n\nA differential harness compares the operand and dup locations the old\nswitch and the new tables produce, for every insn code: 16116 on aarch64,\n45386 on riscv64, 11335 on x86_64, 10608 on i686 and 3562 on avr.  87007\ninsn codes, no differences.  avr covers the old-style define_peephole\npath, which the other four do not have.\n\nBootstrapped on aarch64-none-linux-gnu.\n\ngcc/ChangeLog:\n\n\t* genextract.cc (MISSING_OPERAND_CHAR): New macro.\n\t(pathpool, dupnums): New variables.\n\t(add_path, print_string_literal, print_extractions): New functions.\n\t(print_path): Remove.\n\t(print_header): Only emit the prologue.\n\t(main): Call print_extractions.\n\nSigned-off-by: Kyrylo Tkachov \u003cktkachov@nvidia.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "44094fdc281fd074aedb90e325a5095524cacbe9",
      "old_mode": 33188,
      "old_path": "gcc/genextract.cc",
      "new_id": "62babeb3982ba636afbf2ef379cb8fb6db1c208a",
      "new_mode": 33188,
      "new_path": "gcc/genextract.cc"
    }
  ]
}
