[llvm] FEAT: Added support for the extension SPV_INTEL_fpga_dsp_control (PR #131651)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 04:01:13 PDT 2025


================
@@ -1976,17 +1978,63 @@ static void handleMIFlagDecoration(MachineInstr &I, const SPIRVSubtarget &ST,
   buildOpDecorate(DstReg, I, TII, SPIRV::Decoration::FPFastMathMode, {FMFlags});
 }
 
-// Walk all functions and add decorations related to MI flags.
+static std::vector<uint32_t>
+getMetaDataValues(std::vector<llvm::MDNode *> &MetaDataList) {
+  std::vector<uint32_t> res;
+  for (auto metaDataNode : MetaDataList) {
+    if (metaDataNode->getNumOperands() > 0) {
+      if (auto *CMD = llvm::dyn_cast<llvm::ConstantAsMetadata>(
+              metaDataNode->getOperand(0))) {
+        if (auto *CI = llvm::dyn_cast<llvm::ConstantInt>(CMD->getValue())) {
+          APInt val = CI->getValue();
+          int64_t decVal = val.getZExtValue();
+          res.push_back(decVal);
+        }
+      }
+    }
+  }
+  return res;
+}
+
+static void handleFunctionDecoration(llvm::Module::const_iterator F,
+                                     const SPIRVInstrInfo &TII,
+                                     MachineModuleInfo *MMI,
+                                     const SPIRVSubtarget &ST,
+                                     MachineInstr &MI) {
+  Register Des = MI.getOperand(0).getReg();
+  MachineInstr *curr = &MI;
+  // dsp controll
+  if (llvm::MDNode *Node = F->getMetadata("prefer_dsp")) {
----------------
MrSidims wrote:

Lets not use internal to intel/llvm metadata, see discussion in https://github.com/llvm/llvm-project/pull/131593

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


More information about the llvm-commits mailing list