@@ -172,8 +172,9 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel {
172
172
173
173
MachineSDNode *buildSMovImm64 (SDLoc &DL, uint64_t Val, EVT VT) const ;
174
174
175
- SDNode *glueCopyToM0LDSInit (SDNode *N) const ;
175
+ SDNode *glueCopyToOp (SDNode *N, SDValue NewChain, SDValue Glue ) const ;
176
176
SDNode *glueCopyToM0 (SDNode *N, SDValue Val) const ;
177
+ SDNode *glueCopyToM0LDSInit (SDNode *N) const ;
177
178
178
179
const TargetRegisterClass *getOperandRegClass (SDNode *N, unsigned OpNo) const ;
179
180
virtual bool SelectADDRVTX_READ (SDValue Addr, SDValue &Base, SDValue &Offset);
@@ -585,26 +586,27 @@ const TargetRegisterClass *AMDGPUDAGToDAGISel::getOperandRegClass(SDNode *N,
585
586
}
586
587
}
587
588
588
- SDNode *AMDGPUDAGToDAGISel::glueCopyToM0 (SDNode *N, SDValue Val) const {
589
- const SITargetLowering& Lowering =
590
- *static_cast <const SITargetLowering*>(getTargetLowering ());
591
-
592
- assert (N->getOperand (0 ).getValueType () == MVT::Other && " Expected chain" );
593
-
594
- SDValue M0 = Lowering.copyToM0 (*CurDAG, N->getOperand (0 ), SDLoc (N),
595
- Val);
596
-
597
- SDValue Glue = M0.getValue (1 );
598
-
589
+ SDNode *AMDGPUDAGToDAGISel::glueCopyToOp (SDNode *N, SDValue NewChain,
590
+ SDValue Glue) const {
599
591
SmallVector <SDValue, 8 > Ops;
600
- Ops.push_back (M0 ); // Replace the chain.
592
+ Ops.push_back (NewChain ); // Replace the chain.
601
593
for (unsigned i = 1 , e = N->getNumOperands (); i != e; ++i)
602
594
Ops.push_back (N->getOperand (i));
603
595
604
596
Ops.push_back (Glue);
605
597
return CurDAG->MorphNodeTo (N, N->getOpcode (), N->getVTList (), Ops);
606
598
}
607
599
600
+ SDNode *AMDGPUDAGToDAGISel::glueCopyToM0 (SDNode *N, SDValue Val) const {
601
+ const SITargetLowering& Lowering =
602
+ *static_cast <const SITargetLowering*>(getTargetLowering ());
603
+
604
+ assert (N->getOperand (0 ).getValueType () == MVT::Other && " Expected chain" );
605
+
606
+ SDValue M0 = Lowering.copyToM0 (*CurDAG, N->getOperand (0 ), SDLoc (N), Val);
607
+ return glueCopyToOp (N, M0, M0.getValue (1 ));
608
+ }
609
+
608
610
SDNode *AMDGPUDAGToDAGISel::glueCopyToM0LDSInit (SDNode *N) const {
609
611
unsigned AS = cast<MemSDNode>(N)->getAddressSpace ();
610
612
if (AS == AMDGPUAS::LOCAL_ADDRESS) {
0 commit comments