[llvm] [SPIR-V] Add support for inline SPIR-V types (PR #125316)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 05:07:31 PST 2025


================
@@ -314,6 +316,34 @@ void SPIRVInstPrinter::printOpDecorate(const MCInst *MI, raw_ostream &O) {
   }
 }
 
+void SPIRVInstPrinter::printUnknownType(const MCInst *MI, raw_ostream &O) {
+  const auto EnumOperand = MI->getOperand(1);
+  assert(EnumOperand.isImm() &&
+         "second operand of UNKNOWN_type must be opcode!");
+
+  const auto Enumerant = EnumOperand.getImm();
+  const auto NumOps = MI->getNumOperands();
+
+  // Encode the instruction enumerant and word count into the opcode
+  const auto OpCode = (0xFF & NumOps) << 16 | (0xFF & Enumerant);
----------------
Keenuts wrote:

unused no?

https://github.com/llvm/llvm-project/pull/125316


More information about the llvm-commits mailing list