opcode.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. // Copyright (c) 2015-2016 The Khronos Group Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include "source/opcode.h"
  15. #include <assert.h>
  16. #include <string.h>
  17. #include <algorithm>
  18. #include <cstdlib>
  19. #include "source/instruction.h"
  20. #include "source/macro.h"
  21. #include "source/spirv_constant.h"
  22. #include "source/spirv_endian.h"
  23. #include "source/spirv_target_env.h"
  24. #include "spirv-tools/libspirv.h"
  25. namespace {
  26. struct OpcodeDescPtrLen {
  27. const spv_opcode_desc_t* ptr;
  28. uint32_t len;
  29. };
  30. #include "core.insts-unified1.inc"
  31. static const spv_opcode_table_t kOpcodeTable = {ARRAY_SIZE(kOpcodeTableEntries),
  32. kOpcodeTableEntries};
  33. // Represents a vendor tool entry in the SPIR-V XML Regsitry.
  34. struct VendorTool {
  35. uint32_t value;
  36. const char* vendor;
  37. const char* tool; // Might be empty string.
  38. const char* vendor_tool; // Combiantion of vendor and tool.
  39. };
  40. const VendorTool vendor_tools[] = {
  41. #include "generators.inc"
  42. };
  43. } // anonymous namespace
  44. // TODO(dneto): Move this to another file. It doesn't belong with opcode
  45. // processing.
  46. const char* spvGeneratorStr(uint32_t generator) {
  47. auto where = std::find_if(
  48. std::begin(vendor_tools), std::end(vendor_tools),
  49. [generator](const VendorTool& vt) { return generator == vt.value; });
  50. if (where != std::end(vendor_tools)) return where->vendor_tool;
  51. return "Unknown";
  52. }
  53. uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode) {
  54. return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16);
  55. }
  56. void spvOpcodeSplit(const uint32_t word, uint16_t* pWordCount,
  57. uint16_t* pOpcode) {
  58. if (pWordCount) {
  59. *pWordCount = (uint16_t)((0xffff0000 & word) >> 16);
  60. }
  61. if (pOpcode) {
  62. *pOpcode = 0x0000ffff & word;
  63. }
  64. }
  65. spv_result_t spvOpcodeTableGet(spv_opcode_table* pInstTable, spv_target_env) {
  66. if (!pInstTable) return SPV_ERROR_INVALID_POINTER;
  67. // Descriptions of each opcode. Each entry describes the format of the
  68. // instruction that follows a particular opcode.
  69. *pInstTable = &kOpcodeTable;
  70. return SPV_SUCCESS;
  71. }
  72. spv_result_t spvOpcodeTableNameLookup(spv_target_env env,
  73. const spv_opcode_table table,
  74. const char* name,
  75. spv_opcode_desc* pEntry) {
  76. if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER;
  77. if (!table) return SPV_ERROR_INVALID_TABLE;
  78. // TODO: This lookup of the Opcode table is suboptimal! Binary sort would be
  79. // preferable but the table requires sorting on the Opcode name, but it's
  80. // static const initialized and matches the order of the spec.
  81. const size_t nameLength = strlen(name);
  82. for (uint64_t opcodeIndex = 0; opcodeIndex < table->count; ++opcodeIndex) {
  83. const spv_opcode_desc_t& entry = table->entries[opcodeIndex];
  84. // We considers the current opcode as available as long as
  85. // 1. The target environment satisfies the minimal requirement of the
  86. // opcode; or
  87. // 2. There is at least one extension enabling this opcode.
  88. //
  89. // Note that the second rule assumes the extension enabling this instruction
  90. // is indeed requested in the SPIR-V code; checking that should be
  91. // validator's work.
  92. if ((spvVersionForTargetEnv(env) >= entry.minVersion ||
  93. entry.numExtensions > 0u || entry.numCapabilities > 0u) &&
  94. nameLength == strlen(entry.name) &&
  95. !strncmp(name, entry.name, nameLength)) {
  96. // NOTE: Found out Opcode!
  97. *pEntry = &entry;
  98. return SPV_SUCCESS;
  99. }
  100. }
  101. return SPV_ERROR_INVALID_LOOKUP;
  102. }
  103. spv_result_t spvOpcodeTableValueLookup(spv_target_env env,
  104. const spv_opcode_table table,
  105. const SpvOp opcode,
  106. spv_opcode_desc* pEntry) {
  107. if (!table) return SPV_ERROR_INVALID_TABLE;
  108. if (!pEntry) return SPV_ERROR_INVALID_POINTER;
  109. const auto beg = table->entries;
  110. const auto end = table->entries + table->count;
  111. spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {},
  112. false, false, 0, nullptr, ~0u};
  113. auto comp = [](const spv_opcode_desc_t& lhs, const spv_opcode_desc_t& rhs) {
  114. return lhs.opcode < rhs.opcode;
  115. };
  116. // We need to loop here because there can exist multiple symbols for the same
  117. // opcode value, and they can be introduced in different target environments,
  118. // which means they can have different minimal version requirements.
  119. // Assumes the underlying table is already sorted ascendingly according to
  120. // opcode value.
  121. for (auto it = std::lower_bound(beg, end, needle, comp);
  122. it != end && it->opcode == opcode; ++it) {
  123. // We considers the current opcode as available as long as
  124. // 1. The target environment satisfies the minimal requirement of the
  125. // opcode; or
  126. // 2. There is at least one extension enabling this opcode.
  127. //
  128. // Note that the second rule assumes the extension enabling this instruction
  129. // is indeed requested in the SPIR-V code; checking that should be
  130. // validator's work.
  131. if (spvVersionForTargetEnv(env) >= it->minVersion ||
  132. it->numExtensions > 0u || it->numCapabilities > 0u) {
  133. *pEntry = it;
  134. return SPV_SUCCESS;
  135. }
  136. }
  137. return SPV_ERROR_INVALID_LOOKUP;
  138. }
  139. void spvInstructionCopy(const uint32_t* words, const SpvOp opcode,
  140. const uint16_t wordCount, const spv_endianness_t endian,
  141. spv_instruction_t* pInst) {
  142. pInst->opcode = opcode;
  143. pInst->words.resize(wordCount);
  144. for (uint16_t wordIndex = 0; wordIndex < wordCount; ++wordIndex) {
  145. pInst->words[wordIndex] = spvFixWord(words[wordIndex], endian);
  146. if (!wordIndex) {
  147. uint16_t thisWordCount;
  148. uint16_t thisOpcode;
  149. spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode);
  150. assert(opcode == static_cast<SpvOp>(thisOpcode) &&
  151. wordCount == thisWordCount && "Endianness failed!");
  152. }
  153. }
  154. }
  155. const char* spvOpcodeString(const SpvOp opcode) {
  156. const auto beg = kOpcodeTableEntries;
  157. const auto end = kOpcodeTableEntries + ARRAY_SIZE(kOpcodeTableEntries);
  158. spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {},
  159. false, false, 0, nullptr, ~0u};
  160. auto comp = [](const spv_opcode_desc_t& lhs, const spv_opcode_desc_t& rhs) {
  161. return lhs.opcode < rhs.opcode;
  162. };
  163. auto it = std::lower_bound(beg, end, needle, comp);
  164. if (it != end && it->opcode == opcode) {
  165. return it->name;
  166. }
  167. assert(0 && "Unreachable!");
  168. return "unknown";
  169. }
  170. int32_t spvOpcodeIsScalarType(const SpvOp opcode) {
  171. switch (opcode) {
  172. case SpvOpTypeInt:
  173. case SpvOpTypeFloat:
  174. case SpvOpTypeBool:
  175. return true;
  176. default:
  177. return false;
  178. }
  179. }
  180. int32_t spvOpcodeIsSpecConstant(const SpvOp opcode) {
  181. switch (opcode) {
  182. case SpvOpSpecConstantTrue:
  183. case SpvOpSpecConstantFalse:
  184. case SpvOpSpecConstant:
  185. case SpvOpSpecConstantComposite:
  186. case SpvOpSpecConstantOp:
  187. return true;
  188. default:
  189. return false;
  190. }
  191. }
  192. int32_t spvOpcodeIsConstant(const SpvOp opcode) {
  193. switch (opcode) {
  194. case SpvOpConstantTrue:
  195. case SpvOpConstantFalse:
  196. case SpvOpConstant:
  197. case SpvOpConstantComposite:
  198. case SpvOpConstantSampler:
  199. case SpvOpConstantNull:
  200. case SpvOpSpecConstantTrue:
  201. case SpvOpSpecConstantFalse:
  202. case SpvOpSpecConstant:
  203. case SpvOpSpecConstantComposite:
  204. case SpvOpSpecConstantOp:
  205. return true;
  206. default:
  207. return false;
  208. }
  209. }
  210. bool spvOpcodeIsConstantOrUndef(const SpvOp opcode) {
  211. return opcode == SpvOpUndef || spvOpcodeIsConstant(opcode);
  212. }
  213. bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode) {
  214. switch (opcode) {
  215. case SpvOpSpecConstantTrue:
  216. case SpvOpSpecConstantFalse:
  217. case SpvOpSpecConstant:
  218. return true;
  219. default:
  220. return false;
  221. }
  222. }
  223. int32_t spvOpcodeIsComposite(const SpvOp opcode) {
  224. switch (opcode) {
  225. case SpvOpTypeVector:
  226. case SpvOpTypeMatrix:
  227. case SpvOpTypeArray:
  228. case SpvOpTypeStruct:
  229. case SpvOpTypeCooperativeMatrixNV:
  230. return true;
  231. default:
  232. return false;
  233. }
  234. }
  235. bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode) {
  236. switch (opcode) {
  237. case SpvOpVariable:
  238. case SpvOpAccessChain:
  239. case SpvOpInBoundsAccessChain:
  240. case SpvOpFunctionParameter:
  241. case SpvOpImageTexelPointer:
  242. case SpvOpCopyObject:
  243. case SpvOpSelect:
  244. case SpvOpPhi:
  245. case SpvOpFunctionCall:
  246. case SpvOpPtrAccessChain:
  247. case SpvOpLoad:
  248. case SpvOpConstantNull:
  249. return true;
  250. default:
  251. return false;
  252. }
  253. }
  254. int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode) {
  255. switch (opcode) {
  256. case SpvOpVariable:
  257. case SpvOpAccessChain:
  258. case SpvOpInBoundsAccessChain:
  259. case SpvOpFunctionParameter:
  260. case SpvOpImageTexelPointer:
  261. case SpvOpCopyObject:
  262. return true;
  263. default:
  264. return false;
  265. }
  266. }
  267. int32_t spvOpcodeGeneratesType(SpvOp op) {
  268. switch (op) {
  269. case SpvOpTypeVoid:
  270. case SpvOpTypeBool:
  271. case SpvOpTypeInt:
  272. case SpvOpTypeFloat:
  273. case SpvOpTypeVector:
  274. case SpvOpTypeMatrix:
  275. case SpvOpTypeImage:
  276. case SpvOpTypeSampler:
  277. case SpvOpTypeSampledImage:
  278. case SpvOpTypeArray:
  279. case SpvOpTypeRuntimeArray:
  280. case SpvOpTypeStruct:
  281. case SpvOpTypeOpaque:
  282. case SpvOpTypePointer:
  283. case SpvOpTypeFunction:
  284. case SpvOpTypeEvent:
  285. case SpvOpTypeDeviceEvent:
  286. case SpvOpTypeReserveId:
  287. case SpvOpTypeQueue:
  288. case SpvOpTypePipe:
  289. case SpvOpTypePipeStorage:
  290. case SpvOpTypeNamedBarrier:
  291. case SpvOpTypeAccelerationStructureNV:
  292. case SpvOpTypeCooperativeMatrixNV:
  293. return true;
  294. default:
  295. // In particular, OpTypeForwardPointer does not generate a type,
  296. // but declares a storage class for a pointer type generated
  297. // by a different instruction.
  298. break;
  299. }
  300. return 0;
  301. }
  302. bool spvOpcodeIsDecoration(const SpvOp opcode) {
  303. switch (opcode) {
  304. case SpvOpDecorate:
  305. case SpvOpDecorateId:
  306. case SpvOpMemberDecorate:
  307. case SpvOpGroupDecorate:
  308. case SpvOpGroupMemberDecorate:
  309. case SpvOpDecorateStringGOOGLE:
  310. case SpvOpMemberDecorateStringGOOGLE:
  311. return true;
  312. default:
  313. break;
  314. }
  315. return false;
  316. }
  317. bool spvOpcodeIsLoad(const SpvOp opcode) {
  318. switch (opcode) {
  319. case SpvOpLoad:
  320. case SpvOpImageSampleExplicitLod:
  321. case SpvOpImageSampleImplicitLod:
  322. case SpvOpImageSampleDrefImplicitLod:
  323. case SpvOpImageSampleDrefExplicitLod:
  324. case SpvOpImageSampleProjImplicitLod:
  325. case SpvOpImageSampleProjExplicitLod:
  326. case SpvOpImageSampleProjDrefImplicitLod:
  327. case SpvOpImageSampleProjDrefExplicitLod:
  328. case SpvOpImageFetch:
  329. case SpvOpImageGather:
  330. case SpvOpImageDrefGather:
  331. case SpvOpImageRead:
  332. case SpvOpImageSparseSampleImplicitLod:
  333. case SpvOpImageSparseSampleExplicitLod:
  334. case SpvOpImageSparseSampleDrefExplicitLod:
  335. case SpvOpImageSparseSampleDrefImplicitLod:
  336. case SpvOpImageSparseFetch:
  337. case SpvOpImageSparseGather:
  338. case SpvOpImageSparseDrefGather:
  339. case SpvOpImageSparseRead:
  340. return true;
  341. default:
  342. return false;
  343. }
  344. }
  345. bool spvOpcodeIsBranch(SpvOp opcode) {
  346. switch (opcode) {
  347. case SpvOpBranch:
  348. case SpvOpBranchConditional:
  349. case SpvOpSwitch:
  350. return true;
  351. default:
  352. return false;
  353. }
  354. }
  355. bool spvOpcodeIsAtomicWithLoad(const SpvOp opcode) {
  356. switch (opcode) {
  357. case SpvOpAtomicLoad:
  358. case SpvOpAtomicExchange:
  359. case SpvOpAtomicCompareExchange:
  360. case SpvOpAtomicCompareExchangeWeak:
  361. case SpvOpAtomicIIncrement:
  362. case SpvOpAtomicIDecrement:
  363. case SpvOpAtomicIAdd:
  364. case SpvOpAtomicISub:
  365. case SpvOpAtomicSMin:
  366. case SpvOpAtomicUMin:
  367. case SpvOpAtomicSMax:
  368. case SpvOpAtomicUMax:
  369. case SpvOpAtomicAnd:
  370. case SpvOpAtomicOr:
  371. case SpvOpAtomicXor:
  372. case SpvOpAtomicFlagTestAndSet:
  373. return true;
  374. default:
  375. return false;
  376. }
  377. }
  378. bool spvOpcodeIsAtomicOp(const SpvOp opcode) {
  379. return (spvOpcodeIsAtomicWithLoad(opcode) || opcode == SpvOpAtomicStore ||
  380. opcode == SpvOpAtomicFlagClear);
  381. }
  382. bool spvOpcodeIsReturn(SpvOp opcode) {
  383. switch (opcode) {
  384. case SpvOpReturn:
  385. case SpvOpReturnValue:
  386. return true;
  387. default:
  388. return false;
  389. }
  390. }
  391. bool spvOpcodeIsReturnOrAbort(SpvOp opcode) {
  392. return spvOpcodeIsReturn(opcode) || opcode == SpvOpKill ||
  393. opcode == SpvOpUnreachable;
  394. }
  395. bool spvOpcodeIsBlockTerminator(SpvOp opcode) {
  396. return spvOpcodeIsBranch(opcode) || spvOpcodeIsReturnOrAbort(opcode);
  397. }
  398. bool spvOpcodeIsBaseOpaqueType(SpvOp opcode) {
  399. switch (opcode) {
  400. case SpvOpTypeImage:
  401. case SpvOpTypeSampler:
  402. case SpvOpTypeSampledImage:
  403. case SpvOpTypeOpaque:
  404. case SpvOpTypeEvent:
  405. case SpvOpTypeDeviceEvent:
  406. case SpvOpTypeReserveId:
  407. case SpvOpTypeQueue:
  408. case SpvOpTypePipe:
  409. case SpvOpTypeForwardPointer:
  410. case SpvOpTypePipeStorage:
  411. case SpvOpTypeNamedBarrier:
  412. return true;
  413. default:
  414. return false;
  415. }
  416. }
  417. bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode) {
  418. switch (opcode) {
  419. case SpvOpGroupNonUniformElect:
  420. case SpvOpGroupNonUniformAll:
  421. case SpvOpGroupNonUniformAny:
  422. case SpvOpGroupNonUniformAllEqual:
  423. case SpvOpGroupNonUniformBroadcast:
  424. case SpvOpGroupNonUniformBroadcastFirst:
  425. case SpvOpGroupNonUniformBallot:
  426. case SpvOpGroupNonUniformInverseBallot:
  427. case SpvOpGroupNonUniformBallotBitExtract:
  428. case SpvOpGroupNonUniformBallotBitCount:
  429. case SpvOpGroupNonUniformBallotFindLSB:
  430. case SpvOpGroupNonUniformBallotFindMSB:
  431. case SpvOpGroupNonUniformShuffle:
  432. case SpvOpGroupNonUniformShuffleXor:
  433. case SpvOpGroupNonUniformShuffleUp:
  434. case SpvOpGroupNonUniformShuffleDown:
  435. case SpvOpGroupNonUniformIAdd:
  436. case SpvOpGroupNonUniformFAdd:
  437. case SpvOpGroupNonUniformIMul:
  438. case SpvOpGroupNonUniformFMul:
  439. case SpvOpGroupNonUniformSMin:
  440. case SpvOpGroupNonUniformUMin:
  441. case SpvOpGroupNonUniformFMin:
  442. case SpvOpGroupNonUniformSMax:
  443. case SpvOpGroupNonUniformUMax:
  444. case SpvOpGroupNonUniformFMax:
  445. case SpvOpGroupNonUniformBitwiseAnd:
  446. case SpvOpGroupNonUniformBitwiseOr:
  447. case SpvOpGroupNonUniformBitwiseXor:
  448. case SpvOpGroupNonUniformLogicalAnd:
  449. case SpvOpGroupNonUniformLogicalOr:
  450. case SpvOpGroupNonUniformLogicalXor:
  451. case SpvOpGroupNonUniformQuadBroadcast:
  452. case SpvOpGroupNonUniformQuadSwap:
  453. return true;
  454. default:
  455. return false;
  456. }
  457. }
  458. bool spvOpcodeIsScalarizable(SpvOp opcode) {
  459. switch (opcode) {
  460. case SpvOpPhi:
  461. case SpvOpCopyObject:
  462. case SpvOpConvertFToU:
  463. case SpvOpConvertFToS:
  464. case SpvOpConvertSToF:
  465. case SpvOpConvertUToF:
  466. case SpvOpUConvert:
  467. case SpvOpSConvert:
  468. case SpvOpFConvert:
  469. case SpvOpQuantizeToF16:
  470. case SpvOpVectorInsertDynamic:
  471. case SpvOpSNegate:
  472. case SpvOpFNegate:
  473. case SpvOpIAdd:
  474. case SpvOpFAdd:
  475. case SpvOpISub:
  476. case SpvOpFSub:
  477. case SpvOpIMul:
  478. case SpvOpFMul:
  479. case SpvOpUDiv:
  480. case SpvOpSDiv:
  481. case SpvOpFDiv:
  482. case SpvOpUMod:
  483. case SpvOpSRem:
  484. case SpvOpSMod:
  485. case SpvOpFRem:
  486. case SpvOpFMod:
  487. case SpvOpVectorTimesScalar:
  488. case SpvOpIAddCarry:
  489. case SpvOpISubBorrow:
  490. case SpvOpUMulExtended:
  491. case SpvOpSMulExtended:
  492. case SpvOpShiftRightLogical:
  493. case SpvOpShiftRightArithmetic:
  494. case SpvOpShiftLeftLogical:
  495. case SpvOpBitwiseOr:
  496. case SpvOpBitwiseAnd:
  497. case SpvOpNot:
  498. case SpvOpBitFieldInsert:
  499. case SpvOpBitFieldSExtract:
  500. case SpvOpBitFieldUExtract:
  501. case SpvOpBitReverse:
  502. case SpvOpBitCount:
  503. case SpvOpIsNan:
  504. case SpvOpIsInf:
  505. case SpvOpIsFinite:
  506. case SpvOpIsNormal:
  507. case SpvOpSignBitSet:
  508. case SpvOpLessOrGreater:
  509. case SpvOpOrdered:
  510. case SpvOpUnordered:
  511. case SpvOpLogicalEqual:
  512. case SpvOpLogicalNotEqual:
  513. case SpvOpLogicalOr:
  514. case SpvOpLogicalAnd:
  515. case SpvOpLogicalNot:
  516. case SpvOpSelect:
  517. case SpvOpIEqual:
  518. case SpvOpINotEqual:
  519. case SpvOpUGreaterThan:
  520. case SpvOpSGreaterThan:
  521. case SpvOpUGreaterThanEqual:
  522. case SpvOpSGreaterThanEqual:
  523. case SpvOpULessThan:
  524. case SpvOpSLessThan:
  525. case SpvOpULessThanEqual:
  526. case SpvOpSLessThanEqual:
  527. case SpvOpFOrdEqual:
  528. case SpvOpFUnordEqual:
  529. case SpvOpFOrdNotEqual:
  530. case SpvOpFUnordNotEqual:
  531. case SpvOpFOrdLessThan:
  532. case SpvOpFUnordLessThan:
  533. case SpvOpFOrdGreaterThan:
  534. case SpvOpFUnordGreaterThan:
  535. case SpvOpFOrdLessThanEqual:
  536. case SpvOpFUnordLessThanEqual:
  537. case SpvOpFOrdGreaterThanEqual:
  538. case SpvOpFUnordGreaterThanEqual:
  539. return true;
  540. default:
  541. return false;
  542. }
  543. }
  544. bool spvOpcodeIsDebug(SpvOp opcode) {
  545. switch (opcode) {
  546. case SpvOpName:
  547. case SpvOpMemberName:
  548. case SpvOpSource:
  549. case SpvOpSourceContinued:
  550. case SpvOpSourceExtension:
  551. case SpvOpString:
  552. case SpvOpLine:
  553. case SpvOpNoLine:
  554. return true;
  555. default:
  556. return false;
  557. }
  558. }