[llvm] [SPIR-V] Add support for inline SPIR-V types (PR #125316)
    Cassandra Beckley via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Mar  5 16:10:28 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);
----------------
cassiebeckley wrote:
Correct, thanks for catching that.
https://github.com/llvm/llvm-project/pull/125316
    
    
More information about the llvm-commits
mailing list