@@ -163,7 +163,7 @@ class InstructionEncoding {
163163
164164 // / Mask of bits that should be considered unknown during decoding.
165165 // / This is the value of the `SoftFail` field.
166- APInt SoftFailBits ;
166+ APInt SoftFailMask ;
167167
168168 // / The name of the function to use for decoding. May be an empty string,
169169 // / meaning the decoder is generated.
@@ -197,16 +197,16 @@ class InstructionEncoding {
197197 const KnownBits &getInstBits () const { return InstBits; }
198198
199199 // / 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 ; }
201201
202202 // / Returns the known bits of this encoding that must match for
203203 // / successful decoding.
204204 KnownBits getMandatoryBits () const {
205205 KnownBits EncodingBits = InstBits;
206206 // Mark all bits that are allowed to change according to SoftFail mask
207207 // as unknown.
208- EncodingBits.Zero &= ~SoftFailBits ;
209- EncodingBits.One &= ~SoftFailBits ;
208+ EncodingBits.Zero &= ~SoftFailMask ;
209+ EncodingBits.One &= ~SoftFailMask ;
210210 return EncodingBits;
211211 }
212212
@@ -1243,32 +1243,13 @@ void DecoderTableBuilder::emitPredicateTableEntry(unsigned EncodingID) const {
12431243void DecoderTableBuilder::emitSoftFailTableEntry (unsigned EncodingID) const {
12441244 const InstructionEncoding &Encoding = Encodings[EncodingID];
12451245 const KnownBits &InstBits = Encoding.getInstBits ();
1246- const APInt &SFBits = Encoding.getSoftFailBits ();
1246+ const APInt &SoftFailMask = Encoding.getSoftFailMask ();
12471247
1248- if (SFBits .isZero ())
1248+ if (SoftFailMask .isZero ())
12491249 return ;
12501250
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;
12721253
12731254 TableInfo.Table .insertOpcode (MCD::OPC_SoftFail);
12741255 TableInfo.Table .insertULEB128 (PositiveMask.getZExtValue ());
@@ -1737,7 +1718,7 @@ OperandInfo getOpInfo(const Record *TypeRecord) {
17371718
17381719void InstructionEncoding::parseVarLenEncoding (const VarLenInst &VLI) {
17391720 InstBits = KnownBits (VLI.size ());
1740- SoftFailBits = APInt (VLI.size (), 0 );
1721+ SoftFailMask = APInt (VLI.size (), 0 );
17411722
17421723 // Parse Inst field.
17431724 unsigned I = 0 ;
@@ -1806,7 +1787,7 @@ void InstructionEncoding::parseFixedLenEncoding(
18061787 ArrayRef<const Init *> ActiveInstBits =
18071788 RecordInstBits.getBits ().take_front (BitWidth);
18081789 InstBits = KnownBits (BitWidth);
1809- SoftFailBits = APInt (BitWidth, 0 );
1790+ SoftFailMask = APInt (BitWidth, 0 );
18101791
18111792 // Parse Inst field.
18121793 for (auto [I, V] : enumerate(ActiveInstBits)) {
@@ -1848,7 +1829,7 @@ void InstructionEncoding::parseFixedLenEncoding(
18481829 " to be fully defined (0 or 1, not '?')" ,
18491830 I));
18501831 }
1851- SoftFailBits .setBit (I);
1832+ SoftFailMask .setBit (I);
18521833 }
18531834 }
18541835}
0 commit comments