1 //===-- SPIRVBaseInfo.cpp - Top level definitions for SPIRV ----*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file contains small standalone helper functions and enum definitions for 10 // the SPIRV target useful for the compiler back-end and the MC libraries. 11 // As such, it deliberately does not include references to LLVM core 12 // code gen types, passes, etc.. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #include "SPIRVBaseInfo.h" 17 #include "llvm/Support/ErrorHandling.h" 18 19 namespace llvm { 20 namespace SPIRV { 21 22 #define CASE(CLASS, ATTR) \ 23 case CLASS::ATTR: \ 24 return #ATTR; 25 #define CASE_SUF(CLASS, SF, ATTR) \ 26 case CLASS::SF##_##ATTR: \ 27 return #ATTR; 28 29 // Implement getEnumName(Enum e) helper functions. 30 // TODO: re-implement all the functions using TableGen. 31 StringRef getCapabilityName(Capability e) { 32 switch (e) { 33 CASE(Capability, Matrix) 34 CASE(Capability, Shader) 35 CASE(Capability, Geometry) 36 CASE(Capability, Tessellation) 37 CASE(Capability, Addresses) 38 CASE(Capability, Linkage) 39 CASE(Capability, Kernel) 40 CASE(Capability, Vector16) 41 CASE(Capability, Float16Buffer) 42 CASE(Capability, Float16) 43 CASE(Capability, Float64) 44 CASE(Capability, Int64) 45 CASE(Capability, Int64Atomics) 46 CASE(Capability, ImageBasic) 47 CASE(Capability, ImageReadWrite) 48 CASE(Capability, ImageMipmap) 49 CASE(Capability, Pipes) 50 CASE(Capability, Groups) 51 CASE(Capability, DeviceEnqueue) 52 CASE(Capability, LiteralSampler) 53 CASE(Capability, AtomicStorage) 54 CASE(Capability, Int16) 55 CASE(Capability, TessellationPointSize) 56 CASE(Capability, GeometryPointSize) 57 CASE(Capability, ImageGatherExtended) 58 CASE(Capability, StorageImageMultisample) 59 CASE(Capability, UniformBufferArrayDynamicIndexing) 60 CASE(Capability, SampledImageArrayDymnamicIndexing) 61 CASE(Capability, ClipDistance) 62 CASE(Capability, CullDistance) 63 CASE(Capability, ImageCubeArray) 64 CASE(Capability, SampleRateShading) 65 CASE(Capability, ImageRect) 66 CASE(Capability, SampledRect) 67 CASE(Capability, GenericPointer) 68 CASE(Capability, Int8) 69 CASE(Capability, InputAttachment) 70 CASE(Capability, SparseResidency) 71 CASE(Capability, MinLod) 72 CASE(Capability, Sampled1D) 73 CASE(Capability, Image1D) 74 CASE(Capability, SampledCubeArray) 75 CASE(Capability, SampledBuffer) 76 CASE(Capability, ImageBuffer) 77 CASE(Capability, ImageMSArray) 78 CASE(Capability, StorageImageExtendedFormats) 79 CASE(Capability, ImageQuery) 80 CASE(Capability, DerivativeControl) 81 CASE(Capability, InterpolationFunction) 82 CASE(Capability, TransformFeedback) 83 CASE(Capability, GeometryStreams) 84 CASE(Capability, StorageImageReadWithoutFormat) 85 CASE(Capability, StorageImageWriteWithoutFormat) 86 CASE(Capability, MultiViewport) 87 CASE(Capability, SubgroupDispatch) 88 CASE(Capability, NamedBarrier) 89 CASE(Capability, PipeStorage) 90 CASE(Capability, GroupNonUniform) 91 CASE(Capability, GroupNonUniformVote) 92 CASE(Capability, GroupNonUniformArithmetic) 93 CASE(Capability, GroupNonUniformBallot) 94 CASE(Capability, GroupNonUniformShuffle) 95 CASE(Capability, GroupNonUniformShuffleRelative) 96 CASE(Capability, GroupNonUniformClustered) 97 CASE(Capability, GroupNonUniformQuad) 98 CASE(Capability, SubgroupBallotKHR) 99 CASE(Capability, DrawParameters) 100 CASE(Capability, SubgroupVoteKHR) 101 CASE(Capability, StorageBuffer16BitAccess) 102 CASE(Capability, StorageUniform16) 103 CASE(Capability, StoragePushConstant16) 104 CASE(Capability, StorageInputOutput16) 105 CASE(Capability, DeviceGroup) 106 CASE(Capability, MultiView) 107 CASE(Capability, VariablePointersStorageBuffer) 108 CASE(Capability, VariablePointers) 109 CASE(Capability, AtomicStorageOps) 110 CASE(Capability, SampleMaskPostDepthCoverage) 111 CASE(Capability, StorageBuffer8BitAccess) 112 CASE(Capability, UniformAndStorageBuffer8BitAccess) 113 CASE(Capability, StoragePushConstant8) 114 CASE(Capability, DenormPreserve) 115 CASE(Capability, DenormFlushToZero) 116 CASE(Capability, SignedZeroInfNanPreserve) 117 CASE(Capability, RoundingModeRTE) 118 CASE(Capability, RoundingModeRTZ) 119 CASE(Capability, Float16ImageAMD) 120 CASE(Capability, ImageGatherBiasLodAMD) 121 CASE(Capability, FragmentMaskAMD) 122 CASE(Capability, StencilExportEXT) 123 CASE(Capability, ImageReadWriteLodAMD) 124 CASE(Capability, SampleMaskOverrideCoverageNV) 125 CASE(Capability, GeometryShaderPassthroughNV) 126 CASE(Capability, ShaderViewportIndexLayerEXT) 127 CASE(Capability, ShaderViewportMaskNV) 128 CASE(Capability, ShaderStereoViewNV) 129 CASE(Capability, PerViewAttributesNV) 130 CASE(Capability, FragmentFullyCoveredEXT) 131 CASE(Capability, MeshShadingNV) 132 CASE(Capability, ShaderNonUniformEXT) 133 CASE(Capability, RuntimeDescriptorArrayEXT) 134 CASE(Capability, InputAttachmentArrayDynamicIndexingEXT) 135 CASE(Capability, UniformTexelBufferArrayDynamicIndexingEXT) 136 CASE(Capability, StorageTexelBufferArrayDynamicIndexingEXT) 137 CASE(Capability, UniformBufferArrayNonUniformIndexingEXT) 138 CASE(Capability, SampledImageArrayNonUniformIndexingEXT) 139 CASE(Capability, StorageBufferArrayNonUniformIndexingEXT) 140 CASE(Capability, StorageImageArrayNonUniformIndexingEXT) 141 CASE(Capability, InputAttachmentArrayNonUniformIndexingEXT) 142 CASE(Capability, UniformTexelBufferArrayNonUniformIndexingEXT) 143 CASE(Capability, StorageTexelBufferArrayNonUniformIndexingEXT) 144 CASE(Capability, RayTracingNV) 145 CASE(Capability, SubgroupShuffleINTEL) 146 CASE(Capability, SubgroupBufferBlockIOINTEL) 147 CASE(Capability, SubgroupImageBlockIOINTEL) 148 CASE(Capability, SubgroupImageMediaBlockIOINTEL) 149 CASE(Capability, SubgroupAvcMotionEstimationINTEL) 150 CASE(Capability, SubgroupAvcMotionEstimationIntraINTEL) 151 CASE(Capability, SubgroupAvcMotionEstimationChromaINTEL) 152 CASE(Capability, GroupNonUniformPartitionedNV) 153 CASE(Capability, VulkanMemoryModelKHR) 154 CASE(Capability, VulkanMemoryModelDeviceScopeKHR) 155 CASE(Capability, ImageFootprintNV) 156 CASE(Capability, FragmentBarycentricNV) 157 CASE(Capability, ComputeDerivativeGroupQuadsNV) 158 CASE(Capability, ComputeDerivativeGroupLinearNV) 159 CASE(Capability, FragmentDensityEXT) 160 CASE(Capability, PhysicalStorageBufferAddressesEXT) 161 CASE(Capability, CooperativeMatrixNV) 162 break; 163 } 164 llvm_unreachable("Unexpected operand"); 165 } 166 167 StringRef getSourceLanguageName(SourceLanguage e) { 168 switch (e) { 169 CASE(SourceLanguage, Unknown) 170 CASE(SourceLanguage, ESSL) 171 CASE(SourceLanguage, GLSL) 172 CASE(SourceLanguage, OpenCL_C) 173 CASE(SourceLanguage, OpenCL_CPP) 174 CASE(SourceLanguage, HLSL) 175 break; 176 } 177 llvm_unreachable("Unexpected operand"); 178 } 179 180 StringRef getExecutionModelName(ExecutionModel e) { 181 switch (e) { 182 CASE(ExecutionModel, Vertex) 183 CASE(ExecutionModel, TessellationControl) 184 CASE(ExecutionModel, TessellationEvaluation) 185 CASE(ExecutionModel, Geometry) 186 CASE(ExecutionModel, Fragment) 187 CASE(ExecutionModel, GLCompute) 188 CASE(ExecutionModel, Kernel) 189 CASE(ExecutionModel, TaskNV) 190 CASE(ExecutionModel, MeshNV) 191 CASE(ExecutionModel, RayGenerationNV) 192 CASE(ExecutionModel, IntersectionNV) 193 CASE(ExecutionModel, AnyHitNV) 194 CASE(ExecutionModel, ClosestHitNV) 195 CASE(ExecutionModel, MissNV) 196 CASE(ExecutionModel, CallableNV) 197 break; 198 } 199 llvm_unreachable("Unexpected operand"); 200 } 201 202 StringRef getAddressingModelName(AddressingModel e) { 203 switch (e) { 204 CASE(AddressingModel, Logical) 205 CASE(AddressingModel, Physical32) 206 CASE(AddressingModel, Physical64) 207 CASE(AddressingModel, PhysicalStorageBuffer64EXT) 208 break; 209 } 210 llvm_unreachable("Unexpected operand"); 211 } 212 213 StringRef getMemoryModelName(MemoryModel e) { 214 switch (e) { 215 CASE(MemoryModel, Simple) 216 CASE(MemoryModel, GLSL450) 217 CASE(MemoryModel, OpenCL) 218 CASE(MemoryModel, VulkanKHR) 219 break; 220 } 221 llvm_unreachable("Unexpected operand"); 222 } 223 224 StringRef getExecutionModeName(ExecutionMode e) { 225 switch (e) { 226 CASE(ExecutionMode, Invocations) 227 CASE(ExecutionMode, SpacingEqual) 228 CASE(ExecutionMode, SpacingFractionalEven) 229 CASE(ExecutionMode, SpacingFractionalOdd) 230 CASE(ExecutionMode, VertexOrderCw) 231 CASE(ExecutionMode, VertexOrderCcw) 232 CASE(ExecutionMode, PixelCenterInteger) 233 CASE(ExecutionMode, OriginUpperLeft) 234 CASE(ExecutionMode, OriginLowerLeft) 235 CASE(ExecutionMode, EarlyFragmentTests) 236 CASE(ExecutionMode, PointMode) 237 CASE(ExecutionMode, Xfb) 238 CASE(ExecutionMode, DepthReplacing) 239 CASE(ExecutionMode, DepthGreater) 240 CASE(ExecutionMode, DepthLess) 241 CASE(ExecutionMode, DepthUnchanged) 242 CASE(ExecutionMode, LocalSize) 243 CASE(ExecutionMode, LocalSizeHint) 244 CASE(ExecutionMode, InputPoints) 245 CASE(ExecutionMode, InputLines) 246 CASE(ExecutionMode, InputLinesAdjacency) 247 CASE(ExecutionMode, Triangles) 248 CASE(ExecutionMode, InputTrianglesAdjacency) 249 CASE(ExecutionMode, Quads) 250 CASE(ExecutionMode, Isolines) 251 CASE(ExecutionMode, OutputVertices) 252 CASE(ExecutionMode, OutputPoints) 253 CASE(ExecutionMode, OutputLineStrip) 254 CASE(ExecutionMode, OutputTriangleStrip) 255 CASE(ExecutionMode, VecTypeHint) 256 CASE(ExecutionMode, ContractionOff) 257 CASE(ExecutionMode, Initializer) 258 CASE(ExecutionMode, Finalizer) 259 CASE(ExecutionMode, SubgroupSize) 260 CASE(ExecutionMode, SubgroupsPerWorkgroup) 261 CASE(ExecutionMode, SubgroupsPerWorkgroupId) 262 CASE(ExecutionMode, LocalSizeId) 263 CASE(ExecutionMode, LocalSizeHintId) 264 CASE(ExecutionMode, PostDepthCoverage) 265 CASE(ExecutionMode, DenormPreserve) 266 CASE(ExecutionMode, DenormFlushToZero) 267 CASE(ExecutionMode, SignedZeroInfNanPreserve) 268 CASE(ExecutionMode, RoundingModeRTE) 269 CASE(ExecutionMode, RoundingModeRTZ) 270 CASE(ExecutionMode, StencilRefReplacingEXT) 271 CASE(ExecutionMode, OutputLinesNV) 272 CASE(ExecutionMode, DerivativeGroupQuadsNV) 273 CASE(ExecutionMode, DerivativeGroupLinearNV) 274 CASE(ExecutionMode, OutputTrianglesNV) 275 break; 276 } 277 llvm_unreachable("Unexpected operand"); 278 } 279 280 StringRef getStorageClassName(StorageClass e) { 281 switch (e) { 282 CASE(StorageClass, UniformConstant) 283 CASE(StorageClass, Input) 284 CASE(StorageClass, Uniform) 285 CASE(StorageClass, Output) 286 CASE(StorageClass, Workgroup) 287 CASE(StorageClass, CrossWorkgroup) 288 CASE(StorageClass, Private) 289 CASE(StorageClass, Function) 290 CASE(StorageClass, Generic) 291 CASE(StorageClass, PushConstant) 292 CASE(StorageClass, AtomicCounter) 293 CASE(StorageClass, Image) 294 CASE(StorageClass, StorageBuffer) 295 CASE(StorageClass, CallableDataNV) 296 CASE(StorageClass, IncomingCallableDataNV) 297 CASE(StorageClass, RayPayloadNV) 298 CASE(StorageClass, HitAttributeNV) 299 CASE(StorageClass, IncomingRayPayloadNV) 300 CASE(StorageClass, ShaderRecordBufferNV) 301 CASE(StorageClass, PhysicalStorageBufferEXT) 302 break; 303 } 304 llvm_unreachable("Unexpected operand"); 305 } 306 307 StringRef getDimName(Dim dim) { 308 switch (dim) { 309 CASE_SUF(Dim, DIM, 1D) 310 CASE_SUF(Dim, DIM, 2D) 311 CASE_SUF(Dim, DIM, 3D) 312 CASE_SUF(Dim, DIM, Cube) 313 CASE_SUF(Dim, DIM, Rect) 314 CASE_SUF(Dim, DIM, Buffer) 315 CASE_SUF(Dim, DIM, SubpassData) 316 break; 317 } 318 llvm_unreachable("Unexpected operand"); 319 } 320 321 StringRef getSamplerAddressingModeName(SamplerAddressingMode e) { 322 switch (e) { 323 CASE(SamplerAddressingMode, None) 324 CASE(SamplerAddressingMode, ClampToEdge) 325 CASE(SamplerAddressingMode, Clamp) 326 CASE(SamplerAddressingMode, Repeat) 327 CASE(SamplerAddressingMode, RepeatMirrored) 328 break; 329 } 330 llvm_unreachable("Unexpected operand"); 331 } 332 333 StringRef getSamplerFilterModeName(SamplerFilterMode e) { 334 switch (e) { 335 CASE(SamplerFilterMode, Nearest) 336 CASE(SamplerFilterMode, Linear) 337 break; 338 } 339 llvm_unreachable("Unexpected operand"); 340 } 341 342 StringRef getImageFormatName(ImageFormat e) { 343 switch (e) { 344 CASE(ImageFormat, Unknown) 345 CASE(ImageFormat, Rgba32f) 346 CASE(ImageFormat, Rgba16f) 347 CASE(ImageFormat, R32f) 348 CASE(ImageFormat, Rgba8) 349 CASE(ImageFormat, Rgba8Snorm) 350 CASE(ImageFormat, Rg32f) 351 CASE(ImageFormat, Rg16f) 352 CASE(ImageFormat, R11fG11fB10f) 353 CASE(ImageFormat, R16f) 354 CASE(ImageFormat, Rgba16) 355 CASE(ImageFormat, Rgb10A2) 356 CASE(ImageFormat, Rg16) 357 CASE(ImageFormat, Rg8) 358 CASE(ImageFormat, R16) 359 CASE(ImageFormat, R8) 360 CASE(ImageFormat, Rgba16Snorm) 361 CASE(ImageFormat, Rg16Snorm) 362 CASE(ImageFormat, Rg8Snorm) 363 CASE(ImageFormat, R16Snorm) 364 CASE(ImageFormat, R8Snorm) 365 CASE(ImageFormat, Rgba32i) 366 CASE(ImageFormat, Rgba16i) 367 CASE(ImageFormat, Rgba8i) 368 CASE(ImageFormat, R32i) 369 CASE(ImageFormat, Rg32i) 370 CASE(ImageFormat, Rg16i) 371 CASE(ImageFormat, Rg8i) 372 CASE(ImageFormat, R16i) 373 CASE(ImageFormat, R8i) 374 CASE(ImageFormat, Rgba32ui) 375 CASE(ImageFormat, Rgba16ui) 376 CASE(ImageFormat, Rgba8ui) 377 CASE(ImageFormat, R32ui) 378 CASE(ImageFormat, Rgb10a2ui) 379 CASE(ImageFormat, Rg32ui) 380 CASE(ImageFormat, Rg16ui) 381 CASE(ImageFormat, Rg8ui) 382 CASE(ImageFormat, R16ui) 383 CASE(ImageFormat, R8ui) 384 break; 385 } 386 llvm_unreachable("Unexpected operand"); 387 } 388 389 StringRef getImageChannelOrderName(ImageChannelOrder e) { 390 switch (e) { 391 CASE(ImageChannelOrder, R) 392 CASE(ImageChannelOrder, A) 393 CASE(ImageChannelOrder, RG) 394 CASE(ImageChannelOrder, RA) 395 CASE(ImageChannelOrder, RGB) 396 CASE(ImageChannelOrder, RGBA) 397 CASE(ImageChannelOrder, BGRA) 398 CASE(ImageChannelOrder, ARGB) 399 CASE(ImageChannelOrder, Intensity) 400 CASE(ImageChannelOrder, Luminance) 401 CASE(ImageChannelOrder, Rx) 402 CASE(ImageChannelOrder, RGx) 403 CASE(ImageChannelOrder, RGBx) 404 CASE(ImageChannelOrder, Depth) 405 CASE(ImageChannelOrder, DepthStencil) 406 CASE(ImageChannelOrder, sRGB) 407 CASE(ImageChannelOrder, sRGBx) 408 CASE(ImageChannelOrder, sRGBA) 409 CASE(ImageChannelOrder, sBGRA) 410 CASE(ImageChannelOrder, ABGR) 411 break; 412 } 413 llvm_unreachable("Unexpected operand"); 414 } 415 416 StringRef getImageChannelDataTypeName(ImageChannelDataType e) { 417 switch (e) { 418 CASE(ImageChannelDataType, SnormInt8) 419 CASE(ImageChannelDataType, SnormInt16) 420 CASE(ImageChannelDataType, UnormInt8) 421 CASE(ImageChannelDataType, UnormInt16) 422 CASE(ImageChannelDataType, UnormShort565) 423 CASE(ImageChannelDataType, UnormShort555) 424 CASE(ImageChannelDataType, UnormInt101010) 425 CASE(ImageChannelDataType, SignedInt8) 426 CASE(ImageChannelDataType, SignedInt16) 427 CASE(ImageChannelDataType, SignedInt32) 428 CASE(ImageChannelDataType, UnsignedInt8) 429 CASE(ImageChannelDataType, UnsignedInt16) 430 CASE(ImageChannelDataType, UnsigendInt32) 431 CASE(ImageChannelDataType, HalfFloat) 432 CASE(ImageChannelDataType, Float) 433 CASE(ImageChannelDataType, UnormInt24) 434 CASE(ImageChannelDataType, UnormInt101010_2) 435 break; 436 } 437 llvm_unreachable("Unexpected operand"); 438 } 439 440 std::string getImageOperandName(uint32_t e) { 441 std::string nameString = ""; 442 std::string sep = ""; 443 if (e == static_cast<uint32_t>(ImageOperand::None)) 444 return "None"; 445 if (e == static_cast<uint32_t>(ImageOperand::Bias)) 446 return "Bias"; 447 if (e & static_cast<uint32_t>(ImageOperand::Bias)) { 448 nameString += sep + "Bias"; 449 sep = "|"; 450 } 451 if (e == static_cast<uint32_t>(ImageOperand::Lod)) 452 return "Lod"; 453 if (e & static_cast<uint32_t>(ImageOperand::Lod)) { 454 nameString += sep + "Lod"; 455 sep = "|"; 456 } 457 if (e == static_cast<uint32_t>(ImageOperand::Grad)) 458 return "Grad"; 459 if (e & static_cast<uint32_t>(ImageOperand::Grad)) { 460 nameString += sep + "Grad"; 461 sep = "|"; 462 } 463 if (e == static_cast<uint32_t>(ImageOperand::ConstOffset)) 464 return "ConstOffset"; 465 if (e & static_cast<uint32_t>(ImageOperand::ConstOffset)) { 466 nameString += sep + "ConstOffset"; 467 sep = "|"; 468 } 469 if (e == static_cast<uint32_t>(ImageOperand::Offset)) 470 return "Offset"; 471 if (e & static_cast<uint32_t>(ImageOperand::Offset)) { 472 nameString += sep + "Offset"; 473 sep = "|"; 474 } 475 if (e == static_cast<uint32_t>(ImageOperand::ConstOffsets)) 476 return "ConstOffsets"; 477 if (e & static_cast<uint32_t>(ImageOperand::ConstOffsets)) { 478 nameString += sep + "ConstOffsets"; 479 sep = "|"; 480 } 481 if (e == static_cast<uint32_t>(ImageOperand::Sample)) 482 return "Sample"; 483 if (e & static_cast<uint32_t>(ImageOperand::Sample)) { 484 nameString += sep + "Sample"; 485 sep = "|"; 486 } 487 if (e == static_cast<uint32_t>(ImageOperand::MinLod)) 488 return "MinLod"; 489 if (e & static_cast<uint32_t>(ImageOperand::MinLod)) { 490 nameString += sep + "MinLod"; 491 sep = "|"; 492 } 493 if (e == static_cast<uint32_t>(ImageOperand::MakeTexelAvailableKHR)) 494 return "MakeTexelAvailableKHR"; 495 if (e & static_cast<uint32_t>(ImageOperand::MakeTexelAvailableKHR)) { 496 nameString += sep + "MakeTexelAvailableKHR"; 497 sep = "|"; 498 } 499 if (e == static_cast<uint32_t>(ImageOperand::MakeTexelVisibleKHR)) 500 return "MakeTexelVisibleKHR"; 501 if (e & static_cast<uint32_t>(ImageOperand::MakeTexelVisibleKHR)) { 502 nameString += sep + "MakeTexelVisibleKHR"; 503 sep = "|"; 504 } 505 if (e == static_cast<uint32_t>(ImageOperand::NonPrivateTexelKHR)) 506 return "NonPrivateTexelKHR"; 507 if (e & static_cast<uint32_t>(ImageOperand::NonPrivateTexelKHR)) { 508 nameString += sep + "NonPrivateTexelKHR"; 509 sep = "|"; 510 } 511 if (e == static_cast<uint32_t>(ImageOperand::VolatileTexelKHR)) 512 return "VolatileTexelKHR"; 513 if (e & static_cast<uint32_t>(ImageOperand::VolatileTexelKHR)) { 514 nameString += sep + "VolatileTexelKHR"; 515 sep = "|"; 516 } 517 if (e == static_cast<uint32_t>(ImageOperand::SignExtend)) 518 return "SignExtend"; 519 if (e & static_cast<uint32_t>(ImageOperand::SignExtend)) { 520 nameString += sep + "SignExtend"; 521 sep = "|"; 522 } 523 if (e == static_cast<uint32_t>(ImageOperand::ZeroExtend)) 524 return "ZeroExtend"; 525 if (e & static_cast<uint32_t>(ImageOperand::ZeroExtend)) { 526 nameString += sep + "ZeroExtend"; 527 sep = "|"; 528 }; 529 return nameString; 530 } 531 532 std::string getFPFastMathModeName(uint32_t e) { 533 std::string nameString = ""; 534 std::string sep = ""; 535 if (e == static_cast<uint32_t>(FPFastMathMode::None)) 536 return "None"; 537 if (e == static_cast<uint32_t>(FPFastMathMode::NotNaN)) 538 return "NotNaN"; 539 if (e & static_cast<uint32_t>(FPFastMathMode::NotNaN)) { 540 nameString += sep + "NotNaN"; 541 sep = "|"; 542 } 543 if (e == static_cast<uint32_t>(FPFastMathMode::NotInf)) 544 return "NotInf"; 545 if (e & static_cast<uint32_t>(FPFastMathMode::NotInf)) { 546 nameString += sep + "NotInf"; 547 sep = "|"; 548 } 549 if (e == static_cast<uint32_t>(FPFastMathMode::NSZ)) 550 return "NSZ"; 551 if (e & static_cast<uint32_t>(FPFastMathMode::NSZ)) { 552 nameString += sep + "NSZ"; 553 sep = "|"; 554 } 555 if (e == static_cast<uint32_t>(FPFastMathMode::AllowRecip)) 556 return "AllowRecip"; 557 if (e & static_cast<uint32_t>(FPFastMathMode::AllowRecip)) { 558 nameString += sep + "AllowRecip"; 559 sep = "|"; 560 } 561 if (e == static_cast<uint32_t>(FPFastMathMode::Fast)) 562 return "Fast"; 563 if (e & static_cast<uint32_t>(FPFastMathMode::Fast)) { 564 nameString += sep + "Fast"; 565 sep = "|"; 566 }; 567 return nameString; 568 } 569 570 StringRef getFPRoundingModeName(FPRoundingMode e) { 571 switch (e) { 572 CASE(FPRoundingMode, RTE) 573 CASE(FPRoundingMode, RTZ) 574 CASE(FPRoundingMode, RTP) 575 CASE(FPRoundingMode, RTN) 576 break; 577 } 578 llvm_unreachable("Unexpected operand"); 579 } 580 581 StringRef getLinkageTypeName(LinkageType e) { 582 switch (e) { 583 CASE(LinkageType, Export) 584 CASE(LinkageType, Import) 585 break; 586 } 587 llvm_unreachable("Unexpected operand"); 588 } 589 590 StringRef getAccessQualifierName(AccessQualifier e) { 591 switch (e) { 592 CASE(AccessQualifier, ReadOnly) 593 CASE(AccessQualifier, WriteOnly) 594 CASE(AccessQualifier, ReadWrite) 595 break; 596 } 597 llvm_unreachable("Unexpected operand"); 598 } 599 600 StringRef getFunctionParameterAttributeName(FunctionParameterAttribute e) { 601 switch (e) { 602 CASE(FunctionParameterAttribute, Zext) 603 CASE(FunctionParameterAttribute, Sext) 604 CASE(FunctionParameterAttribute, ByVal) 605 CASE(FunctionParameterAttribute, Sret) 606 CASE(FunctionParameterAttribute, NoAlias) 607 CASE(FunctionParameterAttribute, NoCapture) 608 CASE(FunctionParameterAttribute, NoWrite) 609 CASE(FunctionParameterAttribute, NoReadWrite) 610 break; 611 } 612 llvm_unreachable("Unexpected operand"); 613 } 614 615 StringRef getDecorationName(Decoration e) { 616 switch (e) { 617 CASE(Decoration, RelaxedPrecision) 618 CASE(Decoration, SpecId) 619 CASE(Decoration, Block) 620 CASE(Decoration, BufferBlock) 621 CASE(Decoration, RowMajor) 622 CASE(Decoration, ColMajor) 623 CASE(Decoration, ArrayStride) 624 CASE(Decoration, MatrixStride) 625 CASE(Decoration, GLSLShared) 626 CASE(Decoration, GLSLPacked) 627 CASE(Decoration, CPacked) 628 CASE(Decoration, BuiltIn) 629 CASE(Decoration, NoPerspective) 630 CASE(Decoration, Flat) 631 CASE(Decoration, Patch) 632 CASE(Decoration, Centroid) 633 CASE(Decoration, Sample) 634 CASE(Decoration, Invariant) 635 CASE(Decoration, Restrict) 636 CASE(Decoration, Aliased) 637 CASE(Decoration, Volatile) 638 CASE(Decoration, Constant) 639 CASE(Decoration, Coherent) 640 CASE(Decoration, NonWritable) 641 CASE(Decoration, NonReadable) 642 CASE(Decoration, Uniform) 643 CASE(Decoration, UniformId) 644 CASE(Decoration, SaturatedConversion) 645 CASE(Decoration, Stream) 646 CASE(Decoration, Location) 647 CASE(Decoration, Component) 648 CASE(Decoration, Index) 649 CASE(Decoration, Binding) 650 CASE(Decoration, DescriptorSet) 651 CASE(Decoration, Offset) 652 CASE(Decoration, XfbBuffer) 653 CASE(Decoration, XfbStride) 654 CASE(Decoration, FuncParamAttr) 655 CASE(Decoration, FPRoundingMode) 656 CASE(Decoration, FPFastMathMode) 657 CASE(Decoration, LinkageAttributes) 658 CASE(Decoration, NoContraction) 659 CASE(Decoration, InputAttachmentIndex) 660 CASE(Decoration, Alignment) 661 CASE(Decoration, MaxByteOffset) 662 CASE(Decoration, AlignmentId) 663 CASE(Decoration, MaxByteOffsetId) 664 CASE(Decoration, NoSignedWrap) 665 CASE(Decoration, NoUnsignedWrap) 666 CASE(Decoration, ExplicitInterpAMD) 667 CASE(Decoration, OverrideCoverageNV) 668 CASE(Decoration, PassthroughNV) 669 CASE(Decoration, ViewportRelativeNV) 670 CASE(Decoration, SecondaryViewportRelativeNV) 671 CASE(Decoration, PerPrimitiveNV) 672 CASE(Decoration, PerViewNV) 673 CASE(Decoration, PerVertexNV) 674 CASE(Decoration, NonUniformEXT) 675 CASE(Decoration, CountBuffer) 676 CASE(Decoration, UserSemantic) 677 CASE(Decoration, RestrictPointerEXT) 678 CASE(Decoration, AliasedPointerEXT) 679 break; 680 } 681 llvm_unreachable("Unexpected operand"); 682 } 683 684 StringRef getBuiltInName(BuiltIn e) { 685 switch (e) { 686 CASE(BuiltIn, Position) 687 CASE(BuiltIn, PointSize) 688 CASE(BuiltIn, ClipDistance) 689 CASE(BuiltIn, CullDistance) 690 CASE(BuiltIn, VertexId) 691 CASE(BuiltIn, InstanceId) 692 CASE(BuiltIn, PrimitiveId) 693 CASE(BuiltIn, InvocationId) 694 CASE(BuiltIn, Layer) 695 CASE(BuiltIn, ViewportIndex) 696 CASE(BuiltIn, TessLevelOuter) 697 CASE(BuiltIn, TessLevelInner) 698 CASE(BuiltIn, TessCoord) 699 CASE(BuiltIn, PatchVertices) 700 CASE(BuiltIn, FragCoord) 701 CASE(BuiltIn, PointCoord) 702 CASE(BuiltIn, FrontFacing) 703 CASE(BuiltIn, SampleId) 704 CASE(BuiltIn, SamplePosition) 705 CASE(BuiltIn, SampleMask) 706 CASE(BuiltIn, FragDepth) 707 CASE(BuiltIn, HelperInvocation) 708 CASE(BuiltIn, NumWorkgroups) 709 CASE(BuiltIn, WorkgroupSize) 710 CASE(BuiltIn, WorkgroupId) 711 CASE(BuiltIn, LocalInvocationId) 712 CASE(BuiltIn, GlobalInvocationId) 713 CASE(BuiltIn, LocalInvocationIndex) 714 CASE(BuiltIn, WorkDim) 715 CASE(BuiltIn, GlobalSize) 716 CASE(BuiltIn, EnqueuedWorkgroupSize) 717 CASE(BuiltIn, GlobalOffset) 718 CASE(BuiltIn, GlobalLinearId) 719 CASE(BuiltIn, SubgroupSize) 720 CASE(BuiltIn, SubgroupMaxSize) 721 CASE(BuiltIn, NumSubgroups) 722 CASE(BuiltIn, NumEnqueuedSubgroups) 723 CASE(BuiltIn, SubgroupId) 724 CASE(BuiltIn, SubgroupLocalInvocationId) 725 CASE(BuiltIn, VertexIndex) 726 CASE(BuiltIn, InstanceIndex) 727 CASE(BuiltIn, SubgroupEqMask) 728 CASE(BuiltIn, SubgroupGeMask) 729 CASE(BuiltIn, SubgroupGtMask) 730 CASE(BuiltIn, SubgroupLeMask) 731 CASE(BuiltIn, SubgroupLtMask) 732 CASE(BuiltIn, BaseVertex) 733 CASE(BuiltIn, BaseInstance) 734 CASE(BuiltIn, DrawIndex) 735 CASE(BuiltIn, DeviceIndex) 736 CASE(BuiltIn, ViewIndex) 737 CASE(BuiltIn, BaryCoordNoPerspAMD) 738 CASE(BuiltIn, BaryCoordNoPerspCentroidAMD) 739 CASE(BuiltIn, BaryCoordNoPerspSampleAMD) 740 CASE(BuiltIn, BaryCoordSmoothAMD) 741 CASE(BuiltIn, BaryCoordSmoothCentroid) 742 CASE(BuiltIn, BaryCoordSmoothSample) 743 CASE(BuiltIn, BaryCoordPullModel) 744 CASE(BuiltIn, FragStencilRefEXT) 745 CASE(BuiltIn, ViewportMaskNV) 746 CASE(BuiltIn, SecondaryPositionNV) 747 CASE(BuiltIn, SecondaryViewportMaskNV) 748 CASE(BuiltIn, PositionPerViewNV) 749 CASE(BuiltIn, ViewportMaskPerViewNV) 750 CASE(BuiltIn, FullyCoveredEXT) 751 CASE(BuiltIn, TaskCountNV) 752 CASE(BuiltIn, PrimitiveCountNV) 753 CASE(BuiltIn, PrimitiveIndicesNV) 754 CASE(BuiltIn, ClipDistancePerViewNV) 755 CASE(BuiltIn, CullDistancePerViewNV) 756 CASE(BuiltIn, LayerPerViewNV) 757 CASE(BuiltIn, MeshViewCountNV) 758 CASE(BuiltIn, MeshViewIndices) 759 CASE(BuiltIn, BaryCoordNV) 760 CASE(BuiltIn, BaryCoordNoPerspNV) 761 CASE(BuiltIn, FragSizeEXT) 762 CASE(BuiltIn, FragInvocationCountEXT) 763 CASE(BuiltIn, LaunchIdNV) 764 CASE(BuiltIn, LaunchSizeNV) 765 CASE(BuiltIn, WorldRayOriginNV) 766 CASE(BuiltIn, WorldRayDirectionNV) 767 CASE(BuiltIn, ObjectRayOriginNV) 768 CASE(BuiltIn, ObjectRayDirectionNV) 769 CASE(BuiltIn, RayTminNV) 770 CASE(BuiltIn, RayTmaxNV) 771 CASE(BuiltIn, InstanceCustomIndexNV) 772 CASE(BuiltIn, ObjectToWorldNV) 773 CASE(BuiltIn, WorldToObjectNV) 774 CASE(BuiltIn, HitTNV) 775 CASE(BuiltIn, HitKindNV) 776 CASE(BuiltIn, IncomingRayFlagsNV) 777 break; 778 } 779 llvm_unreachable("Unexpected operand"); 780 } 781 782 std::string getSelectionControlName(uint32_t e) { 783 std::string nameString = ""; 784 std::string sep = ""; 785 if (e == static_cast<uint32_t>(SelectionControl::None)) 786 return "None"; 787 if (e == static_cast<uint32_t>(SelectionControl::Flatten)) 788 return "Flatten"; 789 if (e & static_cast<uint32_t>(SelectionControl::Flatten)) { 790 nameString += sep + "Flatten"; 791 sep = "|"; 792 } 793 if (e == static_cast<uint32_t>(SelectionControl::DontFlatten)) 794 return "DontFlatten"; 795 if (e & static_cast<uint32_t>(SelectionControl::DontFlatten)) { 796 nameString += sep + "DontFlatten"; 797 sep = "|"; 798 }; 799 return nameString; 800 } 801 802 std::string getLoopControlName(uint32_t e) { 803 std::string nameString = ""; 804 std::string sep = ""; 805 if (e == static_cast<uint32_t>(LoopControl::None)) 806 return "None"; 807 if (e == static_cast<uint32_t>(LoopControl::Unroll)) 808 return "Unroll"; 809 if (e & static_cast<uint32_t>(LoopControl::Unroll)) { 810 nameString += sep + "Unroll"; 811 sep = "|"; 812 } 813 if (e == static_cast<uint32_t>(LoopControl::DontUnroll)) 814 return "DontUnroll"; 815 if (e & static_cast<uint32_t>(LoopControl::DontUnroll)) { 816 nameString += sep + "DontUnroll"; 817 sep = "|"; 818 } 819 if (e == static_cast<uint32_t>(LoopControl::DependencyInfinite)) 820 return "DependencyInfinite"; 821 if (e & static_cast<uint32_t>(LoopControl::DependencyInfinite)) { 822 nameString += sep + "DependencyInfinite"; 823 sep = "|"; 824 } 825 if (e == static_cast<uint32_t>(LoopControl::DependencyLength)) 826 return "DependencyLength"; 827 if (e & static_cast<uint32_t>(LoopControl::DependencyLength)) { 828 nameString += sep + "DependencyLength"; 829 sep = "|"; 830 } 831 if (e == static_cast<uint32_t>(LoopControl::MinIterations)) 832 return "MinIterations"; 833 if (e & static_cast<uint32_t>(LoopControl::MinIterations)) { 834 nameString += sep + "MinIterations"; 835 sep = "|"; 836 } 837 if (e == static_cast<uint32_t>(LoopControl::MaxIterations)) 838 return "MaxIterations"; 839 if (e & static_cast<uint32_t>(LoopControl::MaxIterations)) { 840 nameString += sep + "MaxIterations"; 841 sep = "|"; 842 } 843 if (e == static_cast<uint32_t>(LoopControl::IterationMultiple)) 844 return "IterationMultiple"; 845 if (e & static_cast<uint32_t>(LoopControl::IterationMultiple)) { 846 nameString += sep + "IterationMultiple"; 847 sep = "|"; 848 } 849 if (e == static_cast<uint32_t>(LoopControl::PeelCount)) 850 return "PeelCount"; 851 if (e & static_cast<uint32_t>(LoopControl::PeelCount)) { 852 nameString += sep + "PeelCount"; 853 sep = "|"; 854 } 855 if (e == static_cast<uint32_t>(LoopControl::PartialCount)) 856 return "PartialCount"; 857 if (e & static_cast<uint32_t>(LoopControl::PartialCount)) { 858 nameString += sep + "PartialCount"; 859 sep = "|"; 860 }; 861 return nameString; 862 } 863 864 std::string getFunctionControlName(uint32_t e) { 865 std::string nameString = ""; 866 std::string sep = ""; 867 if (e == static_cast<uint32_t>(FunctionControl::None)) 868 return "None"; 869 if (e == static_cast<uint32_t>(FunctionControl::Inline)) 870 return "Inline"; 871 if (e & static_cast<uint32_t>(FunctionControl::Inline)) { 872 nameString += sep + "Inline"; 873 sep = "|"; 874 } 875 if (e == static_cast<uint32_t>(FunctionControl::DontInline)) 876 return "DontInline"; 877 if (e & static_cast<uint32_t>(FunctionControl::DontInline)) { 878 nameString += sep + "DontInline"; 879 sep = "|"; 880 } 881 if (e == static_cast<uint32_t>(FunctionControl::Pure)) 882 return "Pure"; 883 if (e & static_cast<uint32_t>(FunctionControl::Pure)) { 884 nameString += sep + "Pure"; 885 sep = "|"; 886 } 887 if (e == static_cast<uint32_t>(FunctionControl::Const)) 888 return "Const"; 889 if (e & static_cast<uint32_t>(FunctionControl::Const)) { 890 nameString += sep + "Const"; 891 sep = "|"; 892 }; 893 return nameString; 894 } 895 896 std::string getMemorySemanticsName(uint32_t e) { 897 std::string nameString = ""; 898 std::string sep = ""; 899 if (e == static_cast<uint32_t>(MemorySemantics::None)) 900 return "None"; 901 if (e == static_cast<uint32_t>(MemorySemantics::Acquire)) 902 return "Acquire"; 903 if (e & static_cast<uint32_t>(MemorySemantics::Acquire)) { 904 nameString += sep + "Acquire"; 905 sep = "|"; 906 } 907 if (e == static_cast<uint32_t>(MemorySemantics::Release)) 908 return "Release"; 909 if (e & static_cast<uint32_t>(MemorySemantics::Release)) { 910 nameString += sep + "Release"; 911 sep = "|"; 912 } 913 if (e == static_cast<uint32_t>(MemorySemantics::AcquireRelease)) 914 return "AcquireRelease"; 915 if (e & static_cast<uint32_t>(MemorySemantics::AcquireRelease)) { 916 nameString += sep + "AcquireRelease"; 917 sep = "|"; 918 } 919 if (e == static_cast<uint32_t>(MemorySemantics::SequentiallyConsistent)) 920 return "SequentiallyConsistent"; 921 if (e & static_cast<uint32_t>(MemorySemantics::SequentiallyConsistent)) { 922 nameString += sep + "SequentiallyConsistent"; 923 sep = "|"; 924 } 925 if (e == static_cast<uint32_t>(MemorySemantics::UniformMemory)) 926 return "UniformMemory"; 927 if (e & static_cast<uint32_t>(MemorySemantics::UniformMemory)) { 928 nameString += sep + "UniformMemory"; 929 sep = "|"; 930 } 931 if (e == static_cast<uint32_t>(MemorySemantics::SubgroupMemory)) 932 return "SubgroupMemory"; 933 if (e & static_cast<uint32_t>(MemorySemantics::SubgroupMemory)) { 934 nameString += sep + "SubgroupMemory"; 935 sep = "|"; 936 } 937 if (e == static_cast<uint32_t>(MemorySemantics::WorkgroupMemory)) 938 return "WorkgroupMemory"; 939 if (e & static_cast<uint32_t>(MemorySemantics::WorkgroupMemory)) { 940 nameString += sep + "WorkgroupMemory"; 941 sep = "|"; 942 } 943 if (e == static_cast<uint32_t>(MemorySemantics::CrossWorkgroupMemory)) 944 return "CrossWorkgroupMemory"; 945 if (e & static_cast<uint32_t>(MemorySemantics::CrossWorkgroupMemory)) { 946 nameString += sep + "CrossWorkgroupMemory"; 947 sep = "|"; 948 } 949 if (e == static_cast<uint32_t>(MemorySemantics::AtomicCounterMemory)) 950 return "AtomicCounterMemory"; 951 if (e & static_cast<uint32_t>(MemorySemantics::AtomicCounterMemory)) { 952 nameString += sep + "AtomicCounterMemory"; 953 sep = "|"; 954 } 955 if (e == static_cast<uint32_t>(MemorySemantics::ImageMemory)) 956 return "ImageMemory"; 957 if (e & static_cast<uint32_t>(MemorySemantics::ImageMemory)) { 958 nameString += sep + "ImageMemory"; 959 sep = "|"; 960 } 961 if (e == static_cast<uint32_t>(MemorySemantics::OutputMemoryKHR)) 962 return "OutputMemoryKHR"; 963 if (e & static_cast<uint32_t>(MemorySemantics::OutputMemoryKHR)) { 964 nameString += sep + "OutputMemoryKHR"; 965 sep = "|"; 966 } 967 if (e == static_cast<uint32_t>(MemorySemantics::MakeAvailableKHR)) 968 return "MakeAvailableKHR"; 969 if (e & static_cast<uint32_t>(MemorySemantics::MakeAvailableKHR)) { 970 nameString += sep + "MakeAvailableKHR"; 971 sep = "|"; 972 } 973 if (e == static_cast<uint32_t>(MemorySemantics::MakeVisibleKHR)) 974 return "MakeVisibleKHR"; 975 if (e & static_cast<uint32_t>(MemorySemantics::MakeVisibleKHR)) { 976 nameString += sep + "MakeVisibleKHR"; 977 sep = "|"; 978 }; 979 return nameString; 980 } 981 982 std::string getMemoryOperandName(uint32_t e) { 983 std::string nameString = ""; 984 std::string sep = ""; 985 if (e == static_cast<uint32_t>(MemoryOperand::None)) 986 return "None"; 987 if (e == static_cast<uint32_t>(MemoryOperand::Volatile)) 988 return "Volatile"; 989 if (e & static_cast<uint32_t>(MemoryOperand::Volatile)) { 990 nameString += sep + "Volatile"; 991 sep = "|"; 992 } 993 if (e == static_cast<uint32_t>(MemoryOperand::Aligned)) 994 return "Aligned"; 995 if (e & static_cast<uint32_t>(MemoryOperand::Aligned)) { 996 nameString += sep + "Aligned"; 997 sep = "|"; 998 } 999 if (e == static_cast<uint32_t>(MemoryOperand::Nontemporal)) 1000 return "Nontemporal"; 1001 if (e & static_cast<uint32_t>(MemoryOperand::Nontemporal)) { 1002 nameString += sep + "Nontemporal"; 1003 sep = "|"; 1004 } 1005 if (e == static_cast<uint32_t>(MemoryOperand::MakePointerAvailableKHR)) 1006 return "MakePointerAvailableKHR"; 1007 if (e & static_cast<uint32_t>(MemoryOperand::MakePointerAvailableKHR)) { 1008 nameString += sep + "MakePointerAvailableKHR"; 1009 sep = "|"; 1010 } 1011 if (e == static_cast<uint32_t>(MemoryOperand::MakePointerVisibleKHR)) 1012 return "MakePointerVisibleKHR"; 1013 if (e & static_cast<uint32_t>(MemoryOperand::MakePointerVisibleKHR)) { 1014 nameString += sep + "MakePointerVisibleKHR"; 1015 sep = "|"; 1016 } 1017 if (e == static_cast<uint32_t>(MemoryOperand::NonPrivatePointerKHR)) 1018 return "NonPrivatePointerKHR"; 1019 if (e & static_cast<uint32_t>(MemoryOperand::NonPrivatePointerKHR)) { 1020 nameString += sep + "NonPrivatePointerKHR"; 1021 sep = "|"; 1022 }; 1023 return nameString; 1024 } 1025 1026 StringRef getScopeName(Scope e) { 1027 switch (e) { 1028 CASE(Scope, CrossDevice) 1029 CASE(Scope, Device) 1030 CASE(Scope, Workgroup) 1031 CASE(Scope, Subgroup) 1032 CASE(Scope, Invocation) 1033 CASE(Scope, QueueFamilyKHR) 1034 break; 1035 } 1036 llvm_unreachable("Unexpected operand"); 1037 } 1038 1039 StringRef getGroupOperationName(GroupOperation e) { 1040 switch (e) { 1041 CASE(GroupOperation, Reduce) 1042 CASE(GroupOperation, InclusiveScan) 1043 CASE(GroupOperation, ExclusiveScan) 1044 CASE(GroupOperation, ClusteredReduce) 1045 CASE(GroupOperation, PartitionedReduceNV) 1046 CASE(GroupOperation, PartitionedInclusiveScanNV) 1047 CASE(GroupOperation, PartitionedExclusiveScanNV) 1048 break; 1049 } 1050 llvm_unreachable("Unexpected operand"); 1051 } 1052 1053 StringRef getKernelEnqueueFlagsName(KernelEnqueueFlags e) { 1054 switch (e) { 1055 CASE(KernelEnqueueFlags, NoWait) 1056 CASE(KernelEnqueueFlags, WaitKernel) 1057 CASE(KernelEnqueueFlags, WaitWorkGroup) 1058 break; 1059 } 1060 llvm_unreachable("Unexpected operand"); 1061 } 1062 1063 StringRef getKernelProfilingInfoName(KernelProfilingInfo e) { 1064 switch (e) { 1065 CASE(KernelProfilingInfo, None) 1066 CASE(KernelProfilingInfo, CmdExecTime) 1067 break; 1068 } 1069 llvm_unreachable("Unexpected operand"); 1070 } 1071 1072 std::string getExtInstSetName(InstructionSet e) { 1073 switch (e) { 1074 CASE(InstructionSet, OpenCL_std) 1075 CASE(InstructionSet, GLSL_std_450) 1076 CASE(InstructionSet, SPV_AMD_shader_trinary_minmax) 1077 break; 1078 } 1079 llvm_unreachable("Unexpected operand"); 1080 } 1081 } // namespace SPIRV 1082 } // namespace llvm 1083