@@ -212,7 +212,7 @@ class InstructionEncoding {
212212
213213private:
214214 void parseVarLenEncoding (const VarLenInst &VLI);
215- void parseFixedLenEncoding (const BitsInit &Bits );
215+ void parseFixedLenEncoding (const BitsInit &RecordInstBits );
216216
217217 void parseVarLenOperands (const VarLenInst &VLI);
218218 void parseFixedLenOperands (const BitsInit &Bits);
@@ -1787,46 +1787,46 @@ void InstructionEncoding::parseVarLenEncoding(const VarLenInst &VLI) {
17871787 assert (I == VLI.size ());
17881788}
17891789
1790- void InstructionEncoding::parseFixedLenEncoding (const BitsInit &InstBits) {
1790+ void InstructionEncoding::parseFixedLenEncoding (
1791+ const BitsInit &RecordInstBits) {
17911792 // For fixed length instructions, sometimes the `Inst` field specifies more
17921793 // bits than the actual size of the instruction, which is specified in `Size`.
17931794 // In such cases, we do some basic validation and drop the upper bits.
17941795 unsigned BitWidth = EncodingDef->getValueAsInt (" Size" ) * 8 ;
1795- unsigned InstNumBits = InstBits .getNumBits ();
1796+ unsigned InstNumBits = RecordInstBits .getNumBits ();
17961797
17971798 // Returns true if all bits in `Bits` are zero or unset.
1798- auto CheckAllZeroOrUnset = [&](ArrayRef<const Init *> Bits, const RecordVal *Field) {
1799+ auto CheckAllZeroOrUnset = [&](ArrayRef<const Init *> Bits,
1800+ const RecordVal *Field) {
17991801 bool AllZeroOrUnset = llvm::all_of (Bits, [](const Init *Bit) {
18001802 if (const auto *BI = dyn_cast<BitInit>(Bit))
18011803 return !BI->getValue ();
18021804 return isa<UnsetInit>(Bit);
18031805 });
18041806 if (AllZeroOrUnset)
18051807 return ;
1806- PrintNote ([Field](raw_ostream &OS) {
1807- Field->print (OS);
1808- });
1809- PrintFatalError (
1810- EncodingDef,
1811- Twine (Name) + " : Size is " + Twine (BitWidth) +
1812- " bits, but " + Field->getName () + " bits beyond that are not zero/unset" );
1808+ PrintNote ([Field](raw_ostream &OS) { Field->print (OS); });
1809+ PrintFatalError (EncodingDef, Twine (Name) + " : Size is " + Twine (BitWidth) +
1810+ " bits, but " + Field->getName () +
1811+ " bits beyond that are not zero/unset" );
18131812 };
18141813
18151814 if (InstNumBits < BitWidth)
1816- PrintFatalError (EncodingDef, Twine (Name) + " : Size is " +
1817- Twine (BitWidth) +
1818- " bits, but Inst specifies only " +
1819- Twine (InstNumBits) + " bits" );
1815+ PrintFatalError (EncodingDef, Twine (Name) + " : Size is " + Twine (BitWidth) +
1816+ " bits, but Inst specifies only " +
1817+ Twine (InstNumBits) + " bits" );
18201818
18211819 if (InstNumBits > BitWidth) {
18221820 // Ensure that all the bits beyond 'Size' are 0 or unset (i.e., carry no
18231821 // actual encoding).
1824- ArrayRef<const Init *> UpperBits = InstBits.getBits ().drop_front (BitWidth);
1822+ ArrayRef<const Init *> UpperBits =
1823+ RecordInstBits.getBits ().drop_front (BitWidth);
18251824 const RecordVal *InstField = EncodingDef->getValue (" Inst" );
18261825 CheckAllZeroOrUnset (UpperBits, InstField);
18271826 }
18281827
1829- ArrayRef<const Init *> ActiveInstBits = InstBits.getBits ().take_front (BitWidth);
1828+ ArrayRef<const Init *> ActiveInstBits =
1829+ RecordInstBits.getBits ().take_front (BitWidth);
18301830 InstBits = KnownBits (BitWidth);
18311831 SoftFailBits = APInt (BitWidth, 0 );
18321832
@@ -1846,12 +1846,12 @@ void InstructionEncoding::parseFixedLenEncoding(const BitsInit &InstBits) {
18461846 return ;
18471847
18481848 const auto *SFBits = dyn_cast<BitsInit>(SoftFailField->getValue ());
1849- if (!SFBits || SFBits->getNumBits () != Bits. getNumBits () ) {
1849+ if (!SFBits || SFBits->getNumBits () != InstNumBits ) {
18501850 PrintNote (EncodingDef->getLoc (), " in record" );
18511851 PrintFatalError (SoftFailField,
18521852 formatv (" SoftFail field, if defined, must be "
18531853 " of the same type as Inst, which is bits<{}>" ,
1854- Bits. getNumBits () ));
1854+ InstNumBits ));
18551855 }
18561856
18571857 if (InstNumBits > BitWidth) {
@@ -1866,9 +1866,9 @@ void InstructionEncoding::parseFixedLenEncoding(const BitsInit &InstBits) {
18661866 if (!InstBits.Zero [I] && !InstBits.One [I]) {
18671867 PrintNote (EncodingDef->getLoc (), " in record" );
18681868 PrintError (SoftFailField,
1869- formatv (" SoftFail{{{0}} = 1 requires Inst{{{0}} "
1870- " to be fully defined (0 or 1, not '?')" ,
1871- I));
1869+ formatv (" SoftFail{{{0}} = 1 requires Inst{{{0}} "
1870+ " to be fully defined (0 or 1, not '?')" ,
1871+ I));
18721872 }
18731873 SoftFailBits.setBit (I);
18741874 }
0 commit comments