@@ -156,9 +156,6 @@ class AArch64DAGToDAGISel : public SelectionDAGISel {
156
156
157
157
SDNode *SelectLIBM (SDNode *N);
158
158
159
- SDNode *SelectReadRegister (SDNode *N);
160
- SDNode *SelectWriteRegister (SDNode *N);
161
-
162
159
// Include the pieces autogenerated from the target description.
163
160
#include " AArch64GenDAGISel.inc"
164
161
@@ -2117,115 +2114,6 @@ AArch64DAGToDAGISel::SelectCVTFixedPosOperand(SDValue N, SDValue &FixedPos,
2117
2114
return true ;
2118
2115
}
2119
2116
2120
- // Inspects a register string of the form o0:op1:CRn:CRm:op2 gets the fields
2121
- // of the string and obtains the integer values from them and combines these
2122
- // into a single value to be used in the MRS/MSR instruction.
2123
- static int getIntOperandFromRegisterString (StringRef RegString) {
2124
- SmallVector<StringRef, 5 > Fields;
2125
- RegString.split (Fields, " :" );
2126
-
2127
- if (Fields.size () == 1 )
2128
- return -1 ;
2129
-
2130
- assert (Fields.size () == 5
2131
- && " Invalid number of fields in read register string" );
2132
-
2133
- SmallVector<int , 5 > Ops;
2134
- bool AllIntFields = true ;
2135
-
2136
- for (StringRef Field : Fields) {
2137
- unsigned IntField;
2138
- AllIntFields &= !Field.getAsInteger (10 , IntField);
2139
- Ops.push_back (IntField);
2140
- }
2141
-
2142
- assert (AllIntFields &&
2143
- " Unexpected non-integer value in special register string." );
2144
-
2145
- // Need to combine the integer fields of the string into a single value
2146
- // based on the bit encoding of MRS/MSR instruction.
2147
- return (Ops[0 ] << 14 ) | (Ops[1 ] << 11 ) | (Ops[2 ] << 7 ) |
2148
- (Ops[3 ] << 3 ) | (Ops[4 ]);
2149
- }
2150
-
2151
- // Lower the read_register intrinsic to an MRS instruction node if the special
2152
- // register string argument is either of the form detailed in the ALCE (the
2153
- // form described in getIntOperandsFromRegsterString) or is a named register
2154
- // known by the MRS SysReg mapper.
2155
- SDNode *AArch64DAGToDAGISel::SelectReadRegister (SDNode *N) {
2156
- const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(N->getOperand (0 ));
2157
- const MDString *RegString = dyn_cast<MDString>(MD->getMD ()->getOperand (0 ));
2158
- SDLoc DL (N);
2159
-
2160
- int Reg = getIntOperandFromRegisterString (RegString->getString ());
2161
- if (Reg != -1 )
2162
- return CurDAG->getMachineNode (AArch64::MRS, DL, N->getSimpleValueType (0 ),
2163
- CurDAG->getTargetConstant (Reg, DL, MVT::i32 ));
2164
-
2165
- // Use the sysreg mapper to map the remaining possible strings to the
2166
- // value for the register to be used for the instruction operand.
2167
- AArch64SysReg::MRSMapper mapper;
2168
- bool IsValidSpecialReg;
2169
- Reg = mapper.fromString (RegString->getString (),
2170
- Subtarget->getFeatureBits (),
2171
- IsValidSpecialReg);
2172
- if (IsValidSpecialReg)
2173
- return CurDAG->getMachineNode (AArch64::MRS, DL, N->getSimpleValueType (0 ),
2174
- CurDAG->getTargetConstant (Reg, DL, MVT::i32 ));
2175
- return nullptr ;
2176
- }
2177
-
2178
- // Lower the write_register intrinsic to an MSR instruction node if the special
2179
- // register string argument is either of the form detailed in the ALCE (the
2180
- // form described in getIntOperandsFromRegsterString) or is a named register
2181
- // known by the MSR SysReg mapper.
2182
- SDNode *AArch64DAGToDAGISel::SelectWriteRegister (SDNode *N) {
2183
- const MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(N->getOperand (1 ));
2184
- const MDString *RegString = dyn_cast<MDString>(MD->getMD ()->getOperand (0 ));
2185
- SDLoc DL (N);
2186
-
2187
- int Reg = getIntOperandFromRegisterString (RegString->getString ());
2188
- if (Reg != -1 )
2189
- return CurDAG->getMachineNode (AArch64::MSR, DL, MVT::Other,
2190
- CurDAG->getTargetConstant (Reg, DL, MVT::i32 ),
2191
- N->getOperand (2 ), N->getOperand (0 ));
2192
-
2193
- // Check if the register was one of those allowed as the pstatefield value in
2194
- // the MSR (immediate) instruction. To accept the values allowed in the
2195
- // pstatefield for the MSR (immediate) instruction, we also require that an
2196
- // immediate value has been provided as an argument, we know that this is
2197
- // the case as it has been ensured by semantic checking.
2198
- AArch64PState::PStateMapper PMapper;
2199
- bool IsValidSpecialReg;
2200
- Reg = PMapper.fromString (RegString->getString (),
2201
- Subtarget->getFeatureBits (),
2202
- IsValidSpecialReg);
2203
- if (IsValidSpecialReg) {
2204
- assert (isa<ConstantSDNode>(N->getOperand (2 ))
2205
- && " Expected a constant integer expression." );
2206
- uint64_t Immed = cast<ConstantSDNode>(N->getOperand (2 ))->getZExtValue ();
2207
- return CurDAG->getMachineNode (AArch64::MSRpstate, DL, MVT::Other,
2208
- CurDAG->getTargetConstant (Reg, DL, MVT::i32 ),
2209
- CurDAG->getTargetConstant (Immed, DL, MVT::i16 ),
2210
- N->getOperand (0 ));
2211
- }
2212
-
2213
- // Use the sysreg mapper to attempt to map the remaining possible strings
2214
- // to the value for the register to be used for the MSR (register)
2215
- // instruction operand.
2216
- AArch64SysReg::MSRMapper Mapper;
2217
- Reg = Mapper.fromString (RegString->getString (),
2218
- Subtarget->getFeatureBits (),
2219
- IsValidSpecialReg);
2220
-
2221
- if (IsValidSpecialReg)
2222
- return CurDAG->getMachineNode (AArch64::MSR, DL, MVT::Other,
2223
- CurDAG->getTargetConstant (Reg, DL, MVT::i32 ),
2224
- N->getOperand (2 ), N->getOperand (0 ));
2225
-
2226
- return nullptr ;
2227
- }
2228
-
2229
2117
SDNode *AArch64DAGToDAGISel::Select (SDNode *Node) {
2230
2118
// Dump information about the Node being selected
2231
2119
DEBUG (errs () << " Selecting: " );
@@ -2247,16 +2135,6 @@ SDNode *AArch64DAGToDAGISel::Select(SDNode *Node) {
2247
2135
default :
2248
2136
break ;
2249
2137
2250
- case ISD::READ_REGISTER:
2251
- if (SDNode *Res = SelectReadRegister (Node))
2252
- return Res;
2253
- break ;
2254
-
2255
- case ISD::WRITE_REGISTER:
2256
- if (SDNode *Res = SelectWriteRegister (Node))
2257
- return Res;
2258
- break ;
2259
-
2260
2138
case ISD::ADD:
2261
2139
if (SDNode *I = SelectMLAV64LaneV128 (Node))
2262
2140
return I;
0 commit comments