opcode.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  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. return true;
  230. default:
  231. return false;
  232. }
  233. }
  234. bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode) {
  235. switch (opcode) {
  236. case SpvOpVariable:
  237. case SpvOpAccessChain:
  238. case SpvOpInBoundsAccessChain:
  239. case SpvOpFunctionParameter:
  240. case SpvOpImageTexelPointer:
  241. case SpvOpCopyObject:
  242. case SpvOpSelect:
  243. case SpvOpPhi:
  244. case SpvOpFunctionCall:
  245. case SpvOpPtrAccessChain:
  246. case SpvOpLoad:
  247. case SpvOpConstantNull:
  248. return true;
  249. default:
  250. return false;
  251. }
  252. }
  253. int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode) {
  254. switch (opcode) {
  255. case SpvOpVariable:
  256. case SpvOpAccessChain:
  257. case SpvOpInBoundsAccessChain:
  258. case SpvOpFunctionParameter:
  259. case SpvOpImageTexelPointer:
  260. case SpvOpCopyObject:
  261. return true;
  262. default:
  263. return false;
  264. }
  265. }
  266. int32_t spvOpcodeGeneratesType(SpvOp op) {
  267. switch (op) {
  268. case SpvOpTypeVoid:
  269. case SpvOpTypeBool:
  270. case SpvOpTypeInt:
  271. case SpvOpTypeFloat:
  272. case SpvOpTypeVector:
  273. case SpvOpTypeMatrix:
  274. case SpvOpTypeImage:
  275. case SpvOpTypeSampler:
  276. case SpvOpTypeSampledImage:
  277. case SpvOpTypeArray:
  278. case SpvOpTypeRuntimeArray:
  279. case SpvOpTypeStruct:
  280. case SpvOpTypeOpaque:
  281. case SpvOpTypePointer:
  282. case SpvOpTypeFunction:
  283. case SpvOpTypeEvent:
  284. case SpvOpTypeDeviceEvent:
  285. case SpvOpTypeReserveId:
  286. case SpvOpTypeQueue:
  287. case SpvOpTypePipe:
  288. case SpvOpTypePipeStorage:
  289. case SpvOpTypeNamedBarrier:
  290. case SpvOpTypeAccelerationStructureNV:
  291. return true;
  292. default:
  293. // In particular, OpTypeForwardPointer does not generate a type,
  294. // but declares a storage class for a pointer type generated
  295. // by a different instruction.
  296. break;
  297. }
  298. return 0;
  299. }
  300. bool spvOpcodeIsDecoration(const SpvOp opcode) {
  301. switch (opcode) {
  302. case SpvOpDecorate:
  303. case SpvOpDecorateId:
  304. case SpvOpMemberDecorate:
  305. case SpvOpGroupDecorate:
  306. case SpvOpGroupMemberDecorate:
  307. case SpvOpDecorateStringGOOGLE:
  308. case SpvOpMemberDecorateStringGOOGLE:
  309. return true;
  310. default:
  311. break;
  312. }
  313. return false;
  314. }
  315. bool spvOpcodeIsLoad(const SpvOp opcode) {
  316. switch (opcode) {
  317. case SpvOpLoad:
  318. case SpvOpImageSampleExplicitLod:
  319. case SpvOpImageSampleImplicitLod:
  320. case SpvOpImageSampleDrefImplicitLod:
  321. case SpvOpImageSampleDrefExplicitLod:
  322. case SpvOpImageSampleProjImplicitLod:
  323. case SpvOpImageSampleProjExplicitLod:
  324. case SpvOpImageSampleProjDrefImplicitLod:
  325. case SpvOpImageSampleProjDrefExplicitLod:
  326. case SpvOpImageFetch:
  327. case SpvOpImageGather:
  328. case SpvOpImageDrefGather:
  329. case SpvOpImageRead:
  330. case SpvOpImageSparseSampleImplicitLod:
  331. case SpvOpImageSparseSampleExplicitLod:
  332. case SpvOpImageSparseSampleDrefExplicitLod:
  333. case SpvOpImageSparseSampleDrefImplicitLod:
  334. case SpvOpImageSparseFetch:
  335. case SpvOpImageSparseGather:
  336. case SpvOpImageSparseDrefGather:
  337. case SpvOpImageSparseRead:
  338. return true;
  339. default:
  340. return false;
  341. }
  342. }
  343. bool spvOpcodeIsBranch(SpvOp opcode) {
  344. switch (opcode) {
  345. case SpvOpBranch:
  346. case SpvOpBranchConditional:
  347. case SpvOpSwitch:
  348. return true;
  349. default:
  350. return false;
  351. }
  352. }
  353. bool spvOpcodeIsAtomicWithLoad(const SpvOp opcode) {
  354. switch (opcode) {
  355. case SpvOpAtomicLoad:
  356. case SpvOpAtomicExchange:
  357. case SpvOpAtomicCompareExchange:
  358. case SpvOpAtomicCompareExchangeWeak:
  359. case SpvOpAtomicIIncrement:
  360. case SpvOpAtomicIDecrement:
  361. case SpvOpAtomicIAdd:
  362. case SpvOpAtomicISub:
  363. case SpvOpAtomicSMin:
  364. case SpvOpAtomicUMin:
  365. case SpvOpAtomicSMax:
  366. case SpvOpAtomicUMax:
  367. case SpvOpAtomicAnd:
  368. case SpvOpAtomicOr:
  369. case SpvOpAtomicXor:
  370. case SpvOpAtomicFlagTestAndSet:
  371. return true;
  372. default:
  373. return false;
  374. }
  375. }
  376. bool spvOpcodeIsAtomicOp(const SpvOp opcode) {
  377. return (spvOpcodeIsAtomicWithLoad(opcode) || opcode == SpvOpAtomicStore ||
  378. opcode == SpvOpAtomicFlagClear);
  379. }
  380. bool spvOpcodeIsReturn(SpvOp opcode) {
  381. switch (opcode) {
  382. case SpvOpReturn:
  383. case SpvOpReturnValue:
  384. return true;
  385. default:
  386. return false;
  387. }
  388. }
  389. bool spvOpcodeIsReturnOrAbort(SpvOp opcode) {
  390. return spvOpcodeIsReturn(opcode) || opcode == SpvOpKill ||
  391. opcode == SpvOpUnreachable;
  392. }
  393. bool spvOpcodeIsBlockTerminator(SpvOp opcode) {
  394. return spvOpcodeIsBranch(opcode) || spvOpcodeIsReturnOrAbort(opcode);
  395. }
  396. bool spvOpcodeIsBaseOpaqueType(SpvOp opcode) {
  397. switch (opcode) {
  398. case SpvOpTypeImage:
  399. case SpvOpTypeSampler:
  400. case SpvOpTypeSampledImage:
  401. case SpvOpTypeOpaque:
  402. case SpvOpTypeEvent:
  403. case SpvOpTypeDeviceEvent:
  404. case SpvOpTypeReserveId:
  405. case SpvOpTypeQueue:
  406. case SpvOpTypePipe:
  407. case SpvOpTypeForwardPointer:
  408. case SpvOpTypePipeStorage:
  409. case SpvOpTypeNamedBarrier:
  410. return true;
  411. default:
  412. return false;
  413. }
  414. }
  415. bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode) {
  416. switch (opcode) {
  417. case SpvOpGroupNonUniformElect:
  418. case SpvOpGroupNonUniformAll:
  419. case SpvOpGroupNonUniformAny:
  420. case SpvOpGroupNonUniformAllEqual:
  421. case SpvOpGroupNonUniformBroadcast:
  422. case SpvOpGroupNonUniformBroadcastFirst:
  423. case SpvOpGroupNonUniformBallot:
  424. case SpvOpGroupNonUniformInverseBallot:
  425. case SpvOpGroupNonUniformBallotBitExtract:
  426. case SpvOpGroupNonUniformBallotBitCount:
  427. case SpvOpGroupNonUniformBallotFindLSB:
  428. case SpvOpGroupNonUniformBallotFindMSB:
  429. case SpvOpGroupNonUniformShuffle:
  430. case SpvOpGroupNonUniformShuffleXor:
  431. case SpvOpGroupNonUniformShuffleUp:
  432. case SpvOpGroupNonUniformShuffleDown:
  433. case SpvOpGroupNonUniformIAdd:
  434. case SpvOpGroupNonUniformFAdd:
  435. case SpvOpGroupNonUniformIMul:
  436. case SpvOpGroupNonUniformFMul:
  437. case SpvOpGroupNonUniformSMin:
  438. case SpvOpGroupNonUniformUMin:
  439. case SpvOpGroupNonUniformFMin:
  440. case SpvOpGroupNonUniformSMax:
  441. case SpvOpGroupNonUniformUMax:
  442. case SpvOpGroupNonUniformFMax:
  443. case SpvOpGroupNonUniformBitwiseAnd:
  444. case SpvOpGroupNonUniformBitwiseOr:
  445. case SpvOpGroupNonUniformBitwiseXor:
  446. case SpvOpGroupNonUniformLogicalAnd:
  447. case SpvOpGroupNonUniformLogicalOr:
  448. case SpvOpGroupNonUniformLogicalXor:
  449. case SpvOpGroupNonUniformQuadBroadcast:
  450. case SpvOpGroupNonUniformQuadSwap:
  451. return true;
  452. default:
  453. return false;
  454. }
  455. }
  456. bool spvOpcodeIsScalarizable(SpvOp opcode) {
  457. switch (opcode) {
  458. case SpvOpPhi:
  459. case SpvOpCopyObject:
  460. case SpvOpConvertFToU:
  461. case SpvOpConvertFToS:
  462. case SpvOpConvertSToF:
  463. case SpvOpConvertUToF:
  464. case SpvOpUConvert:
  465. case SpvOpSConvert:
  466. case SpvOpFConvert:
  467. case SpvOpQuantizeToF16:
  468. case SpvOpVectorInsertDynamic:
  469. case SpvOpSNegate:
  470. case SpvOpFNegate:
  471. case SpvOpIAdd:
  472. case SpvOpFAdd:
  473. case SpvOpISub:
  474. case SpvOpFSub:
  475. case SpvOpIMul:
  476. case SpvOpFMul:
  477. case SpvOpUDiv:
  478. case SpvOpSDiv:
  479. case SpvOpFDiv:
  480. case SpvOpUMod:
  481. case SpvOpSRem:
  482. case SpvOpSMod:
  483. case SpvOpFRem:
  484. case SpvOpFMod:
  485. case SpvOpVectorTimesScalar:
  486. case SpvOpIAddCarry:
  487. case SpvOpISubBorrow:
  488. case SpvOpUMulExtended:
  489. case SpvOpSMulExtended:
  490. case SpvOpShiftRightLogical:
  491. case SpvOpShiftRightArithmetic:
  492. case SpvOpShiftLeftLogical:
  493. case SpvOpBitwiseOr:
  494. case SpvOpBitwiseAnd:
  495. case SpvOpNot:
  496. case SpvOpBitFieldInsert:
  497. case SpvOpBitFieldSExtract:
  498. case SpvOpBitFieldUExtract:
  499. case SpvOpBitReverse:
  500. case SpvOpBitCount:
  501. case SpvOpIsNan:
  502. case SpvOpIsInf:
  503. case SpvOpIsFinite:
  504. case SpvOpIsNormal:
  505. case SpvOpSignBitSet:
  506. case SpvOpLessOrGreater:
  507. case SpvOpOrdered:
  508. case SpvOpUnordered:
  509. case SpvOpLogicalEqual:
  510. case SpvOpLogicalNotEqual:
  511. case SpvOpLogicalOr:
  512. case SpvOpLogicalAnd:
  513. case SpvOpLogicalNot:
  514. case SpvOpSelect:
  515. case SpvOpIEqual:
  516. case SpvOpINotEqual:
  517. case SpvOpUGreaterThan:
  518. case SpvOpSGreaterThan:
  519. case SpvOpUGreaterThanEqual:
  520. case SpvOpSGreaterThanEqual:
  521. case SpvOpULessThan:
  522. case SpvOpSLessThan:
  523. case SpvOpULessThanEqual:
  524. case SpvOpSLessThanEqual:
  525. case SpvOpFOrdEqual:
  526. case SpvOpFUnordEqual:
  527. case SpvOpFOrdNotEqual:
  528. case SpvOpFUnordNotEqual:
  529. case SpvOpFOrdLessThan:
  530. case SpvOpFUnordLessThan:
  531. case SpvOpFOrdGreaterThan:
  532. case SpvOpFUnordGreaterThan:
  533. case SpvOpFOrdLessThanEqual:
  534. case SpvOpFUnordLessThanEqual:
  535. case SpvOpFOrdGreaterThanEqual:
  536. case SpvOpFUnordGreaterThanEqual:
  537. return true;
  538. default:
  539. return false;
  540. }
  541. }
  542. bool spvOpcodeIsDebug(SpvOp opcode) {
  543. switch (opcode) {
  544. case SpvOpName:
  545. case SpvOpMemberName:
  546. case SpvOpSource:
  547. case SpvOpSourceContinued:
  548. case SpvOpSourceExtension:
  549. case SpvOpString:
  550. case SpvOpLine:
  551. case SpvOpNoLine:
  552. return true;
  553. default:
  554. return false;
  555. }
  556. }