@@ -129,9 +129,11 @@ class CodeGenFormat {
129129 void run (raw_ostream &o);
130130
131131 static unsigned getVariableBits (const std::string &VarName,
132- const BitsInit *BI, unsigned posBit );
132+ const BitsInit *BI, unsigned BitPos );
133133 static unsigned getFixedBits (std::string &OutChunck, const BitsInit *BI,
134- unsigned posBit);
134+ unsigned BitPos);
135+ static void computeSlotSets (TGTargetSlots &Slots,
136+ std::vector<TGInstrLayout> &InstFormats);
135137};
136138
137139// / Main class abstracting a CodeGenInstruction (CGI).
@@ -269,13 +271,28 @@ class TGTargetSlot {
269271 std::string SlotName;
270272 // The namespace of the current instruction
271273 std::string Namespace;
272- // primarely used when emitting the C++ enumeration constant
274+ // primarily used when emitting the C++ enumeration constant
273275 std::string EnumerationString;
274276 // Name of the field to find in the hierarchy
275277 std::string FieldToFind;
278+ // Artificial slots should not be considered for resource estimates
279+ bool Artificial = false ;
276280 // Unique number attributed (in the pool) for the slot.
277281 // It is used to generate a unique "SlotSet".
278282 int NumSlot;
283+
284+ // The Slot bits for this slot. These are the pristine bits that correspond
285+ // to the slots a format accommodates.
286+ uint64_t SlotBits = 0 ;
287+
288+ // The conflict bits for this slot. These are used to prevent format table
289+ // searches as much as possible. It normally duplicates the SlotBit, since
290+ // that is a trivial conflict.
291+ // However, there may be more bits set. For example, XM conflicts with
292+ // XM, X and M.
293+ // Note that the scoreboard runs on these conflict bits.
294+ uint64_t ConflictBits;
295+
279296 // Size of the Slot, in bits.
280297 // The storage of the size is made using an integer value as the size could
281298 // be negative. In this case, the slot pool (TGTargetSlots) will consider
@@ -296,6 +313,7 @@ class TGTargetSlot {
296313 SlotName(SlotRecord->getValueAsString (" SlotName" )),
297314 Namespace(SlotRecord->getValueAsString (" Namespace" )),
298315 FieldToFind(SlotRecord->getValueAsString (" FieldToFind" )),
316+ Artificial(SlotRecord->getValueAsBit (" Artificial" )),
299317 // NumSlot is defined as -1 for now.
300318 // When the pool of slots will be finalized, then the final ID will be
301319 // attributed.
@@ -349,12 +367,21 @@ class TGTargetSlot {
349367 const std::string &getLabelToFind () const { return FieldToFind; }
350368
351369 unsigned getSlotSize () const { return static_cast <unsigned >(SlotSize); }
370+ uint64_t getSlotBits () const { return SlotBits; }
371+ uint64_t getConflictBits () const { return ConflictBits; }
352372
353373 const std::string &getEnumerationString () const { return EnumerationString; }
354374 bool isDefaultSlot () const { return IsDefaultSlot; }
375+ bool isArtificial () const { return Artificial; }
376+ void setConflictBits (uint64_t Bits) { ConflictBits = Bits; }
355377
356378private:
357- void setNumSlot (int SlotID) { NumSlot = SlotID; }
379+ void setNumSlot (int SlotID) {
380+ NumSlot = SlotID;
381+ const uint64_t Base = 1 ;
382+ SlotBits = Base << SlotID;
383+ }
384+
358385 void setNopInst (const std::string &NOPName) { NOPInstrName = NOPName; }
359386};
360387
@@ -393,6 +420,8 @@ class TGTargetSlots {
393420 // / Add the Slot (if legal) in the Slot pool
394421 bool addSlot (const Record *const R);
395422
423+ RecordSlot &getSlot (unsigned N) { return Slots[N]; }
424+
396425 // / This method performs a finalization of the slot pool. This finalization
397426 // / is composed of 2 stages: the attribution of a unique ID for each slot and
398427 // / then the sorting of the internal container based on their ID, in order to
0 commit comments