[llvm] [clang] [X86] Add "Ws" constraint and "p" modifier for symbolic address/label reference (PR #77886)

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 00:38:30 PST 2024


================
@@ -56966,6 +56965,17 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
     }
     return;
   }
+  case 'W': {
+    assert(Constraint[1] == 's');
+    if (const auto *GA = dyn_cast<GlobalAddressSDNode>(Op)) {
+      Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(), SDLoc(Op),
+                                               GA->getValueType(0)));
+    } else if (const auto *BA = dyn_cast<BlockAddressSDNode>(Op)) {
+      Ops.push_back(DAG.getTargetBlockAddress(BA->getBlockAddress(),
+                                              BA->getValueType(0)));
+    }
----------------
phoebewang wrote:

Don't need parentheses here.

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


More information about the cfe-commits mailing list