@@ -163,7 +163,7 @@ class InstructionEncoding {
163
163
164
164
// / Mask of bits that should be considered unknown during decoding.
165
165
// / This is the value of the `SoftFail` field.
166
- APInt SoftFailBits ;
166
+ APInt SoftFailMask ;
167
167
168
168
// / The name of the function to use for decoding. May be an empty string,
169
169
// / meaning the decoder is generated.
@@ -197,16 +197,16 @@ class InstructionEncoding {
197
197
const KnownBits &getInstBits () const { return InstBits; }
198
198
199
199
// / Returns a mask of bits that should be considered unknown during decoding.
200
- const APInt &getSoftFailBits () const { return SoftFailBits ; }
200
+ const APInt &getSoftFailMask () const { return SoftFailMask ; }
201
201
202
202
// / Returns the known bits of this encoding that must match for
203
203
// / successful decoding.
204
204
KnownBits getMandatoryBits () const {
205
205
KnownBits EncodingBits = InstBits;
206
206
// Mark all bits that are allowed to change according to SoftFail mask
207
207
// as unknown.
208
- EncodingBits.Zero &= ~SoftFailBits ;
209
- EncodingBits.One &= ~SoftFailBits ;
208
+ EncodingBits.Zero &= ~SoftFailMask ;
209
+ EncodingBits.One &= ~SoftFailMask ;
210
210
return EncodingBits;
211
211
}
212
212
@@ -1243,32 +1243,13 @@ void DecoderTableBuilder::emitPredicateTableEntry(unsigned EncodingID) const {
1243
1243
void DecoderTableBuilder::emitSoftFailTableEntry (unsigned EncodingID) const {
1244
1244
const InstructionEncoding &Encoding = Encodings[EncodingID];
1245
1245
const KnownBits &InstBits = Encoding.getInstBits ();
1246
- const APInt &SFBits = Encoding.getSoftFailBits ();
1246
+ const APInt &SoftFailMask = Encoding.getSoftFailMask ();
1247
1247
1248
- if (SFBits .isZero ())
1248
+ if (SoftFailMask .isZero ())
1249
1249
return ;
1250
1250
1251
- unsigned EncodingWidth = InstBits.getBitWidth ();
1252
- APInt PositiveMask (EncodingWidth, 0 );
1253
- APInt NegativeMask (EncodingWidth, 0 );
1254
- for (unsigned i = 0 ; i != EncodingWidth; ++i) {
1255
- if (!SFBits[i])
1256
- continue ;
1257
-
1258
- if (InstBits.Zero [i]) {
1259
- // The bit is meant to be false, so emit a check to see if it is true.
1260
- PositiveMask.setBit (i);
1261
- } else if (InstBits.One [i]) {
1262
- // The bit is meant to be true, so emit a check to see if it is false.
1263
- NegativeMask.setBit (i);
1264
- }
1265
- }
1266
-
1267
- bool NeedPositiveMask = PositiveMask.getBoolValue ();
1268
- bool NeedNegativeMask = NegativeMask.getBoolValue ();
1269
-
1270
- if (!NeedPositiveMask && !NeedNegativeMask)
1271
- return ;
1251
+ APInt PositiveMask = InstBits.Zero & SoftFailMask;
1252
+ APInt NegativeMask = InstBits.One & SoftFailMask;
1272
1253
1273
1254
TableInfo.Table .insertOpcode (MCD::OPC_SoftFail);
1274
1255
TableInfo.Table .insertULEB128 (PositiveMask.getZExtValue ());
@@ -1737,7 +1718,7 @@ OperandInfo getOpInfo(const Record *TypeRecord) {
1737
1718
1738
1719
void InstructionEncoding::parseVarLenEncoding (const VarLenInst &VLI) {
1739
1720
InstBits = KnownBits (VLI.size ());
1740
- SoftFailBits = APInt (VLI.size (), 0 );
1721
+ SoftFailMask = APInt (VLI.size (), 0 );
1741
1722
1742
1723
// Parse Inst field.
1743
1724
unsigned I = 0 ;
@@ -1806,7 +1787,7 @@ void InstructionEncoding::parseFixedLenEncoding(
1806
1787
ArrayRef<const Init *> ActiveInstBits =
1807
1788
RecordInstBits.getBits ().take_front (BitWidth);
1808
1789
InstBits = KnownBits (BitWidth);
1809
- SoftFailBits = APInt (BitWidth, 0 );
1790
+ SoftFailMask = APInt (BitWidth, 0 );
1810
1791
1811
1792
// Parse Inst field.
1812
1793
for (auto [I, V] : enumerate(ActiveInstBits)) {
@@ -1848,7 +1829,7 @@ void InstructionEncoding::parseFixedLenEncoding(
1848
1829
" to be fully defined (0 or 1, not '?')" ,
1849
1830
I));
1850
1831
}
1851
- SoftFailBits .setBit (I);
1832
+ SoftFailMask .setBit (I);
1852
1833
}
1853
1834
}
1854
1835
}
0 commit comments