Skip to content

Commit 3550662

Browse files
authored
ARM: Avoid using getTargetLowering in TargetLowering (#143833)
This is this.
1 parent bc7fafb commit 3550662

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,8 +2688,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
26882688
unsigned RegBegin, RegEnd;
26892689
CCInfo.getInRegsParamInfo(CurByValIdx, RegBegin, RegEnd);
26902690

2691-
EVT PtrVT =
2692-
DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
2691+
EVT PtrVT = getPointerTy(DAG.getDataLayout());
26932692
unsigned int i, j;
26942693
for (i = 0, j = RegBegin; j < RegEnd; i++, j++) {
26952694
SDValue Const = DAG.getConstant(4*i, dl, MVT::i32);
@@ -5024,7 +5023,7 @@ ARMTargetLowering::getARMXALUOOp(SDValue Op, SelectionDAG &DAG,
50245023
SDValue
50255024
ARMTargetLowering::LowerSignedALUO(SDValue Op, SelectionDAG &DAG) const {
50265025
// Let legalize expand this if it isn't a legal type yet.
5027-
if (!DAG.getTargetLoweringInfo().isTypeLegal(Op.getValueType()))
5026+
if (!isTypeLegal(Op.getValueType()))
50285027
return SDValue();
50295028

50305029
SDValue Value, OverflowCmp;
@@ -5070,7 +5069,7 @@ static SDValue ConvertCarryFlagToBooleanCarry(SDValue Flags, EVT VT,
50705069
SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue Op,
50715070
SelectionDAG &DAG) const {
50725071
// Let legalize expand this if it isn't a legal type yet.
5073-
if (!DAG.getTargetLoweringInfo().isTypeLegal(Op.getValueType()))
5072+
if (!isTypeLegal(Op.getValueType()))
50745073
return SDValue();
50755074

50765075
SDValue LHS = Op.getOperand(0);
@@ -5168,7 +5167,7 @@ SDValue ARMTargetLowering::LowerSELECT(SDValue Op, SelectionDAG &DAG) const {
51685167
if (Cond.getResNo() == 1 &&
51695168
(Opc == ISD::SADDO || Opc == ISD::UADDO || Opc == ISD::SSUBO ||
51705169
Opc == ISD::USUBO)) {
5171-
if (!DAG.getTargetLoweringInfo().isTypeLegal(Cond->getValueType(0)))
5170+
if (!isTypeLegal(Cond->getValueType(0)))
51725171
return SDValue();
51735172

51745173
SDValue Value, OverflowCmp;
@@ -5530,8 +5529,7 @@ SDValue ARMTargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const {
55305529
}
55315530

55325531
if (isUnsupportedFloatingType(LHS.getValueType())) {
5533-
DAG.getTargetLoweringInfo().softenSetCCOperands(
5534-
DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS);
5532+
softenSetCCOperands(DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS);
55355533

55365534
// If softenSetCCOperands only returned one value, we should compare it to
55375535
// zero.
@@ -5736,7 +5734,7 @@ SDValue ARMTargetLowering::LowerBRCOND(SDValue Op, SelectionDAG &DAG) const {
57365734
(Opc == ISD::SADDO || Opc == ISD::UADDO || Opc == ISD::SSUBO ||
57375735
Opc == ISD::USUBO || OptimizeMul)) {
57385736
// Only lower legal XALUO ops.
5739-
if (!DAG.getTargetLoweringInfo().isTypeLegal(Cond->getValueType(0)))
5737+
if (!isTypeLegal(Cond->getValueType(0)))
57405738
return SDValue();
57415739

57425740
// The actual operation with overflow check.
@@ -5766,8 +5764,7 @@ SDValue ARMTargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) const {
57665764
SDLoc dl(Op);
57675765

57685766
if (isUnsupportedFloatingType(LHS.getValueType())) {
5769-
DAG.getTargetLoweringInfo().softenSetCCOperands(
5770-
DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS);
5767+
softenSetCCOperands(DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS);
57715768

57725769
// If softenSetCCOperands only returned one value, we should compare it to
57735770
// zero.
@@ -5787,7 +5784,7 @@ SDValue ARMTargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) const {
57875784
Opc == ISD::USUBO || OptimizeMul) &&
57885785
(CC == ISD::SETEQ || CC == ISD::SETNE)) {
57895786
// Only lower legal XALUO ops.
5790-
if (!DAG.getTargetLoweringInfo().isTypeLegal(LHS->getValueType(0)))
5787+
if (!isTypeLegal(LHS->getValueType(0)))
57915788
return SDValue();
57925789

57935790
// The actual operation with overflow check.
@@ -6255,7 +6252,6 @@ static SDValue CombineVMOVDRRCandidateWithVecOp(const SDNode *BC,
62556252
/// vectors), since the legalizer won't know what to do with that.
62566253
SDValue ARMTargetLowering::ExpandBITCAST(SDNode *N, SelectionDAG &DAG,
62576254
const ARMSubtarget *Subtarget) const {
6258-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
62596255
SDLoc dl(N);
62606256
SDValue Op = N->getOperand(0);
62616257

@@ -6282,7 +6278,7 @@ SDValue ARMTargetLowering::ExpandBITCAST(SDNode *N, SelectionDAG &DAG,
62826278
return SDValue();
62836279

62846280
// Turn i64->f64 into VMOVDRR.
6285-
if (SrcVT == MVT::i64 && TLI.isTypeLegal(DstVT)) {
6281+
if (SrcVT == MVT::i64 && isTypeLegal(DstVT)) {
62866282
// Do not force values to GPRs (this is what VMOVDRR does for the inputs)
62876283
// if we can combine the bitcast with its source.
62886284
if (SDValue Val = CombineVMOVDRRCandidateWithVecOp(N, DAG))
@@ -6294,7 +6290,7 @@ SDValue ARMTargetLowering::ExpandBITCAST(SDNode *N, SelectionDAG &DAG,
62946290
}
62956291

62966292
// Turn f64->i64 into VMOVRRD.
6297-
if (DstVT == MVT::i64 && TLI.isTypeLegal(SrcVT)) {
6293+
if (DstVT == MVT::i64 && isTypeLegal(SrcVT)) {
62986294
SDValue Cvt;
62996295
if (DAG.getDataLayout().isBigEndian() && SrcVT.isVector() &&
63006296
SrcVT.getVectorNumElements() > 1)
@@ -9931,7 +9927,6 @@ SDValue ARMTargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
99319927
auto PtrVT = getPointerTy(DAG.getDataLayout());
99329928

99339929
MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
9934-
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
99359930

99369931
// Pair of floats / doubles used to pass the result.
99379932
Type *RetTy = StructType::get(ArgTy, ArgTy);
@@ -9945,7 +9940,7 @@ SDValue ARMTargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
99459940
const uint64_t ByteSize = DL.getTypeAllocSize(RetTy);
99469941
const Align StackAlign = DL.getPrefTypeAlign(RetTy);
99479942
int FrameIdx = MFI.CreateStackObject(ByteSize, StackAlign, false);
9948-
SRet = DAG.getFrameIndex(FrameIdx, TLI.getPointerTy(DL));
9943+
SRet = DAG.getFrameIndex(FrameIdx, getPointerTy(DL));
99499944

99509945
ArgListEntry Entry;
99519946
Entry.Node = SRet;
@@ -10003,15 +9998,14 @@ SDValue ARMTargetLowering::LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG,
100039998
SDLoc dl(Op);
100049999

1000510000
const auto &DL = DAG.getDataLayout();
10006-
const auto &TLI = DAG.getTargetLoweringInfo();
1000710001

1000810002
const char *Name = nullptr;
1000910003
if (Signed)
1001010004
Name = (VT == MVT::i32) ? "__rt_sdiv" : "__rt_sdiv64";
1001110005
else
1001210006
Name = (VT == MVT::i32) ? "__rt_udiv" : "__rt_udiv64";
1001310007

10014-
SDValue ES = DAG.getExternalSymbol(Name, TLI.getPointerTy(DL));
10008+
SDValue ES = DAG.getExternalSymbol(Name, getPointerTy(DL));
1001510009

1001610010
ARMTargetLowering::ArgListTy Args;
1001710011

@@ -10101,7 +10095,6 @@ void ARMTargetLowering::ExpandDIV_Windows(
1010110095
SDValue Op, SelectionDAG &DAG, bool Signed,
1010210096
SmallVectorImpl<SDValue> &Results) const {
1010310097
const auto &DL = DAG.getDataLayout();
10104-
const auto &TLI = DAG.getTargetLoweringInfo();
1010510098

1010610099
assert(Op.getValueType() == MVT::i64 &&
1010710100
"unexpected type for custom lowering DIV");
@@ -10113,7 +10106,7 @@ void ARMTargetLowering::ExpandDIV_Windows(
1011310106

1011410107
SDValue Lower = DAG.getNode(ISD::TRUNCATE, dl, MVT::i32, Result);
1011510108
SDValue Upper = DAG.getNode(ISD::SRL, dl, MVT::i64, Result,
10116-
DAG.getConstant(32, dl, TLI.getPointerTy(DL)));
10109+
DAG.getConstant(32, dl, getPointerTy(DL)));
1011710110
Upper = DAG.getNode(ISD::TRUNCATE, dl, MVT::i32, Upper);
1011810111

1011910112
Results.push_back(DAG.getNode(ISD::BUILD_PAIR, dl, MVT::i64, Lower, Upper));
@@ -10525,8 +10518,8 @@ SDValue ARMTargetLowering::LowerFSETCC(SDValue Op, SelectionDAG &DAG) const {
1052510518
// If we don't have instructions of this float type then soften to a libcall
1052610519
// and use SETCC instead.
1052710520
if (isUnsupportedFloatingType(LHS.getValueType())) {
10528-
DAG.getTargetLoweringInfo().softenSetCCOperands(
10529-
DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS, Chain, IsSignaling);
10521+
softenSetCCOperands(DAG, LHS.getValueType(), LHS, RHS, CC, dl, LHS, RHS,
10522+
Chain, IsSignaling);
1053010523
if (!RHS.getNode()) {
1053110524
RHS = DAG.getConstant(0, dl, LHS.getValueType());
1053210525
CC = ISD::SETNE;

0 commit comments

Comments
 (0)