Skip to content

Commit 481fb28

Browse files
committed
Convert SelectionDAG::SelectNodeTo to use ArrayRef.
llvm-svn: 207377
1 parent dd5e16d commit 481fb28

File tree

8 files changed

+60
-68
lines changed

8 files changed

+60
-68
lines changed

llvm/include/llvm/CodeGen/SelectionDAG.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -840,15 +840,14 @@ class SelectionDAG {
840840
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
841841
SDValue Op1, SDValue Op2, SDValue Op3);
842842
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT,
843-
const SDValue *Ops, unsigned NumOps);
843+
ArrayRef<SDValue> Ops);
844844
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1, EVT VT2);
845845
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
846-
EVT VT2, const SDValue *Ops, unsigned NumOps);
846+
EVT VT2, ArrayRef<SDValue> Ops);
847847
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
848-
EVT VT2, EVT VT3, const SDValue *Ops, unsigned NumOps);
848+
EVT VT2, EVT VT3, ArrayRef<SDValue> Ops);
849849
SDNode *SelectNodeTo(SDNode *N, unsigned MachineOpc, EVT VT1,
850-
EVT VT2, EVT VT3, EVT VT4, const SDValue *Ops,
851-
unsigned NumOps);
850+
EVT VT2, EVT VT3, EVT VT4, ArrayRef<SDValue> Ops);
852851
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
853852
EVT VT2, SDValue Op1);
854853
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
@@ -858,7 +857,7 @@ class SelectionDAG {
858857
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, EVT VT1,
859858
EVT VT2, EVT VT3, SDValue Op1, SDValue Op2, SDValue Op3);
860859
SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
861-
const SDValue *Ops, unsigned NumOps);
860+
ArrayRef<SDValue> Ops);
862861

863862
/// MorphNodeTo - This *mutates* the specified node to have the specified
864863
/// return type, opcode, and operands.

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

+19-22
Original file line numberDiff line numberDiff line change
@@ -5207,80 +5207,78 @@ void SDNode::DropOperands() {
52075207
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52085208
EVT VT) {
52095209
SDVTList VTs = getVTList(VT);
5210-
return SelectNodeTo(N, MachineOpc, VTs, nullptr, 0);
5210+
return SelectNodeTo(N, MachineOpc, VTs, None);
52115211
}
52125212

52135213
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52145214
EVT VT, SDValue Op1) {
52155215
SDVTList VTs = getVTList(VT);
52165216
SDValue Ops[] = { Op1 };
5217-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 1);
5217+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52185218
}
52195219

52205220
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52215221
EVT VT, SDValue Op1,
52225222
SDValue Op2) {
52235223
SDVTList VTs = getVTList(VT);
52245224
SDValue Ops[] = { Op1, Op2 };
5225-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 2);
5225+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52265226
}
52275227

52285228
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52295229
EVT VT, SDValue Op1,
52305230
SDValue Op2, SDValue Op3) {
52315231
SDVTList VTs = getVTList(VT);
52325232
SDValue Ops[] = { Op1, Op2, Op3 };
5233-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 3);
5233+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52345234
}
52355235

52365236
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
5237-
EVT VT, const SDValue *Ops,
5238-
unsigned NumOps) {
5237+
EVT VT, ArrayRef<SDValue> Ops) {
52395238
SDVTList VTs = getVTList(VT);
5240-
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
5239+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52415240
}
52425241

52435242
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
5244-
EVT VT1, EVT VT2, const SDValue *Ops,
5245-
unsigned NumOps) {
5243+
EVT VT1, EVT VT2, ArrayRef<SDValue> Ops) {
52465244
SDVTList VTs = getVTList(VT1, VT2);
5247-
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
5245+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52485246
}
52495247

52505248
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52515249
EVT VT1, EVT VT2) {
52525250
SDVTList VTs = getVTList(VT1, VT2);
5253-
return SelectNodeTo(N, MachineOpc, VTs, (SDValue *)nullptr, 0);
5251+
return SelectNodeTo(N, MachineOpc, VTs, None);
52545252
}
52555253

52565254
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52575255
EVT VT1, EVT VT2, EVT VT3,
5258-
const SDValue *Ops, unsigned NumOps) {
5256+
ArrayRef<SDValue> Ops) {
52595257
SDVTList VTs = getVTList(VT1, VT2, VT3);
5260-
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
5258+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52615259
}
52625260

52635261
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52645262
EVT VT1, EVT VT2, EVT VT3, EVT VT4,
5265-
const SDValue *Ops, unsigned NumOps) {
5263+
ArrayRef<SDValue> Ops) {
52665264
SDVTList VTs = getVTList(VT1, VT2, VT3, VT4);
5267-
return SelectNodeTo(N, MachineOpc, VTs, Ops, NumOps);
5265+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52685266
}
52695267

52705268
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52715269
EVT VT1, EVT VT2,
52725270
SDValue Op1) {
52735271
SDVTList VTs = getVTList(VT1, VT2);
52745272
SDValue Ops[] = { Op1 };
5275-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 1);
5273+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52765274
}
52775275

52785276
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52795277
EVT VT1, EVT VT2,
52805278
SDValue Op1, SDValue Op2) {
52815279
SDVTList VTs = getVTList(VT1, VT2);
52825280
SDValue Ops[] = { Op1, Op2 };
5283-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 2);
5281+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52845282
}
52855283

52865284
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
@@ -5289,7 +5287,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52895287
SDValue Op3) {
52905288
SDVTList VTs = getVTList(VT1, VT2);
52915289
SDValue Ops[] = { Op1, Op2, Op3 };
5292-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 3);
5290+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
52935291
}
52945292

52955293
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
@@ -5298,13 +5296,12 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
52985296
SDValue Op3) {
52995297
SDVTList VTs = getVTList(VT1, VT2, VT3);
53005298
SDValue Ops[] = { Op1, Op2, Op3 };
5301-
return SelectNodeTo(N, MachineOpc, VTs, Ops, 3);
5299+
return SelectNodeTo(N, MachineOpc, VTs, Ops);
53025300
}
53035301

53045302
SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
5305-
SDVTList VTs, const SDValue *Ops,
5306-
unsigned NumOps) {
5307-
N = MorphNodeTo(N, ~MachineOpc, VTs, Ops, NumOps);
5303+
SDVTList VTs,ArrayRef<SDValue> Ops) {
5304+
N = MorphNodeTo(N, ~MachineOpc, VTs, Ops.data(), Ops.size());
53085305
// Reset the NodeID to -1.
53095306
N->setNodeId(-1);
53105307
return N;

llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,7 @@ SDNode *AArch64DAGToDAGISel::SelectAtomic(SDNode *Node, unsigned Op8,
425425
Ops.push_back(CurDAG->getTargetConstant(AN->getOrdering(), MVT::i32));
426426
Ops.push_back(AN->getOperand(0)); // Chain moves to the end
427427

428-
return CurDAG->SelectNodeTo(Node, Op,
429-
AN->getValueType(0), MVT::Other,
430-
&Ops[0], Ops.size());
428+
return CurDAG->SelectNodeTo(Node, Op, AN->getValueType(0), MVT::Other, Ops);
431429
}
432430

433431
SDValue AArch64DAGToDAGISel::createDTuple(ArrayRef<SDValue> Regs) {

llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,7 @@ SDNode *ARMDAGToDAGISel::SelectV6T2BitfieldExtractOp(SDNode *N,
23162316
SDValue Ops[] = { N->getOperand(0).getOperand(0),
23172317
CurDAG->getTargetConstant(LSB, MVT::i32),
23182318
getAL(CurDAG), Reg0, Reg0 };
2319-
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops, 5);
2319+
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops);
23202320
}
23212321

23222322
// ARM models shift instructions as MOVsi with shifter operand.
@@ -2326,14 +2326,14 @@ SDNode *ARMDAGToDAGISel::SelectV6T2BitfieldExtractOp(SDNode *N,
23262326
MVT::i32);
23272327
SDValue Ops[] = { N->getOperand(0).getOperand(0), ShOpc,
23282328
getAL(CurDAG), Reg0, Reg0 };
2329-
return CurDAG->SelectNodeTo(N, ARM::MOVsi, MVT::i32, Ops, 5);
2329+
return CurDAG->SelectNodeTo(N, ARM::MOVsi, MVT::i32, Ops);
23302330
}
23312331

23322332
SDValue Ops[] = { N->getOperand(0).getOperand(0),
23332333
CurDAG->getTargetConstant(LSB, MVT::i32),
23342334
CurDAG->getTargetConstant(Width, MVT::i32),
2335-
getAL(CurDAG), Reg0 };
2336-
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops, 5);
2335+
getAL(CurDAG), Reg0 };
2336+
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops);
23372337
}
23382338
}
23392339
return nullptr;
@@ -2356,7 +2356,7 @@ SDNode *ARMDAGToDAGISel::SelectV6T2BitfieldExtractOp(SDNode *N,
23562356
CurDAG->getTargetConstant(LSB, MVT::i32),
23572357
CurDAG->getTargetConstant(Width, MVT::i32),
23582358
getAL(CurDAG), Reg0 };
2359-
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops, 5);
2359+
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops);
23602360
}
23612361
}
23622362
return nullptr;
@@ -2493,14 +2493,14 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
24932493
if (Subtarget->isThumb1Only()) {
24942494
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
24952495
getAL(CurDAG), CurDAG->getRegister(0, MVT::i32) };
2496-
return CurDAG->SelectNodeTo(N, ARM::tADDrSPi, MVT::i32, Ops, 4);
2496+
return CurDAG->SelectNodeTo(N, ARM::tADDrSPi, MVT::i32, Ops);
24972497
} else {
24982498
unsigned Opc = ((Subtarget->isThumb() && Subtarget->hasThumb2()) ?
24992499
ARM::t2ADDri : ARM::ADDri);
25002500
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
25012501
getAL(CurDAG), CurDAG->getRegister(0, MVT::i32),
25022502
CurDAG->getRegister(0, MVT::i32) };
2503-
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops, 5);
2503+
return CurDAG->SelectNodeTo(N, Opc, MVT::i32, Ops);
25042504
}
25052505
}
25062506
case ISD::SRL:
@@ -2527,10 +2527,10 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
25272527
SDValue Reg0 = CurDAG->getRegister(0, MVT::i32);
25282528
if (Subtarget->isThumb()) {
25292529
SDValue Ops[] = { V, V, ShImmOp, getAL(CurDAG), Reg0, Reg0 };
2530-
return CurDAG->SelectNodeTo(N, ARM::t2ADDrs, MVT::i32, Ops, 6);
2530+
return CurDAG->SelectNodeTo(N, ARM::t2ADDrs, MVT::i32, Ops);
25312531
} else {
25322532
SDValue Ops[] = { V, V, Reg0, ShImmOp, getAL(CurDAG), Reg0, Reg0 };
2533-
return CurDAG->SelectNodeTo(N, ARM::ADDrsi, MVT::i32, Ops, 7);
2533+
return CurDAG->SelectNodeTo(N, ARM::ADDrsi, MVT::i32, Ops);
25342534
}
25352535
}
25362536
if (isPowerOf2_32(RHSV+1)) { // 2^n-1?
@@ -2543,10 +2543,10 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
25432543
SDValue Reg0 = CurDAG->getRegister(0, MVT::i32);
25442544
if (Subtarget->isThumb()) {
25452545
SDValue Ops[] = { V, V, ShImmOp, getAL(CurDAG), Reg0, Reg0 };
2546-
return CurDAG->SelectNodeTo(N, ARM::t2RSBrs, MVT::i32, Ops, 6);
2546+
return CurDAG->SelectNodeTo(N, ARM::t2RSBrs, MVT::i32, Ops);
25472547
} else {
25482548
SDValue Ops[] = { V, V, Reg0, ShImmOp, getAL(CurDAG), Reg0, Reg0 };
2549-
return CurDAG->SelectNodeTo(N, ARM::RSBrsi, MVT::i32, Ops, 7);
2549+
return CurDAG->SelectNodeTo(N, ARM::RSBrsi, MVT::i32, Ops);
25502550
}
25512551
}
25522552
}

llvm/lib/Target/ARM64/ARM64ISelDAGToDAG.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ SDNode *ARM64DAGToDAGISel::SelectBitfieldExtractOp(SDNode *N) {
13911391

13921392
SDValue Ops[] = {Opd0, CurDAG->getTargetConstant(LSB, VT),
13931393
CurDAG->getTargetConstant(MSB, VT)};
1394-
return CurDAG->SelectNodeTo(N, Opc, VT, Ops, 3);
1394+
return CurDAG->SelectNodeTo(N, Opc, VT, Ops);
13951395
}
13961396

13971397
/// Does DstMask form a complementary pair with the mask provided by
@@ -1779,7 +1779,7 @@ SDNode *ARM64DAGToDAGISel::SelectBitfieldInsertOp(SDNode *N) {
17791779
Opd1,
17801780
CurDAG->getTargetConstant(LSB, VT),
17811781
CurDAG->getTargetConstant(MSB, VT) };
1782-
return CurDAG->SelectNodeTo(N, Opc, VT, Ops, 4);
1782+
return CurDAG->SelectNodeTo(N, Opc, VT, Ops);
17831783
}
17841784

17851785
SDNode *ARM64DAGToDAGISel::SelectLIBM(SDNode *N) {
@@ -1991,7 +1991,7 @@ SDNode *ARM64DAGToDAGISel::Select(SDNode *Node) {
19911991
SDValue TFI = CurDAG->getTargetFrameIndex(FI, TLI->getPointerTy());
19921992
SDValue Ops[] = { TFI, CurDAG->getTargetConstant(0, MVT::i32),
19931993
CurDAG->getTargetConstant(Shifter, MVT::i32) };
1994-
return CurDAG->SelectNodeTo(Node, ARM64::ADDXri, MVT::i64, Ops, 3);
1994+
return CurDAG->SelectNodeTo(Node, ARM64::ADDXri, MVT::i64, Ops);
19951995
}
19961996
case ISD::INTRINSIC_W_CHAIN: {
19971997
unsigned IntNo = cast<ConstantSDNode>(Node->getOperand(1))->getZExtValue();

llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,7 @@ SDNode *MSP430DAGToDAGISel::SelectIndexedBinOp(SDNode *Op,
369369
MemRefs0[0] = cast<MemSDNode>(N1)->getMemOperand();
370370
SDValue Ops0[] = { N2, LD->getBasePtr(), LD->getChain() };
371371
SDNode *ResNode =
372-
CurDAG->SelectNodeTo(Op, Opc,
373-
VT, MVT::i16, MVT::Other,
374-
Ops0, 3);
372+
CurDAG->SelectNodeTo(Op, Opc, VT, MVT::i16, MVT::Other, Ops0);
375373
cast<MachineSDNode>(ResNode)->setMemRefs(MemRefs0, MemRefs0 + 1);
376374
// Transfer chain.
377375
ReplaceUses(SDValue(N1.getNode(), 2), SDValue(ResNode, 2));

0 commit comments

Comments
 (0)