Skip to content

Commit

Permalink
[AArch64][ISel] NFC: Change streaming mode only through 'changeStream…
Browse files Browse the repository at this point in the history
…ingMode'

This simplifies the code and unifies code-paths to use a single function
for emitting streaming-mode changes.
  • Loading branch information
sdesmalen-arm committed Aug 31, 2023
1 parent 1143da2 commit 8f469bf
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6627,12 +6627,10 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
// make sure it is Glued to the last CopyFromReg value.
if (IsLocallyStreaming) {
const AArch64RegisterInfo *TRI = Subtarget->getRegisterInfo();
Chain = DAG.getNode(
AArch64ISD::SMSTART, DL, DAG.getVTList(MVT::Other, MVT::Glue),
{DAG.getRoot(),
DAG.getTargetConstant((int32_t)AArch64SVCR::SVCRSM, DL, MVT::i32),
DAG.getConstant(0, DL, MVT::i64), DAG.getConstant(1, DL, MVT::i64),
DAG.getRegisterMask(TRI->getSMStartStopCallPreservedMask()), Glue});
Chain =
changeStreamingMode(DAG, DL, /*Enable*/ true, DAG.getRoot(), Glue,
DAG.getConstant(0, DL, MVT::i64), /*Entry*/ true);

// Ensure that the SMSTART happens after the CopyWithChain such that its
// chain result is used.
for (unsigned I=0; I<InVals.size(); ++I) {
Expand Down Expand Up @@ -7884,11 +7882,9 @@ AArch64TargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
// Emit SMSTOP before returning from a locally streaming function
SMEAttrs FuncAttrs(MF.getFunction());
if (FuncAttrs.hasStreamingBody() && !FuncAttrs.hasStreamingInterface()) {
Chain = DAG.getNode(
AArch64ISD::SMSTOP, DL, DAG.getVTList(MVT::Other, MVT::Glue), Chain,
DAG.getTargetConstant((int32_t)AArch64SVCR::SVCRSM, DL, MVT::i32),
DAG.getConstant(1, DL, MVT::i64), DAG.getConstant(0, DL, MVT::i64),
DAG.getRegisterMask(TRI->getSMStartStopCallPreservedMask()));
Chain = changeStreamingMode(
DAG, DL, /*Enable*/ false, Chain, /*Glue*/ SDValue(),
DAG.getConstant(1, DL, MVT::i64), /*Entry*/ true);
Glue = Chain.getValue(1);
}

Expand Down

0 comments on commit 8f469bf

Please sign in to comment.