llvm.org GIT mirror llvm / 12be54c
AMDGPU: Slightly restructure m0 init code This will allow using another operation to produce the glue in a future change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375447 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 1 year, 1 month ago
1 changed file(s) with 15 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
171171
172172 MachineSDNode *buildSMovImm64(SDLoc &DL, uint64_t Val, EVT VT) const;
173173
174 SDNode *glueCopyToOp(SDNode *N, SDValue NewChain, SDValue Glue) const;
175 SDNode *glueCopyToM0(SDNode *N, SDValue Val) const;
174176 SDNode *glueCopyToM0LDSInit(SDNode *N) const;
175 SDNode *glueCopyToM0(SDNode *N, SDValue Val) const;
176177
177178 const TargetRegisterClass *getOperandRegClass(SDNode *N, unsigned OpNo) const;
178179 virtual bool SelectADDRVTX_READ(SDValue Addr, SDValue &Base, SDValue &Offset);
584585 }
585586 }
586587
588 SDNode *AMDGPUDAGToDAGISel::glueCopyToOp(SDNode *N, SDValue NewChain,
589 SDValue Glue) const {
590 SmallVector Ops;
591 Ops.push_back(NewChain); // Replace the chain.
592 for (unsigned i = 1, e = N->getNumOperands(); i != e; ++i)
593 Ops.push_back(N->getOperand(i));
594
595 Ops.push_back(Glue);
596 return CurDAG->MorphNodeTo(N, N->getOpcode(), N->getVTList(), Ops);
597 }
598
587599 SDNode *AMDGPUDAGToDAGISel::glueCopyToM0(SDNode *N, SDValue Val) const {
588600 const SITargetLowering& Lowering =
589601 *static_cast(getTargetLowering());
590602
591603 assert(N->getOperand(0).getValueType() == MVT::Other && "Expected chain");
592604
593 SDValue M0 = Lowering.copyToM0(*CurDAG, N->getOperand(0), SDLoc(N),
594 Val);
595
596 SDValue Glue = M0.getValue(1);
597
598 SmallVector Ops;
599 Ops.push_back(M0); // Replace the chain.
600 for (unsigned i = 1, e = N->getNumOperands(); i != e; ++i)
601 Ops.push_back(N->getOperand(i));
602
603 Ops.push_back(Glue);
604 return CurDAG->MorphNodeTo(N, N->getOpcode(), N->getVTList(), Ops);
605 SDValue M0 = Lowering.copyToM0(*CurDAG, N->getOperand(0), SDLoc(N), Val);
606 return glueCopyToOp(N, M0, M0.getValue(1));
605607 }
606608
607609 SDNode *AMDGPUDAGToDAGISel::glueCopyToM0LDSInit(SDNode *N) const {