@@ -155,21 +155,8 @@ class InstructionEncoding {
155
155
SmallVector<OperandInfo, 16 > Operands;
156
156
157
157
public:
158
- InstructionEncoding (const Record *EncodingDef, const CodeGenInstruction *Inst)
159
- : EncodingDef(EncodingDef), Inst(Inst) {
160
- const Record *InstDef = Inst->TheDef ;
161
-
162
- // Give this encoding a name.
163
- if (EncodingDef != InstDef)
164
- Name = (EncodingDef->getName () + Twine (' :' )).str ();
165
- Name.append (InstDef->getName ());
166
-
167
- DecoderMethod = EncodingDef->getValueAsString (" DecoderMethod" );
168
- if (!DecoderMethod.empty ())
169
- HasCompleteDecoder = EncodingDef->getValueAsBit (" hasCompleteDecoder" );
170
-
171
- populateEncoding ();
172
- }
158
+ InstructionEncoding (const Record *EncodingDef,
159
+ const CodeGenInstruction *Inst);
173
160
174
161
// / Returns the Record this encoding originates from.
175
162
const Record *getRecord () const { return EncodingDef; }
@@ -197,9 +184,8 @@ class InstructionEncoding {
197
184
ArrayRef<OperandInfo> getOperands () const { return Operands; }
198
185
199
186
private:
200
- void populateVarLenEncoding (const VarLenInst &VLI);
201
- void populateFixedLenEncoding (const BitsInit &Bits);
202
- void populateEncoding ();
187
+ void parseVarLenOperands (const VarLenInst &VLI);
188
+ void parseFixedLenOperands (const BitsInit &Bits);
203
189
};
204
190
205
191
typedef std::vector<uint32_t > FixupList;
@@ -1899,7 +1885,7 @@ OperandInfo getOpInfo(const Record *TypeRecord) {
1899
1885
return OperandInfo (findOperandDecoderMethod (TypeRecord), HasCompleteDecoder);
1900
1886
}
1901
1887
1902
- void InstructionEncoding::populateVarLenEncoding (const VarLenInst &VLI) {
1888
+ void InstructionEncoding::parseVarLenOperands (const VarLenInst &VLI) {
1903
1889
SmallVector<int > TiedTo;
1904
1890
1905
1891
for (const auto &[Idx, Op] : enumerate(Inst->Operands )) {
@@ -1996,7 +1982,7 @@ static void addOneOperandFields(const Record *EncodingDef, const BitsInit &Bits,
1996
1982
}
1997
1983
}
1998
1984
1999
- void InstructionEncoding::populateFixedLenEncoding (const BitsInit &Bits) {
1985
+ void InstructionEncoding::parseFixedLenOperands (const BitsInit &Bits) {
2000
1986
const Record &Def = *Inst->TheDef ;
2001
1987
2002
1988
// Gather the outputs/inputs of the instruction, so we can find their
@@ -2110,20 +2096,33 @@ void InstructionEncoding::populateFixedLenEncoding(const BitsInit &Bits) {
2110
2096
}
2111
2097
}
2112
2098
2113
- void InstructionEncoding::populateEncoding () {
2099
+ InstructionEncoding::InstructionEncoding (const Record *EncodingDef,
2100
+ const CodeGenInstruction *Inst)
2101
+ : EncodingDef(EncodingDef), Inst(Inst) {
2102
+ const Record *InstDef = Inst->TheDef ;
2103
+
2104
+ // Give this encoding a name.
2105
+ if (EncodingDef != InstDef)
2106
+ Name = (EncodingDef->getName () + Twine (' :' )).str ();
2107
+ Name.append (InstDef->getName ());
2108
+
2109
+ DecoderMethod = EncodingDef->getValueAsString (" DecoderMethod" );
2110
+ if (!DecoderMethod.empty ())
2111
+ HasCompleteDecoder = EncodingDef->getValueAsBit (" hasCompleteDecoder" );
2112
+
2114
2113
const RecordVal *InstField = EncodingDef->getValue (" Inst" );
2115
2114
if (const auto *DI = dyn_cast<DagInit>(InstField->getValue ())) {
2116
2115
VarLenInst VLI (DI, InstField);
2117
2116
BitWidth = VLI.size ();
2118
2117
// If the encoding has a custom decoder, don't bother parsing the operands.
2119
2118
if (DecoderMethod.empty ())
2120
- populateVarLenEncoding (VLI);
2119
+ parseVarLenOperands (VLI);
2121
2120
} else {
2122
2121
const auto *BI = cast<BitsInit>(InstField->getValue ());
2123
2122
BitWidth = BI->getNumBits ();
2124
2123
// If the encoding has a custom decoder, don't bother parsing the operands.
2125
2124
if (DecoderMethod.empty ())
2126
- populateFixedLenEncoding (*BI);
2125
+ parseFixedLenOperands (*BI);
2127
2126
}
2128
2127
}
2129
2128
0 commit comments