@@ -1950,7 +1950,7 @@ void AArch64DAGToDAGISel::SelectMultiVectorMove(SDNode *N, unsigned NumVecs,
1950
1950
unsigned BaseReg, unsigned Op) {
1951
1951
unsigned TileNum = 0 ;
1952
1952
if (BaseReg != AArch64::ZA)
1953
- TileNum = cast<ConstantSDNode>( N->getOperand ( 2 ))-> getZExtValue ( );
1953
+ TileNum = N->getConstantOperandVal ( 2 );
1954
1954
1955
1955
if (!SelectSMETile (BaseReg, TileNum))
1956
1956
return ;
@@ -2145,8 +2145,7 @@ void AArch64DAGToDAGISel::SelectLoadLane(SDNode *N, unsigned NumVecs,
2145
2145
2146
2146
const EVT ResTys[] = {MVT::Untyped, MVT::Other};
2147
2147
2148
- unsigned LaneNo =
2149
- cast<ConstantSDNode>(N->getOperand (NumVecs + 2 ))->getZExtValue ();
2148
+ unsigned LaneNo = N->getConstantOperandVal (NumVecs + 2 );
2150
2149
2151
2150
SDValue Ops[] = {RegSeq, CurDAG->getTargetConstant (LaneNo, dl, MVT::i64),
2152
2151
N->getOperand (NumVecs + 3 ), N->getOperand (0 )};
@@ -2185,8 +2184,7 @@ void AArch64DAGToDAGISel::SelectPostLoadLane(SDNode *N, unsigned NumVecs,
2185
2184
const EVT ResTys[] = {MVT::i64, // Type of the write back register
2186
2185
RegSeq->getValueType (0 ), MVT::Other};
2187
2186
2188
- unsigned LaneNo =
2189
- cast<ConstantSDNode>(N->getOperand (NumVecs + 1 ))->getZExtValue ();
2187
+ unsigned LaneNo = N->getConstantOperandVal (NumVecs + 1 );
2190
2188
2191
2189
SDValue Ops[] = {RegSeq,
2192
2190
CurDAG->getTargetConstant (LaneNo, dl,
@@ -2237,8 +2235,7 @@ void AArch64DAGToDAGISel::SelectStoreLane(SDNode *N, unsigned NumVecs,
2237
2235
2238
2236
SDValue RegSeq = createQTuple (Regs);
2239
2237
2240
- unsigned LaneNo =
2241
- cast<ConstantSDNode>(N->getOperand (NumVecs + 2 ))->getZExtValue ();
2238
+ unsigned LaneNo = N->getConstantOperandVal (NumVecs + 2 );
2242
2239
2243
2240
SDValue Ops[] = {RegSeq, CurDAG->getTargetConstant (LaneNo, dl, MVT::i64),
2244
2241
N->getOperand (NumVecs + 3 ), N->getOperand (0 )};
@@ -2269,8 +2266,7 @@ void AArch64DAGToDAGISel::SelectPostStoreLane(SDNode *N, unsigned NumVecs,
2269
2266
const EVT ResTys[] = {MVT::i64, // Type of the write back register
2270
2267
MVT::Other};
2271
2268
2272
- unsigned LaneNo =
2273
- cast<ConstantSDNode>(N->getOperand (NumVecs + 1 ))->getZExtValue ();
2269
+ unsigned LaneNo = N->getConstantOperandVal (NumVecs + 1 );
2274
2270
2275
2271
SDValue Ops[] = {RegSeq, CurDAG->getTargetConstant (LaneNo, dl, MVT::i64),
2276
2272
N->getOperand (NumVecs + 2 ), // Base Register
@@ -2576,8 +2572,8 @@ static bool isBitfieldExtractOp(SelectionDAG *CurDAG, SDNode *N, unsigned &Opc,
2576
2572
case AArch64::UBFMXri:
2577
2573
Opc = NOpc;
2578
2574
Opd0 = N->getOperand (0 );
2579
- Immr = cast<ConstantSDNode>( N->getOperand ( 1 ). getNode ())-> getZExtValue ( );
2580
- Imms = cast<ConstantSDNode>( N->getOperand ( 2 ). getNode ())-> getZExtValue ( );
2575
+ Immr = N->getConstantOperandVal ( 1 );
2576
+ Imms = N->getConstantOperandVal ( 2 );
2581
2577
return true ;
2582
2578
}
2583
2579
// Unreachable
@@ -3877,7 +3873,7 @@ bool AArch64DAGToDAGISel::tryWriteRegister(SDNode *N) {
3877
3873
assert (isa<ConstantSDNode>(N->getOperand (2 )) &&
3878
3874
" Expected a constant integer expression." );
3879
3875
unsigned Reg = PMapper->Encoding ;
3880
- uint64_t Immed = cast<ConstantSDNode>( N->getOperand ( 2 ))-> getZExtValue ( );
3876
+ uint64_t Immed = N->getConstantOperandVal ( 2 );
3881
3877
CurDAG->SelectNodeTo (
3882
3878
N, State, MVT::Other, CurDAG->getTargetConstant (Reg, DL, MVT::i32),
3883
3879
CurDAG->getTargetConstant (Immed, DL, MVT::i16), N->getOperand (0 ));
@@ -4173,8 +4169,7 @@ bool AArch64DAGToDAGISel::trySelectStackSlotTagP(SDNode *N) {
4173
4169
4174
4170
SDValue IRG_SP = N->getOperand (2 );
4175
4171
if (IRG_SP->getOpcode () != ISD::INTRINSIC_W_CHAIN ||
4176
- cast<ConstantSDNode>(IRG_SP->getOperand (1 ))->getZExtValue () !=
4177
- Intrinsic::aarch64_irg_sp) {
4172
+ IRG_SP->getConstantOperandVal (1 ) != Intrinsic::aarch64_irg_sp) {
4178
4173
return false ;
4179
4174
}
4180
4175
@@ -4183,7 +4178,7 @@ bool AArch64DAGToDAGISel::trySelectStackSlotTagP(SDNode *N) {
4183
4178
int FI = cast<FrameIndexSDNode>(N->getOperand (1 ))->getIndex ();
4184
4179
SDValue FiOp = CurDAG->getTargetFrameIndex (
4185
4180
FI, TLI->getPointerTy (CurDAG->getDataLayout ()));
4186
- int TagOffset = cast<ConstantSDNode>( N->getOperand ( 3 ))-> getZExtValue ( );
4181
+ int TagOffset = N->getConstantOperandVal ( 3 );
4187
4182
4188
4183
SDNode *Out = CurDAG->getMachineNode (
4189
4184
AArch64::TAGPstack, DL, MVT::i64,
@@ -4203,7 +4198,7 @@ void AArch64DAGToDAGISel::SelectTagP(SDNode *N) {
4203
4198
4204
4199
// General case for unrelated pointers in Op1 and Op2.
4205
4200
SDLoc DL (N);
4206
- int TagOffset = cast<ConstantSDNode>( N->getOperand ( 3 ))-> getZExtValue ( );
4201
+ int TagOffset = N->getConstantOperandVal ( 3 );
4207
4202
SDNode *N1 = CurDAG->getMachineNode (AArch64::SUBP, DL, MVT::i64,
4208
4203
{N->getOperand (1 ), N->getOperand (2 )});
4209
4204
SDNode *N2 = CurDAG->getMachineNode (AArch64::ADDXrr, DL, MVT::i64,
@@ -4219,7 +4214,7 @@ bool AArch64DAGToDAGISel::trySelectCastFixedLengthToScalableVector(SDNode *N) {
4219
4214
assert (N->getOpcode () == ISD::INSERT_SUBVECTOR && " Invalid Node!" );
4220
4215
4221
4216
// Bail when not a "cast" like insert_subvector.
4222
- if (cast<ConstantSDNode>( N->getOperand ( 2 ))-> getZExtValue ( ) != 0 )
4217
+ if (N->getConstantOperandVal ( 2 ) != 0 )
4223
4218
return false ;
4224
4219
if (!N->getOperand (0 ).isUndef ())
4225
4220
return false ;
@@ -4250,7 +4245,7 @@ bool AArch64DAGToDAGISel::trySelectCastScalableToFixedLengthVector(SDNode *N) {
4250
4245
assert (N->getOpcode () == ISD::EXTRACT_SUBVECTOR && " Invalid Node!" );
4251
4246
4252
4247
// Bail when not a "cast" like extract_subvector.
4253
- if (cast<ConstantSDNode>( N->getOperand ( 1 ))-> getZExtValue ( ) != 0 )
4248
+ if (N->getConstantOperandVal ( 1 ) != 0 )
4254
4249
return false ;
4255
4250
4256
4251
// Bail when normal isel can do the job.
@@ -4422,7 +4417,7 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
4422
4417
return ;
4423
4418
}
4424
4419
case ISD::INTRINSIC_W_CHAIN: {
4425
- unsigned IntNo = cast<ConstantSDNode>( Node->getOperand ( 1 ))-> getZExtValue ( );
4420
+ unsigned IntNo = Node->getConstantOperandVal ( 1 );
4426
4421
switch (IntNo) {
4427
4422
default :
4428
4423
break ;
@@ -5179,7 +5174,7 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5179
5174
}
5180
5175
} break ;
5181
5176
case ISD::INTRINSIC_WO_CHAIN: {
5182
- unsigned IntNo = cast<ConstantSDNode>( Node->getOperand ( 0 ))-> getZExtValue ( );
5177
+ unsigned IntNo = Node->getConstantOperandVal ( 0 );
5183
5178
switch (IntNo) {
5184
5179
default :
5185
5180
break ;
@@ -5782,7 +5777,7 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
5782
5777
break ;
5783
5778
}
5784
5779
case ISD::INTRINSIC_VOID: {
5785
- unsigned IntNo = cast<ConstantSDNode>( Node->getOperand ( 1 ))-> getZExtValue ( );
5780
+ unsigned IntNo = Node->getConstantOperandVal ( 1 );
5786
5781
if (Node->getNumOperands () >= 3 )
5787
5782
VT = Node->getOperand (2 )->getValueType (0 );
5788
5783
switch (IntNo) {
@@ -6806,7 +6801,7 @@ static EVT getMemVTFromNode(LLVMContext &Ctx, SDNode *Root) {
6806
6801
if (Opcode != ISD::INTRINSIC_VOID && Opcode != ISD::INTRINSIC_W_CHAIN)
6807
6802
return EVT ();
6808
6803
6809
- switch (cast<ConstantSDNode>( Root->getOperand ( 1 ))-> getZExtValue ( )) {
6804
+ switch (Root->getConstantOperandVal ( 1 )) {
6810
6805
default :
6811
6806
return EVT ();
6812
6807
case Intrinsic::aarch64_sme_ldr:
0 commit comments