Skip to content

Commit 55bb8ab

Browse files
committed
Remove subtarget property
Change-Id: I0316ef997160ed0232a72422c75d7180f3c09150
1 parent 9f0bdf8 commit 55bb8ab

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "AArch64PerfectShuffle.h"
1818
#include "AArch64RegisterInfo.h"
1919
#include "AArch64Subtarget.h"
20+
#include "AArch64TargetMachine.h"
2021
#include "MCTargetDesc/AArch64AddressingModes.h"
2122
#include "Utils/AArch64BaseInfo.h"
2223
#include "Utils/AArch64SMEAttributes.h"
@@ -1998,6 +1999,10 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
19981999
setOperationAction(Op, MVT::f16, Promote);
19992000
}
20002001

2002+
const AArch64TargetMachine &AArch64TargetLowering::getTM() const {
2003+
return static_cast<const AArch64TargetMachine &>(getTargetMachine());
2004+
}
2005+
20012006
void AArch64TargetLowering::addTypeForNEON(MVT VT) {
20022007
assert(VT.isVector() && "VT should be a vector type");
20032008

@@ -8244,7 +8249,7 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
82448249
if (Subtarget->hasCustomCallingConv())
82458250
Subtarget->getRegisterInfo()->UpdateCustomCalleeSavedRegs(MF);
82468251

8247-
if (!Subtarget->useNewSMEABILowering() || Attrs.hasAgnosticZAInterface()) {
8252+
if (!getTM().useNewSMEABILowering() || Attrs.hasAgnosticZAInterface()) {
82488253
// Old SME ABI lowering (deprecated):
82498254
// Create a 16 Byte TPIDR2 object. The dynamic buffer
82508255
// will be expanded and stored in the static object later using a
@@ -8308,7 +8313,7 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
83088313
}
83098314
}
83108315

8311-
if (Subtarget->useNewSMEABILowering()) {
8316+
if (getTM().useNewSMEABILowering()) {
83128317
// Clear new ZT0 state. TODO: Move this to the SME ABI pass.
83138318
if (Attrs.isNewZT0())
83148319
Chain = DAG.getNode(
@@ -9024,7 +9029,7 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
90249029

90259030
// Determine whether we need any streaming mode changes.
90269031
SMECallAttrs CallAttrs = getSMECallAttrs(MF.getFunction(), CLI);
9027-
bool UseNewSMEABILowering = Subtarget->useNewSMEABILowering();
9032+
bool UseNewSMEABILowering = getTM().useNewSMEABILowering();
90289033
bool IsAgnosticZAFunction = CallAttrs.caller().hasAgnosticZAInterface();
90299034
auto ZAMarkerNode = [&]() -> std::optional<unsigned> {
90309035
// TODO: Handle agnostic ZA functions.

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
namespace llvm {
2525

26+
class AArch64TargetMachine;
27+
2628
namespace AArch64 {
2729
/// Possible values of current rounding mode, which is specified in bits
2830
/// 23:22 of FPCR.
@@ -64,6 +66,8 @@ class AArch64TargetLowering : public TargetLowering {
6466
explicit AArch64TargetLowering(const TargetMachine &TM,
6567
const AArch64Subtarget &STI);
6668

69+
const AArch64TargetMachine &getTM() const;
70+
6771
/// Control the following reassociation of operands: (op (op x, c1), y) -> (op
6872
/// (op x, y), c1) where N0 is (op x, c1) and N1 is y.
6973
bool isReassocProfitable(SelectionDAG &DAG, SDValue N0,

llvm/lib/Target/AArch64/AArch64Subtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,13 @@ AArch64Subtarget::AArch64Subtarget(const Triple &TT, StringRef CPU,
372372
unsigned MinSVEVectorSizeInBitsOverride,
373373
unsigned MaxSVEVectorSizeInBitsOverride,
374374
bool IsStreaming, bool IsStreamingCompatible,
375-
bool HasMinSize, bool UseNewSMEABILowering)
375+
bool HasMinSize)
376376
: AArch64GenSubtargetInfo(TT, CPU, TuneCPU, FS),
377377
ReserveXRegister(AArch64::GPR64commonRegClass.getNumRegs()),
378378
ReserveXRegisterForRA(AArch64::GPR64commonRegClass.getNumRegs()),
379379
CustomCallSavedXRegs(AArch64::GPR64commonRegClass.getNumRegs()),
380380
IsLittle(LittleEndian), IsStreaming(IsStreaming),
381381
IsStreamingCompatible(IsStreamingCompatible),
382-
UseNewSMEABILowering(UseNewSMEABILowering),
383382
StreamingHazardSize(
384383
AArch64StreamingHazardSize.getNumOccurrences() > 0
385384
? std::optional<unsigned>(AArch64StreamingHazardSize)

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
8585

8686
bool IsStreaming;
8787
bool IsStreamingCompatible;
88-
bool UseNewSMEABILowering = false;
8988
std::optional<unsigned> StreamingHazardSize;
9089
unsigned MinSVEVectorSizeInBits;
9190
unsigned MaxSVEVectorSizeInBits;
@@ -129,7 +128,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
129128
unsigned MinSVEVectorSizeInBitsOverride = 0,
130129
unsigned MaxSVEVectorSizeInBitsOverride = 0,
131130
bool IsStreaming = false, bool IsStreamingCompatible = false,
132-
bool HasMinSize = false, bool UseNewSMEABILowering = false);
131+
bool HasMinSize = false);
133132

134133
virtual unsigned getHwModeSet() const override;
135134

@@ -213,9 +212,6 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
213212
return hasSVE() || isStreamingSVEAvailable();
214213
}
215214

216-
/// Returns true if the new SME ABI lowering should be used.
217-
bool useNewSMEABILowering() const { return UseNewSMEABILowering; }
218-
219215
unsigned getMinVectorRegisterBitWidth() const {
220216
// Don't assume any minimum vector size when PSTATE.SM may not be 0, because
221217
// we don't yet support streaming-compatible codegen support that we trust

llvm/lib/Target/AArch64/AArch64TargetMachine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, const Triple &TT,
373373
computeDefaultCPU(TT, CPU), FS, Options,
374374
getEffectiveRelocModel(TT, RM),
375375
getEffectiveAArch64CodeModel(TT, CM, JIT), OL),
376-
TLOF(createTLOF(getTargetTriple())), isLittle(LittleEndian) {
376+
TLOF(createTLOF(getTargetTriple())), isLittle(LittleEndian),
377+
UseNewSMEABILowering(EnableNewSMEABILowering) {
377378
initAsmInfo();
378379

379380
if (TT.isOSBinFormatMachO()) {
@@ -484,8 +485,7 @@ AArch64TargetMachine::getSubtargetImpl(const Function &F) const {
484485
resetTargetOptions(F);
485486
I = std::make_unique<AArch64Subtarget>(
486487
TargetTriple, CPU, TuneCPU, FS, *this, isLittle, MinSVEVectorSize,
487-
MaxSVEVectorSize, IsStreaming, IsStreamingCompatible, HasMinSize,
488-
EnableNewSMEABILowering);
488+
MaxSVEVectorSize, IsStreaming, IsStreamingCompatible, HasMinSize);
489489
}
490490

491491
if (IsStreaming && !I->hasSME())

llvm/lib/Target/AArch64/AArch64TargetMachine.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ class AArch64TargetMachine : public CodeGenTargetMachineImpl {
7979
size_t clearLinkerOptimizationHints(
8080
const SmallPtrSetImpl<MachineInstr *> &MIs) const override;
8181

82+
/// Returns true if the new SME ABI lowering should be used.
83+
bool useNewSMEABILowering() const { return UseNewSMEABILowering; }
84+
8285
private:
8386
bool isLittle;
87+
bool UseNewSMEABILowering;
8488
};
8589

8690
// AArch64 little endian target machine.

0 commit comments

Comments
 (0)