mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-12 15:30:46 +00:00
AMDGPU: Temporarily select trap to s_endpgm
This should select to s_trap, but that requires additonal work to setup and enable the trap handler. For now emit s_endpgm so bugpoint stops getting stuck on the unsupported call to abort. Emit a warning that this will only terminate the wave and not really trap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273062 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bfa4d786a1
commit
863cff46f2
@ -200,6 +200,7 @@ SITargetLowering::SITargetLowering(TargetMachine &TM,
|
||||
|
||||
// On SI this is s_memtime and s_memrealtime on VI.
|
||||
setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Legal);
|
||||
setOperationAction(ISD::TRAP, MVT::Other, Custom);
|
||||
|
||||
setOperationAction(ISD::FMINNUM, MVT::f64, Legal);
|
||||
setOperationAction(ISD::FMAXNUM, MVT::f64, Legal);
|
||||
@ -1178,6 +1179,7 @@ SDValue SITargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
|
||||
case ISD::INTRINSIC_W_CHAIN: return LowerINTRINSIC_W_CHAIN(Op, DAG);
|
||||
case ISD::INTRINSIC_VOID: return LowerINTRINSIC_VOID(Op, DAG);
|
||||
case ISD::ADDRSPACECAST: return lowerADDRSPACECAST(Op, DAG);
|
||||
case ISD::TRAP: return lowerTRAP(Op, DAG);
|
||||
}
|
||||
return SDValue();
|
||||
}
|
||||
@ -1450,6 +1452,23 @@ SDValue SITargetLowering::LowerGlobalAddress(AMDGPUMachineFunction *MFI,
|
||||
return DAG.getNode(AMDGPUISD::PC_ADD_REL_OFFSET, DL, PtrVT, GA);
|
||||
}
|
||||
|
||||
SDValue SITargetLowering::lowerTRAP(SDValue Op,
|
||||
SelectionDAG &DAG) const {
|
||||
const MachineFunction &MF = DAG.getMachineFunction();
|
||||
DiagnosticInfoUnsupported NoTrap(*MF.getFunction(),
|
||||
"trap handler not supported",
|
||||
Op.getDebugLoc(),
|
||||
DS_Warning);
|
||||
DAG.getContext()->diagnose(NoTrap);
|
||||
|
||||
// Emit s_endpgm.
|
||||
|
||||
// FIXME: This should really be selected to s_trap, but that requires
|
||||
// setting up the trap handler for it o do anything.
|
||||
return DAG.getNode(AMDGPUISD::RET_FLAG, SDLoc(Op), MVT::Other, Op.
|
||||
getOperand(0));
|
||||
}
|
||||
|
||||
SDValue SITargetLowering::copyToM0(SelectionDAG &DAG, SDValue Chain,
|
||||
const SDLoc &DL, SDValue V) const {
|
||||
// We can't use S_MOV_B32 directly, because there is no way to specify m0 as
|
||||
|
@ -46,6 +46,7 @@ class SITargetLowering final : public AMDGPUTargetLowering {
|
||||
|
||||
SDValue getSegmentAperture(unsigned AS, SelectionDAG &DAG) const;
|
||||
SDValue lowerADDRSPACECAST(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue lowerTRAP(SDValue Op, SelectionDAG &DAG) const;
|
||||
|
||||
void adjustWritemask(MachineSDNode *&N, SelectionDAG &DAG) const;
|
||||
|
||||
|
@ -430,6 +430,7 @@ def S_ENDPGM : SOPP <0x00000001, (ins), "s_endpgm",
|
||||
let simm16 = 0;
|
||||
let isBarrier = 1;
|
||||
let hasCtrlDep = 1;
|
||||
let hasSideEffects = 1;
|
||||
}
|
||||
|
||||
let isBranch = 1 in {
|
||||
|
15
test/CodeGen/AMDGPU/trap.ll
Normal file
15
test/CodeGen/AMDGPU/trap.ll
Normal file
@ -0,0 +1,15 @@
|
||||
; RUN: llc -march=amdgcn -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=GCN %s
|
||||
|
||||
; GCN: warning: <unknown>:0:0: in function trap void (): trap handler not supported
|
||||
|
||||
declare void @llvm.trap() #0
|
||||
|
||||
; GCN-LABEL: {{^}}trap:
|
||||
; GCN: s_endpgm
|
||||
; GCN-NEXT: s_endpgm
|
||||
define void @trap() {
|
||||
call void @llvm.trap()
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind noreturn }
|
Loading…
x
Reference in New Issue
Block a user