[clang] [llvm] BPF address space insn (PR #84410)

Yingchi Long via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 00:26:21 PST 2024


================
@@ -638,6 +643,31 @@ SDValue BPFTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
   return DAG.getMergeValues(Ops, SDLoc());
 }
 
+SDValue BPFTargetLowering::LowerADDRSPACECAST(SDValue Op,
+                                              SelectionDAG &DAG) const {
+  auto *ACast = dyn_cast<AddrSpaceCastSDNode>(Op);
+  const SDValue &Ptr = ACast->getOperand(0);
+  unsigned SrcAS = ACast->getSrcAddressSpace();
+  unsigned DstAS = ACast->getDestAddressSpace();
+  SDLoc DL(Op);
+
+  if (SrcAS > 0 && DstAS > 0) {
+    SmallString<64> Msg;
+    raw_svector_ostream OS(Msg);
+    OS << "Can't cast address space " << SrcAS << " to " << DstAS
+       << ": either source or destination address space has to be zero";
+    fail(DL, DAG, Msg);
----------------
inclyc wrote:

Our `fail` method is used for `DiagnosticInfoUnsupported` diagnostic, should we create a new diagnostic kind?

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


More information about the cfe-commits mailing list