Skip to content

Commit 8315cbc

Browse files
Romaric JODINJordi Chauzi
Romaric JODIN
authored and
Jordi Chauzi
committed
dpu: llvm: ISD::ADDRSPACECAST is not supported by the backend
print a diagnostic error if such a node is lowered. Ref #1
1 parent 544c2a7 commit 8315cbc

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

llvm/lib/Target/DPU/DPUTargetLowering.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ DPUTargetLowering::DPUTargetLowering(const TargetMachine &TM, DPUSubtarget &STI)
241241
setOperationAction(ISD::VAEND, MVT::Other, Expand);
242242
setOperationAction(ISD::VACOPY, MVT::Other, Expand);
243243

244+
setOperationAction(ISD::ADDRSPACECAST, MVT::i32, Custom);
245+
244246
for (MVT VT : MVT::integer_valuetypes()) {
245247
setLoadExtAction(ISD::EXTLOAD, VT, MVT::i1, Promote);
246248
setLoadExtAction(ISD::ZEXTLOAD, VT, MVT::i1, Promote);
@@ -260,6 +262,9 @@ SDValue DPUTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
260262
dbgs() << "\n";
261263
});
262264
switch (Op.getOpcode()) {
265+
case ISD::ADDRSPACECAST:
266+
return LowerAddrSpaceCast(Op, DAG);
267+
263268
case ISD::MUL:
264269
return LowerMultiplication(Op, DAG);
265270

@@ -592,6 +597,16 @@ const char *DPUTargetLowering::getTargetNodeName(unsigned Opcode) const {
592597
}
593598
}
594599

600+
SDValue DPUTargetLowering::LowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) const {
601+
const Function & Func = DAG.getMachineFunction().getFunction();
602+
DiagnosticInfoUnsupported Diag(Func,
603+
"Cast between addresses of different address space is not supported",
604+
Op.getDebugLoc());
605+
Func.getContext().diagnose(Diag);
606+
report_fatal_error("Cast between addresses of different address space is not supported", false);
607+
return Op;
608+
}
609+
595610
SDValue DPUTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) const {
596611
SDLoc DL(Op);
597612
SDValue Chain = Op.getOperand(0);

llvm/lib/Target/DPU/DPUTargetLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class DPUTargetLowering : public TargetLowering {
107107
SDValue LowerIntrinsic(SDValue Op, SelectionDAG &DAG,
108108
int IntrinsicType) const;
109109

110+
SDValue LowerAddrSpaceCast(SDValue Op, SelectionDAG &DAG) const;
111+
110112
// Analysis and mute for 64 bits emulation.
111113
// Shifts: third parameter stands for Left (0), Right (1) or Arithmetic (2)
112114
SDValue LowerShift(SDValue Op, SelectionDAG &DAG, int LRA) const;

0 commit comments

Comments
 (0)