LLVM  17.0.0git
Record.h
Go to the documentation of this file.
1 //===- llvm/TableGen/Record.h - Classes for Table Records -------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the main TableGen data structures, including the TableGen
10 // types, values, and high-level data structures.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TABLEGEN_RECORD_H
15 #define LLVM_TABLEGEN_RECORD_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/DenseSet.h"
20 #include "llvm/ADT/FoldingSet.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringExtras.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/Support/Casting.h"
27 #include "llvm/Support/SMLoc.h"
28 #include "llvm/Support/Timer.h"
31 #include <cassert>
32 #include <cstddef>
33 #include <cstdint>
34 #include <map>
35 #include <memory>
36 #include <optional>
37 #include <string>
38 #include <utility>
39 #include <vector>
40 
41 namespace llvm {
42 namespace detail {
43 struct RecordKeeperImpl;
44 } // namespace detail
45 
46 class ListRecTy;
47 class Record;
48 class RecordKeeper;
49 class RecordVal;
50 class Resolver;
51 class StringInit;
52 class TypedInit;
53 
54 //===----------------------------------------------------------------------===//
55 // Type Classes
56 //===----------------------------------------------------------------------===//
57 
58 class RecTy {
59 public:
60  /// Subclass discriminator (for dyn_cast<> et al.)
61  enum RecTyKind {
69  };
70 
71 private:
72  RecTyKind Kind;
73  /// The RecordKeeper that uniqued this Type.
74  RecordKeeper &RK;
75  /// ListRecTy of the list that has elements of this type.
76  ListRecTy *ListTy = nullptr;
77 
78 public:
79  RecTy(RecTyKind K, RecordKeeper &RK) : Kind(K), RK(RK) {}
80  virtual ~RecTy() = default;
81 
82  RecTyKind getRecTyKind() const { return Kind; }
83 
84  /// Return the RecordKeeper that uniqued this Type.
85  RecordKeeper &getRecordKeeper() const { return RK; }
86 
87  virtual std::string getAsString() const = 0;
88  void print(raw_ostream &OS) const { OS << getAsString(); }
89  void dump() const;
90 
91  /// Return true if all values of 'this' type can be converted to the specified
92  /// type.
93  virtual bool typeIsConvertibleTo(const RecTy *RHS) const;
94 
95  /// Return true if 'this' type is equal to or a subtype of RHS. For example,
96  /// a bit set is not an int, but they are convertible.
97  virtual bool typeIsA(const RecTy *RHS) const;
98 
99  /// Returns the type representing list<thistype>.
100  ListRecTy *getListTy();
101 };
102 
103 inline raw_ostream &operator<<(raw_ostream &OS, const RecTy &Ty) {
104  Ty.print(OS);
105  return OS;
106 }
107 
108 /// 'bit' - Represent a single bit
109 class BitRecTy : public RecTy {
111 
112  BitRecTy(RecordKeeper &RK) : RecTy(BitRecTyKind, RK) {}
113 
114 public:
115  static bool classof(const RecTy *RT) {
116  return RT->getRecTyKind() == BitRecTyKind;
117  }
118 
119  static BitRecTy *get(RecordKeeper &RK);
120 
121  std::string getAsString() const override { return "bit"; }
122 
123  bool typeIsConvertibleTo(const RecTy *RHS) const override;
124 };
125 
126 /// 'bits<n>' - Represent a fixed number of bits
127 class BitsRecTy : public RecTy {
128  unsigned Size;
129 
130  explicit BitsRecTy(RecordKeeper &RK, unsigned Sz)
131  : RecTy(BitsRecTyKind, RK), Size(Sz) {}
132 
133 public:
134  static bool classof(const RecTy *RT) {
135  return RT->getRecTyKind() == BitsRecTyKind;
136  }
137 
138  static BitsRecTy *get(RecordKeeper &RK, unsigned Sz);
139 
140  unsigned getNumBits() const { return Size; }
141 
142  std::string getAsString() const override;
143 
144  bool typeIsConvertibleTo(const RecTy *RHS) const override;
145 
146  bool typeIsA(const RecTy *RHS) const override;
147 };
148 
149 /// 'int' - Represent an integer value of no particular size
150 class IntRecTy : public RecTy {
152 
153  IntRecTy(RecordKeeper &RK) : RecTy(IntRecTyKind, RK) {}
154 
155 public:
156  static bool classof(const RecTy *RT) {
157  return RT->getRecTyKind() == IntRecTyKind;
158  }
159 
160  static IntRecTy *get(RecordKeeper &RK);
161 
162  std::string getAsString() const override { return "int"; }
163 
164  bool typeIsConvertibleTo(const RecTy *RHS) const override;
165 };
166 
167 /// 'string' - Represent an string value
168 class StringRecTy : public RecTy {
170 
172 
173 public:
174  static bool classof(const RecTy *RT) {
175  return RT->getRecTyKind() == StringRecTyKind;
176  }
177 
178  static StringRecTy *get(RecordKeeper &RK);
179 
180  std::string getAsString() const override;
181 
182  bool typeIsConvertibleTo(const RecTy *RHS) const override;
183 };
184 
185 /// 'list<Ty>' - Represent a list of element values, all of which must be of
186 /// the specified type. The type is stored in ElementTy.
187 class ListRecTy : public RecTy {
188  friend ListRecTy *RecTy::getListTy();
189 
190  RecTy *ElementTy;
191 
192  explicit ListRecTy(RecTy *T)
193  : RecTy(ListRecTyKind, T->getRecordKeeper()), ElementTy(T) {}
194 
195 public:
196  static bool classof(const RecTy *RT) {
197  return RT->getRecTyKind() == ListRecTyKind;
198  }
199 
200  static ListRecTy *get(RecTy *T) { return T->getListTy(); }
201  RecTy *getElementType() const { return ElementTy; }
202 
203  std::string getAsString() const override;
204 
205  bool typeIsConvertibleTo(const RecTy *RHS) const override;
206 
207  bool typeIsA(const RecTy *RHS) const override;
208 };
209 
210 /// 'dag' - Represent a dag fragment
211 class DagRecTy : public RecTy {
213 
214  DagRecTy(RecordKeeper &RK) : RecTy(DagRecTyKind, RK) {}
215 
216 public:
217  static bool classof(const RecTy *RT) {
218  return RT->getRecTyKind() == DagRecTyKind;
219  }
220 
221  static DagRecTy *get(RecordKeeper &RK);
222 
223  std::string getAsString() const override;
224 };
225 
226 /// '[classname]' - Type of record values that have zero or more superclasses.
227 ///
228 /// The list of superclasses is non-redundant, i.e. only contains classes that
229 /// are not the superclass of some other listed class.
230 class RecordRecTy final : public RecTy, public FoldingSetNode,
231  public TrailingObjects<RecordRecTy, Record *> {
232  friend class Record;
234 
235  unsigned NumClasses;
236 
237  explicit RecordRecTy(RecordKeeper &RK, unsigned Num)
238  : RecTy(RecordRecTyKind, RK), NumClasses(Num) {}
239 
240 public:
241  RecordRecTy(const RecordRecTy &) = delete;
242  RecordRecTy &operator=(const RecordRecTy &) = delete;
243 
244  // Do not use sized deallocation due to trailing objects.
245  void operator delete(void *p) { ::operator delete(p); }
246 
247  static bool classof(const RecTy *RT) {
248  return RT->getRecTyKind() == RecordRecTyKind;
249  }
250 
251  /// Get the record type with the given non-redundant list of superclasses.
252  static RecordRecTy *get(RecordKeeper &RK, ArrayRef<Record *> Classes);
253  static RecordRecTy *get(Record *Class);
254 
255  void Profile(FoldingSetNodeID &ID) const;
256 
258  return ArrayRef(getTrailingObjects<Record *>(), NumClasses);
259  }
260 
261  using const_record_iterator = Record * const *;
262 
263  const_record_iterator classes_begin() const { return getClasses().begin(); }
264  const_record_iterator classes_end() const { return getClasses().end(); }
265 
266  std::string getAsString() const override;
267 
268  bool isSubClassOf(Record *Class) const;
269  bool typeIsConvertibleTo(const RecTy *RHS) const override;
270 
271  bool typeIsA(const RecTy *RHS) const override;
272 };
273 
274 /// Find a common type that T1 and T2 convert to.
275 /// Return 0 if no such type exists.
276 RecTy *resolveTypes(RecTy *T1, RecTy *T2);
277 
278 //===----------------------------------------------------------------------===//
279 // Initializer Classes
280 //===----------------------------------------------------------------------===//
281 
282 class Init {
283 protected:
284  /// Discriminator enum (for isa<>, dyn_cast<>, et al.)
285  ///
286  /// This enum is laid out by a preorder traversal of the inheritance
287  /// hierarchy, and does not contain an entry for abstract classes, as per
288  /// the recommendation in docs/HowToSetUpLLVMStyleRTTI.rst.
289  ///
290  /// We also explicitly include "first" and "last" values for each
291  /// interior node of the inheritance tree, to make it easier to read the
292  /// corresponding classof().
293  ///
294  /// We could pack these a bit tighter by not having the IK_FirstXXXInit
295  /// and IK_LastXXXInit be their own values, but that would degrade
296  /// readability for really no benefit.
297  enum InitKind : uint8_t {
298  IK_First, // unused; silence a spurious warning
324  };
325 
326 private:
327  const InitKind Kind;
328 
329 protected:
330  uint8_t Opc; // Used by UnOpInit, BinOpInit, and TernOpInit
331 
332 private:
333  virtual void anchor();
334 
335 public:
336  /// Get the kind (type) of the value.
337  InitKind getKind() const { return Kind; }
338 
339  /// Get the record keeper that initialized this Init.
340  RecordKeeper &getRecordKeeper() const;
341 
342 protected:
343  explicit Init(InitKind K, uint8_t Opc = 0) : Kind(K), Opc(Opc) {}
344 
345 public:
346  Init(const Init &) = delete;
347  Init &operator=(const Init &) = delete;
348  virtual ~Init() = default;
349 
350  /// Is this a complete value with no unset (uninitialized) subvalues?
351  virtual bool isComplete() const { return true; }
352 
353  /// Is this a concrete and fully resolved value without any references or
354  /// stuck operations? Unset values are concrete.
355  virtual bool isConcrete() const { return false; }
356 
357  /// Print this value.
358  void print(raw_ostream &OS) const { OS << getAsString(); }
359 
360  /// Convert this value to a literal form.
361  virtual std::string getAsString() const = 0;
362 
363  /// Convert this value to a literal form,
364  /// without adding quotes around a string.
365  virtual std::string getAsUnquotedString() const { return getAsString(); }
366 
367  /// Debugging method that may be called through a debugger; just
368  /// invokes print on stderr.
369  void dump() const;
370 
371  /// If this value is convertible to type \p Ty, return a value whose
372  /// type is \p Ty, generating a !cast operation if required.
373  /// Otherwise, return null.
374  virtual Init *getCastTo(RecTy *Ty) const = 0;
375 
376  /// Convert to a value whose type is \p Ty, or return null if this
377  /// is not possible. This can happen if the value's type is convertible
378  /// to \p Ty, but there are unresolved references.
379  virtual Init *convertInitializerTo(RecTy *Ty) const = 0;
380 
381  /// This function is used to implement the bit range
382  /// selection operator. Given a value, it selects the specified bits,
383  /// returning them as a new \p Init of type \p bits. If it is not legal
384  /// to use the bit selection operator on this value, null is returned.
386  return nullptr;
387  }
388 
389  /// This function is used to implement the list slice
390  /// selection operator. Given a value, it selects the specified list
391  /// elements, returning them as a new \p Init of type \p list. If it
392  /// is not legal to use the slice operator, null is returned.
393  virtual Init *convertInitListSlice(ArrayRef<unsigned> Elements) const {
394  return nullptr;
395  }
396 
397  /// This function is used to implement the FieldInit class.
398  /// Implementors of this method should return the type of the named
399  /// field if they are of type record.
400  virtual RecTy *getFieldType(StringInit *FieldName) const {
401  return nullptr;
402  }
403 
404  /// This function is used by classes that refer to other
405  /// variables which may not be defined at the time the expression is formed.
406  /// If a value is set for the variable later, this method will be called on
407  /// users of the value to allow the value to propagate out.
408  virtual Init *resolveReferences(Resolver &R) const {
409  return const_cast<Init *>(this);
410  }
411 
412  /// Get the \p Init value of the specified bit.
413  virtual Init *getBit(unsigned Bit) const = 0;
414 };
415 
416 inline raw_ostream &operator<<(raw_ostream &OS, const Init &I) {
417  I.print(OS); return OS;
418 }
419 
420 /// This is the common superclass of types that have a specific,
421 /// explicit type, stored in ValueTy.
422 class TypedInit : public Init {
423  RecTy *ValueTy;
424 
425 protected:
426  explicit TypedInit(InitKind K, RecTy *T, uint8_t Opc = 0)
427  : Init(K, Opc), ValueTy(T) {}
428 
429 public:
430  TypedInit(const TypedInit &) = delete;
431  TypedInit &operator=(const TypedInit &) = delete;
432 
433  static bool classof(const Init *I) {
434  return I->getKind() >= IK_FirstTypedInit &&
435  I->getKind() <= IK_LastTypedInit;
436  }
437 
438  /// Get the type of the Init as a RecTy.
439  RecTy *getType() const { return ValueTy; }
440 
441  /// Get the record keeper that initialized this Init.
442  RecordKeeper &getRecordKeeper() const { return ValueTy->getRecordKeeper(); }
443 
444  Init *getCastTo(RecTy *Ty) const override;
445  Init *convertInitializerTo(RecTy *Ty) const override;
446 
448  Init *convertInitListSlice(ArrayRef<unsigned> Elements) const override;
449 
450  /// This method is used to implement the FieldInit class.
451  /// Implementors of this method should return the type of the named field if
452  /// they are of type record.
453  RecTy *getFieldType(StringInit *FieldName) const override;
454 };
455 
456 /// '?' - Represents an uninitialized value.
457 class UnsetInit : public Init {
459 
460  /// The record keeper that initialized this Init.
461  RecordKeeper &RK;
462 
463  UnsetInit(RecordKeeper &RK) : Init(IK_UnsetInit), RK(RK) {}
464 
465 public:
466  UnsetInit(const UnsetInit &) = delete;
467  UnsetInit &operator=(const UnsetInit &) = delete;
468 
469  static bool classof(const Init *I) {
470  return I->getKind() == IK_UnsetInit;
471  }
472 
473  /// Get the singleton unset Init.
474  static UnsetInit *get(RecordKeeper &RK);
475 
476  /// Get the record keeper that initialized this Init.
477  RecordKeeper &getRecordKeeper() const { return RK; }
478 
479  Init *getCastTo(RecTy *Ty) const override;
480  Init *convertInitializerTo(RecTy *Ty) const override;
481 
482  Init *getBit(unsigned Bit) const override {
483  return const_cast<UnsetInit*>(this);
484  }
485 
486  /// Is this a complete value with no unset (uninitialized) subvalues?
487  bool isComplete() const override { return false; }
488 
489  bool isConcrete() const override { return true; }
490 
491  /// Get the string representation of the Init.
492  std::string getAsString() const override { return "?"; }
493 };
494 
495 /// 'true'/'false' - Represent a concrete initializer for a bit.
496 class BitInit final : public TypedInit {
498 
499  bool Value;
500 
501  explicit BitInit(bool V, RecTy *T) : TypedInit(IK_BitInit, T), Value(V) {}
502 
503 public:
504  BitInit(const BitInit &) = delete;
505  BitInit &operator=(BitInit &) = delete;
506 
507  static bool classof(const Init *I) {
508  return I->getKind() == IK_BitInit;
509  }
510 
511  static BitInit *get(RecordKeeper &RK, bool V);
512 
513  bool getValue() const { return Value; }
514 
515  Init *convertInitializerTo(RecTy *Ty) const override;
516 
517  Init *getBit(unsigned Bit) const override {
518  assert(Bit < 1 && "Bit index out of range!");
519  return const_cast<BitInit*>(this);
520  }
521 
522  bool isConcrete() const override { return true; }
523  std::string getAsString() const override { return Value ? "1" : "0"; }
524 };
525 
526 /// '{ a, b, c }' - Represents an initializer for a BitsRecTy value.
527 /// It contains a vector of bits, whose size is determined by the type.
528 class BitsInit final : public TypedInit, public FoldingSetNode,
529  public TrailingObjects<BitsInit, Init *> {
530  unsigned NumBits;
531 
532  BitsInit(RecordKeeper &RK, unsigned N)
533  : TypedInit(IK_BitsInit, BitsRecTy::get(RK, N)), NumBits(N) {}
534 
535 public:
536  BitsInit(const BitsInit &) = delete;
537  BitsInit &operator=(const BitsInit &) = delete;
538 
539  // Do not use sized deallocation due to trailing objects.
540  void operator delete(void *p) { ::operator delete(p); }
541 
542  static bool classof(const Init *I) {
543  return I->getKind() == IK_BitsInit;
544  }
545 
546  static BitsInit *get(RecordKeeper &RK, ArrayRef<Init *> Range);
547 
548  void Profile(FoldingSetNodeID &ID) const;
549 
550  unsigned getNumBits() const { return NumBits; }
551 
552  Init *convertInitializerTo(RecTy *Ty) const override;
554 
555  bool isComplete() const override {
556  for (unsigned i = 0; i != getNumBits(); ++i)
557  if (!getBit(i)->isComplete()) return false;
558  return true;
559  }
560 
561  bool allInComplete() const {
562  for (unsigned i = 0; i != getNumBits(); ++i)
563  if (getBit(i)->isComplete()) return false;
564  return true;
565  }
566 
567  bool isConcrete() const override;
568  std::string getAsString() const override;
569 
570  Init *resolveReferences(Resolver &R) const override;
571 
572  Init *getBit(unsigned Bit) const override {
573  assert(Bit < NumBits && "Bit index out of range!");
574  return getTrailingObjects<Init *>()[Bit];
575  }
576 };
577 
578 /// '7' - Represent an initialization by a literal integer value.
579 class IntInit : public TypedInit {
580  int64_t Value;
581 
582  explicit IntInit(RecordKeeper &RK, int64_t V)
583  : TypedInit(IK_IntInit, IntRecTy::get(RK)), Value(V) {}
584 
585 public:
586  IntInit(const IntInit &) = delete;
587  IntInit &operator=(const IntInit &) = delete;
588 
589  static bool classof(const Init *I) {
590  return I->getKind() == IK_IntInit;
591  }
592 
593  static IntInit *get(RecordKeeper &RK, int64_t V);
594 
595  int64_t getValue() const { return Value; }
596 
597  Init *convertInitializerTo(RecTy *Ty) const override;
599 
600  bool isConcrete() const override { return true; }
601  std::string getAsString() const override;
602 
603  Init *getBit(unsigned Bit) const override {
604  return BitInit::get(getRecordKeeper(), (Value & (1ULL << Bit)) != 0);
605  }
606 };
607 
608 /// "anonymous_n" - Represent an anonymous record name
609 class AnonymousNameInit : public TypedInit {
610  unsigned Value;
611 
612  explicit AnonymousNameInit(RecordKeeper &RK, unsigned V)
614 
615 public:
616  AnonymousNameInit(const AnonymousNameInit &) = delete;
617  AnonymousNameInit &operator=(const AnonymousNameInit &) = delete;
618 
619  static bool classof(const Init *I) {
620  return I->getKind() == IK_AnonymousNameInit;
621  }
622 
623  static AnonymousNameInit *get(RecordKeeper &RK, unsigned);
624 
625  unsigned getValue() const { return Value; }
626 
627  StringInit *getNameInit() const;
628 
629  std::string getAsString() const override;
630 
631  Init *resolveReferences(Resolver &R) const override;
632 
633  Init *getBit(unsigned Bit) const override {
634  llvm_unreachable("Illegal bit reference off string");
635  }
636 };
637 
638 /// "foo" - Represent an initialization by a string value.
639 class StringInit : public TypedInit {
640 public:
642  SF_String, // Format as "text"
643  SF_Code, // Format as [{text}]
644  };
645 
646 private:
648  StringFormat Format;
649 
650  explicit StringInit(RecordKeeper &RK, StringRef V, StringFormat Fmt)
651  : TypedInit(IK_StringInit, StringRecTy::get(RK)), Value(V), Format(Fmt) {}
652 
653 public:
654  StringInit(const StringInit &) = delete;
655  StringInit &operator=(const StringInit &) = delete;
656 
657  static bool classof(const Init *I) {
658  return I->getKind() == IK_StringInit;
659  }
660 
661  static StringInit *get(RecordKeeper &RK, StringRef,
662  StringFormat Fmt = SF_String);
663 
665  return (Fmt1 == SF_Code || Fmt2 == SF_Code) ? SF_Code : SF_String;
666  }
667 
668  StringRef getValue() const { return Value; }
669  StringFormat getFormat() const { return Format; }
670  bool hasCodeFormat() const { return Format == SF_Code; }
671 
672  Init *convertInitializerTo(RecTy *Ty) const override;
673 
674  bool isConcrete() const override { return true; }
675 
676  std::string getAsString() const override {
677  if (Format == SF_String)
678  return "\"" + Value.str() + "\"";
679  else
680  return "[{" + Value.str() + "}]";
681  }
682 
683  std::string getAsUnquotedString() const override {
684  return std::string(Value);
685  }
686 
687  Init *getBit(unsigned Bit) const override {
688  llvm_unreachable("Illegal bit reference off string");
689  }
690 };
691 
692 /// [AL, AH, CL] - Represent a list of defs
693 ///
694 class ListInit final : public TypedInit, public FoldingSetNode,
695  public TrailingObjects<ListInit, Init *> {
696  unsigned NumValues;
697 
698 public:
699  using const_iterator = Init *const *;
700 
701 private:
702  explicit ListInit(unsigned N, RecTy *EltTy)
703  : TypedInit(IK_ListInit, ListRecTy::get(EltTy)), NumValues(N) {}
704 
705 public:
706  ListInit(const ListInit &) = delete;
707  ListInit &operator=(const ListInit &) = delete;
708 
709  // Do not use sized deallocation due to trailing objects.
710  void operator delete(void *p) { ::operator delete(p); }
711 
712  static bool classof(const Init *I) {
713  return I->getKind() == IK_ListInit;
714  }
715  static ListInit *get(ArrayRef<Init *> Range, RecTy *EltTy);
716 
717  void Profile(FoldingSetNodeID &ID) const;
718 
719  Init *getElement(unsigned i) const {
720  assert(i < NumValues && "List element index out of range!");
721  return getTrailingObjects<Init *>()[i];
722  }
724  return cast<ListRecTy>(getType())->getElementType();
725  }
726 
727  Record *getElementAsRecord(unsigned i) const;
728 
729  Init *convertInitListSlice(ArrayRef<unsigned> Elements) const override;
730 
731  Init *convertInitializerTo(RecTy *Ty) const override;
732 
733  /// This method is used by classes that refer to other
734  /// variables which may not be defined at the time they expression is formed.
735  /// If a value is set for the variable later, this method will be called on
736  /// users of the value to allow the value to propagate out.
737  ///
738  Init *resolveReferences(Resolver &R) const override;
739 
740  bool isComplete() const override;
741  bool isConcrete() const override;
742  std::string getAsString() const override;
743 
745  return ArrayRef(getTrailingObjects<Init *>(), NumValues);
746  }
747 
748  const_iterator begin() const { return getTrailingObjects<Init *>(); }
749  const_iterator end () const { return begin() + NumValues; }
750 
751  size_t size () const { return NumValues; }
752  bool empty() const { return NumValues == 0; }
753 
754  Init *getBit(unsigned Bit) const override {
755  llvm_unreachable("Illegal bit reference off list");
756  }
757 };
758 
759 /// Base class for operators
760 ///
761 class OpInit : public TypedInit {
762 protected:
763  explicit OpInit(InitKind K, RecTy *Type, uint8_t Opc)
764  : TypedInit(K, Type, Opc) {}
765 
766 public:
767  OpInit(const OpInit &) = delete;
768  OpInit &operator=(OpInit &) = delete;
769 
770  static bool classof(const Init *I) {
771  return I->getKind() >= IK_FirstOpInit &&
772  I->getKind() <= IK_LastOpInit;
773  }
774 
775  // Clone - Clone this operator, replacing arguments with the new list
776  virtual OpInit *clone(ArrayRef<Init *> Operands) const = 0;
777 
778  virtual unsigned getNumOperands() const = 0;
779  virtual Init *getOperand(unsigned i) const = 0;
780 
781  Init *getBit(unsigned Bit) const override;
782 };
783 
784 /// !op (X) - Transform an init.
785 ///
786 class UnOpInit : public OpInit, public FoldingSetNode {
787 public:
788  enum UnaryOp : uint8_t { CAST, NOT, HEAD, TAIL, SIZE, EMPTY, GETDAGOP, LOG2 };
789 
790 private:
791  Init *LHS;
792 
793  UnOpInit(UnaryOp opc, Init *lhs, RecTy *Type)
794  : OpInit(IK_UnOpInit, Type, opc), LHS(lhs) {}
795 
796 public:
797  UnOpInit(const UnOpInit &) = delete;
798  UnOpInit &operator=(const UnOpInit &) = delete;
799 
800  static bool classof(const Init *I) {
801  return I->getKind() == IK_UnOpInit;
802  }
803 
804  static UnOpInit *get(UnaryOp opc, Init *lhs, RecTy *Type);
805 
806  void Profile(FoldingSetNodeID &ID) const;
807 
808  // Clone - Clone this operator, replacing arguments with the new list
810  assert(Operands.size() == 1 &&
811  "Wrong number of operands for unary operation");
812  return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
813  }
814 
815  unsigned getNumOperands() const override { return 1; }
816 
817  Init *getOperand(unsigned i) const override {
818  assert(i == 0 && "Invalid operand id for unary operator");
819  return getOperand();
820  }
821 
822  UnaryOp getOpcode() const { return (UnaryOp)Opc; }
823  Init *getOperand() const { return LHS; }
824 
825  // Fold - If possible, fold this to a simpler init. Return this if not
826  // possible to fold.
827  Init *Fold(Record *CurRec, bool IsFinal = false) const;
828 
829  Init *resolveReferences(Resolver &R) const override;
830 
831  std::string getAsString() const override;
832 };
833 
834 /// !op (X, Y) - Combine two inits.
835 class BinOpInit : public OpInit, public FoldingSetNode {
836 public:
837  enum BinaryOp : uint8_t {
843  OR,
854  EQ,
855  NE,
856  LE,
857  LT,
858  GE,
859  GT,
861  };
862 
863 private:
864  Init *LHS, *RHS;
865 
866  BinOpInit(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type) :
867  OpInit(IK_BinOpInit, Type, opc), LHS(lhs), RHS(rhs) {}
868 
869 public:
870  BinOpInit(const BinOpInit &) = delete;
871  BinOpInit &operator=(const BinOpInit &) = delete;
872 
873  static bool classof(const Init *I) {
874  return I->getKind() == IK_BinOpInit;
875  }
876 
877  static BinOpInit *get(BinaryOp opc, Init *lhs, Init *rhs,
878  RecTy *Type);
879  static Init *getStrConcat(Init *lhs, Init *rhs);
880  static Init *getListConcat(TypedInit *lhs, Init *rhs);
881 
882  void Profile(FoldingSetNodeID &ID) const;
883 
884  // Clone - Clone this operator, replacing arguments with the new list
886  assert(Operands.size() == 2 &&
887  "Wrong number of operands for binary operation");
888  return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
889  }
890 
891  unsigned getNumOperands() const override { return 2; }
892  Init *getOperand(unsigned i) const override {
893  switch (i) {
894  default: llvm_unreachable("Invalid operand id for binary operator");
895  case 0: return getLHS();
896  case 1: return getRHS();
897  }
898  }
899 
900  BinaryOp getOpcode() const { return (BinaryOp)Opc; }
901  Init *getLHS() const { return LHS; }
902  Init *getRHS() const { return RHS; }
903 
904  std::optional<bool> CompareInit(unsigned Opc, Init *LHS, Init *RHS) const;
905 
906  // Fold - If possible, fold this to a simpler init. Return this if not
907  // possible to fold.
908  Init *Fold(Record *CurRec) const;
909 
910  Init *resolveReferences(Resolver &R) const override;
911 
912  std::string getAsString() const override;
913 };
914 
915 /// !op (X, Y, Z) - Combine two inits.
916 class TernOpInit : public OpInit, public FoldingSetNode {
917 public:
918  enum TernaryOp : uint8_t { SUBST, FOREACH, FILTER, IF, DAG, SUBSTR, FIND };
919 
920 private:
921  Init *LHS, *MHS, *RHS;
922 
923  TernOpInit(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs,
924  RecTy *Type) :
925  OpInit(IK_TernOpInit, Type, opc), LHS(lhs), MHS(mhs), RHS(rhs) {}
926 
927 public:
928  TernOpInit(const TernOpInit &) = delete;
929  TernOpInit &operator=(const TernOpInit &) = delete;
930 
931  static bool classof(const Init *I) {
932  return I->getKind() == IK_TernOpInit;
933  }
934 
935  static TernOpInit *get(TernaryOp opc, Init *lhs,
936  Init *mhs, Init *rhs,
937  RecTy *Type);
938 
939  void Profile(FoldingSetNodeID &ID) const;
940 
941  // Clone - Clone this operator, replacing arguments with the new list
943  assert(Operands.size() == 3 &&
944  "Wrong number of operands for ternary operation");
945  return TernOpInit::get(getOpcode(), Operands[0], Operands[1], Operands[2],
946  getType());
947  }
948 
949  unsigned getNumOperands() const override { return 3; }
950  Init *getOperand(unsigned i) const override {
951  switch (i) {
952  default: llvm_unreachable("Invalid operand id for ternary operator");
953  case 0: return getLHS();
954  case 1: return getMHS();
955  case 2: return getRHS();
956  }
957  }
958 
959  TernaryOp getOpcode() const { return (TernaryOp)Opc; }
960  Init *getLHS() const { return LHS; }
961  Init *getMHS() const { return MHS; }
962  Init *getRHS() const { return RHS; }
963 
964  // Fold - If possible, fold this to a simpler init. Return this if not
965  // possible to fold.
966  Init *Fold(Record *CurRec) const;
967 
968  bool isComplete() const override {
969  return LHS->isComplete() && MHS->isComplete() && RHS->isComplete();
970  }
971 
972  Init *resolveReferences(Resolver &R) const override;
973 
974  std::string getAsString() const override;
975 };
976 
977 /// !cond(condition_1: value1, ... , condition_n: value)
978 /// Selects the first value for which condition is true.
979 /// Otherwise reports an error.
980 class CondOpInit final : public TypedInit, public FoldingSetNode,
981  public TrailingObjects<CondOpInit, Init *> {
982  unsigned NumConds;
983  RecTy *ValType;
984 
985  CondOpInit(unsigned NC, RecTy *Type)
987  NumConds(NC), ValType(Type) {}
988 
989  size_t numTrailingObjects(OverloadToken<Init *>) const {
990  return 2*NumConds;
991  }
992 
993 public:
994  CondOpInit(const CondOpInit &) = delete;
995  CondOpInit &operator=(const CondOpInit &) = delete;
996 
997  static bool classof(const Init *I) {
998  return I->getKind() == IK_CondOpInit;
999  }
1000 
1002  RecTy *Type);
1003 
1004  void Profile(FoldingSetNodeID &ID) const;
1005 
1006  RecTy *getValType() const { return ValType; }
1007 
1008  unsigned getNumConds() const { return NumConds; }
1009 
1010  Init *getCond(unsigned Num) const {
1011  assert(Num < NumConds && "Condition number out of range!");
1012  return getTrailingObjects<Init *>()[Num];
1013  }
1014 
1015  Init *getVal(unsigned Num) const {
1016  assert(Num < NumConds && "Val number out of range!");
1017  return getTrailingObjects<Init *>()[Num+NumConds];
1018  }
1019 
1021  return ArrayRef(getTrailingObjects<Init *>(), NumConds);
1022  }
1023 
1025  return ArrayRef(getTrailingObjects<Init *>() + NumConds, NumConds);
1026  }
1027 
1028  Init *Fold(Record *CurRec) const;
1029 
1030  Init *resolveReferences(Resolver &R) const override;
1031 
1032  bool isConcrete() const override;
1033  bool isComplete() const override;
1034  std::string getAsString() const override;
1035 
1038 
1039  inline const_case_iterator arg_begin() const { return getConds().begin(); }
1040  inline const_case_iterator arg_end () const { return getConds().end(); }
1041 
1042  inline size_t case_size () const { return NumConds; }
1043  inline bool case_empty() const { return NumConds == 0; }
1044 
1045  inline const_val_iterator name_begin() const { return getVals().begin();}
1046  inline const_val_iterator name_end () const { return getVals().end(); }
1047 
1048  inline size_t val_size () const { return NumConds; }
1049  inline bool val_empty() const { return NumConds == 0; }
1050 
1051  Init *getBit(unsigned Bit) const override;
1052 };
1053 
1054 /// !foldl (a, b, expr, start, lst) - Fold over a list.
1055 class FoldOpInit : public TypedInit, public FoldingSetNode {
1056 private:
1057  Init *Start;
1058  Init *List;
1059  Init *A;
1060  Init *B;
1061  Init *Expr;
1062 
1063  FoldOpInit(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
1064  : TypedInit(IK_FoldOpInit, Type), Start(Start), List(List), A(A), B(B),
1065  Expr(Expr) {}
1066 
1067 public:
1068  FoldOpInit(const FoldOpInit &) = delete;
1069  FoldOpInit &operator=(const FoldOpInit &) = delete;
1070 
1071  static bool classof(const Init *I) { return I->getKind() == IK_FoldOpInit; }
1072 
1073  static FoldOpInit *get(Init *Start, Init *List, Init *A, Init *B, Init *Expr,
1074  RecTy *Type);
1075 
1076  void Profile(FoldingSetNodeID &ID) const;
1077 
1078  // Fold - If possible, fold this to a simpler init. Return this if not
1079  // possible to fold.
1080  Init *Fold(Record *CurRec) const;
1081 
1082  bool isComplete() const override { return false; }
1083 
1084  Init *resolveReferences(Resolver &R) const override;
1085 
1086  Init *getBit(unsigned Bit) const override;
1087 
1088  std::string getAsString() const override;
1089 };
1090 
1091 /// !isa<type>(expr) - Dynamically determine the type of an expression.
1092 class IsAOpInit : public TypedInit, public FoldingSetNode {
1093 private:
1094  RecTy *CheckType;
1095  Init *Expr;
1096 
1097  IsAOpInit(RecTy *CheckType, Init *Expr)
1099  CheckType(CheckType), Expr(Expr) {}
1100 
1101 public:
1102  IsAOpInit(const IsAOpInit &) = delete;
1103  IsAOpInit &operator=(const IsAOpInit &) = delete;
1104 
1105  static bool classof(const Init *I) { return I->getKind() == IK_IsAOpInit; }
1106 
1107  static IsAOpInit *get(RecTy *CheckType, Init *Expr);
1108 
1109  void Profile(FoldingSetNodeID &ID) const;
1110 
1111  // Fold - If possible, fold this to a simpler init. Return this if not
1112  // possible to fold.
1113  Init *Fold() const;
1114 
1115  bool isComplete() const override { return false; }
1116 
1117  Init *resolveReferences(Resolver &R) const override;
1118 
1119  Init *getBit(unsigned Bit) const override;
1120 
1121  std::string getAsString() const override;
1122 };
1123 
1124 /// !exists<type>(expr) - Dynamically determine if a record of `type` named
1125 /// `expr` exists.
1126 class ExistsOpInit : public TypedInit, public FoldingSetNode {
1127 private:
1128  RecTy *CheckType;
1129  Init *Expr;
1130 
1131  ExistsOpInit(RecTy *CheckType, Init *Expr)
1133  CheckType(CheckType), Expr(Expr) {}
1134 
1135 public:
1136  ExistsOpInit(const ExistsOpInit &) = delete;
1137  ExistsOpInit &operator=(const ExistsOpInit &) = delete;
1138 
1139  static bool classof(const Init *I) { return I->getKind() == IK_ExistsOpInit; }
1140 
1141  static ExistsOpInit *get(RecTy *CheckType, Init *Expr);
1142 
1143  void Profile(FoldingSetNodeID &ID) const;
1144 
1145  // Fold - If possible, fold this to a simpler init. Return this if not
1146  // possible to fold.
1147  Init *Fold(Record *CurRec, bool IsFinal = false) const;
1148 
1149  bool isComplete() const override { return false; }
1150 
1151  Init *resolveReferences(Resolver &R) const override;
1152 
1153  Init *getBit(unsigned Bit) const override;
1154 
1155  std::string getAsString() const override;
1156 };
1157 
1158 /// 'Opcode' - Represent a reference to an entire variable object.
1159 class VarInit : public TypedInit {
1160  Init *VarName;
1161 
1162  explicit VarInit(Init *VN, RecTy *T)
1163  : TypedInit(IK_VarInit, T), VarName(VN) {}
1164 
1165 public:
1166  VarInit(const VarInit &) = delete;
1167  VarInit &operator=(const VarInit &) = delete;
1168 
1169  static bool classof(const Init *I) {
1170  return I->getKind() == IK_VarInit;
1171  }
1172 
1173  static VarInit *get(StringRef VN, RecTy *T);
1174  static VarInit *get(Init *VN, RecTy *T);
1175 
1176  StringRef getName() const;
1177  Init *getNameInit() const { return VarName; }
1178 
1179  std::string getNameInitAsString() const {
1180  return getNameInit()->getAsUnquotedString();
1181  }
1182 
1183  /// This method is used by classes that refer to other
1184  /// variables which may not be defined at the time they expression is formed.
1185  /// If a value is set for the variable later, this method will be called on
1186  /// users of the value to allow the value to propagate out.
1187  ///
1188  Init *resolveReferences(Resolver &R) const override;
1189 
1190  Init *getBit(unsigned Bit) const override;
1191 
1192  std::string getAsString() const override { return std::string(getName()); }
1193 };
1194 
1195 /// Opcode{0} - Represent access to one bit of a variable or field.
1196 class VarBitInit final : public TypedInit {
1197  TypedInit *TI;
1198  unsigned Bit;
1199 
1200  VarBitInit(TypedInit *T, unsigned B)
1201  : TypedInit(IK_VarBitInit, BitRecTy::get(T->getRecordKeeper())), TI(T),
1202  Bit(B) {
1203  assert(T->getType() &&
1204  (isa<IntRecTy>(T->getType()) ||
1205  (isa<BitsRecTy>(T->getType()) &&
1206  cast<BitsRecTy>(T->getType())->getNumBits() > B)) &&
1207  "Illegal VarBitInit expression!");
1208  }
1209 
1210 public:
1211  VarBitInit(const VarBitInit &) = delete;
1212  VarBitInit &operator=(const VarBitInit &) = delete;
1213 
1214  static bool classof(const Init *I) {
1215  return I->getKind() == IK_VarBitInit;
1216  }
1217 
1218  static VarBitInit *get(TypedInit *T, unsigned B);
1219 
1220  Init *getBitVar() const { return TI; }
1221  unsigned getBitNum() const { return Bit; }
1222 
1223  std::string getAsString() const override;
1224  Init *resolveReferences(Resolver &R) const override;
1225 
1226  Init *getBit(unsigned B) const override {
1227  assert(B < 1 && "Bit index out of range!");
1228  return const_cast<VarBitInit*>(this);
1229  }
1230 };
1231 
1232 /// List[4] - Represent access to one element of a var or
1233 /// field.
1235  TypedInit *TI;
1236  unsigned Element;
1237 
1238  VarListElementInit(TypedInit *T, unsigned E)
1240  cast<ListRecTy>(T->getType())->getElementType()),
1241  TI(T), Element(E) {
1242  assert(T->getType() && isa<ListRecTy>(T->getType()) &&
1243  "Illegal VarBitInit expression!");
1244  }
1245 
1246 public:
1247  VarListElementInit(const VarListElementInit &) = delete;
1248  VarListElementInit &operator=(const VarListElementInit &) = delete;
1249 
1250  static bool classof(const Init *I) {
1251  return I->getKind() == IK_VarListElementInit;
1252  }
1253 
1254  static VarListElementInit *get(TypedInit *T, unsigned E);
1255 
1256  TypedInit *getVariable() const { return TI; }
1257  unsigned getElementNum() const { return Element; }
1258 
1259  std::string getAsString() const override;
1260  Init *resolveReferences(Resolver &R) const override;
1261 
1262  Init *getBit(unsigned Bit) const override;
1263 };
1264 
1265 /// AL - Represent a reference to a 'def' in the description
1266 class DefInit : public TypedInit {
1267  friend class Record;
1268 
1269  Record *Def;
1270 
1271  explicit DefInit(Record *D);
1272 
1273 public:
1274  DefInit(const DefInit &) = delete;
1275  DefInit &operator=(const DefInit &) = delete;
1276 
1277  static bool classof(const Init *I) {
1278  return I->getKind() == IK_DefInit;
1279  }
1280 
1281  static DefInit *get(Record*);
1282 
1283  Init *convertInitializerTo(RecTy *Ty) const override;
1284 
1285  Record *getDef() const { return Def; }
1286 
1287  //virtual Init *convertInitializerBitRange(ArrayRef<unsigned> Bits);
1288 
1289  RecTy *getFieldType(StringInit *FieldName) const override;
1290 
1291  bool isConcrete() const override { return true; }
1292  std::string getAsString() const override;
1293 
1294  Init *getBit(unsigned Bit) const override {
1295  llvm_unreachable("Illegal bit reference off def");
1296  }
1297 };
1298 
1299 /// classname<targs...> - Represent an uninstantiated anonymous class
1300 /// instantiation.
1301 class VarDefInit final : public TypedInit, public FoldingSetNode,
1302  public TrailingObjects<VarDefInit, Init *> {
1303  Record *Class;
1304  DefInit *Def = nullptr; // after instantiation
1305  unsigned NumArgs;
1306 
1307  explicit VarDefInit(Record *Class, unsigned N);
1308 
1309  DefInit *instantiate();
1310 
1311 public:
1312  VarDefInit(const VarDefInit &) = delete;
1313  VarDefInit &operator=(const VarDefInit &) = delete;
1314 
1315  // Do not use sized deallocation due to trailing objects.
1316  void operator delete(void *p) { ::operator delete(p); }
1317 
1318  static bool classof(const Init *I) {
1319  return I->getKind() == IK_VarDefInit;
1320  }
1321  static VarDefInit *get(Record *Class, ArrayRef<Init *> Args);
1322 
1323  void Profile(FoldingSetNodeID &ID) const;
1324 
1325  Init *resolveReferences(Resolver &R) const override;
1326  Init *Fold() const;
1327 
1328  std::string getAsString() const override;
1329 
1330  Init *getArg(unsigned i) const {
1331  assert(i < NumArgs && "Argument index out of range!");
1332  return getTrailingObjects<Init *>()[i];
1333  }
1334 
1335  using const_iterator = Init *const *;
1336 
1337  const_iterator args_begin() const { return getTrailingObjects<Init *>(); }
1338  const_iterator args_end () const { return args_begin() + NumArgs; }
1339 
1340  size_t args_size () const { return NumArgs; }
1341  bool args_empty() const { return NumArgs == 0; }
1342 
1343  ArrayRef<Init *> args() const { return ArrayRef(args_begin(), NumArgs); }
1344 
1345  Init *getBit(unsigned Bit) const override {
1346  llvm_unreachable("Illegal bit reference off anonymous def");
1347  }
1348 };
1349 
1350 /// X.Y - Represent a reference to a subfield of a variable
1351 class FieldInit : public TypedInit {
1352  Init *Rec; // Record we are referring to
1353  StringInit *FieldName; // Field we are accessing
1354 
1355  FieldInit(Init *R, StringInit *FN)
1356  : TypedInit(IK_FieldInit, R->getFieldType(FN)), Rec(R), FieldName(FN) {
1357 #ifndef NDEBUG
1358  if (!getType()) {
1359  llvm::errs() << "In Record = " << Rec->getAsString()
1360  << ", got FieldName = " << *FieldName
1361  << " with non-record type!\n";
1362  llvm_unreachable("FieldInit with non-record type!");
1363  }
1364 #endif
1365  }
1366 
1367 public:
1368  FieldInit(const FieldInit &) = delete;
1369  FieldInit &operator=(const FieldInit &) = delete;
1370 
1371  static bool classof(const Init *I) {
1372  return I->getKind() == IK_FieldInit;
1373  }
1374 
1375  static FieldInit *get(Init *R, StringInit *FN);
1376 
1377  Init *getRecord() const { return Rec; }
1378  StringInit *getFieldName() const { return FieldName; }
1379 
1380  Init *getBit(unsigned Bit) const override;
1381 
1382  Init *resolveReferences(Resolver &R) const override;
1383  Init *Fold(Record *CurRec) const;
1384 
1385  bool isConcrete() const override;
1386  std::string getAsString() const override {
1387  return Rec->getAsString() + "." + FieldName->getValue().str();
1388  }
1389 };
1390 
1391 /// (v a, b) - Represent a DAG tree value. DAG inits are required
1392 /// to have at least one value then a (possibly empty) list of arguments. Each
1393 /// argument can have a name associated with it.
1394 class DagInit final : public TypedInit, public FoldingSetNode,
1395  public TrailingObjects<DagInit, Init *, StringInit *> {
1396  friend TrailingObjects;
1397 
1398  Init *Val;
1399  StringInit *ValName;
1400  unsigned NumArgs;
1401  unsigned NumArgNames;
1402 
1403  DagInit(Init *V, StringInit *VN, unsigned NumArgs, unsigned NumArgNames)
1405  ValName(VN), NumArgs(NumArgs), NumArgNames(NumArgNames) {}
1406 
1407  size_t numTrailingObjects(OverloadToken<Init *>) const { return NumArgs; }
1408 
1409 public:
1410  DagInit(const DagInit &) = delete;
1411  DagInit &operator=(const DagInit &) = delete;
1412 
1413  static bool classof(const Init *I) {
1414  return I->getKind() == IK_DagInit;
1415  }
1416 
1417  static DagInit *get(Init *V, StringInit *VN, ArrayRef<Init *> ArgRange,
1418  ArrayRef<StringInit*> NameRange);
1419  static DagInit *get(Init *V, StringInit *VN,
1420  ArrayRef<std::pair<Init*, StringInit*>> Args);
1421 
1422  void Profile(FoldingSetNodeID &ID) const;
1423 
1424  Init *getOperator() const { return Val; }
1426 
1427  StringInit *getName() const { return ValName; }
1428 
1430  return ValName ? ValName->getValue() : StringRef();
1431  }
1432 
1433  unsigned getNumArgs() const { return NumArgs; }
1434 
1435  Init *getArg(unsigned Num) const {
1436  assert(Num < NumArgs && "Arg number out of range!");
1437  return getTrailingObjects<Init *>()[Num];
1438  }
1439 
1440  StringInit *getArgName(unsigned Num) const {
1441  assert(Num < NumArgNames && "Arg number out of range!");
1442  return getTrailingObjects<StringInit *>()[Num];
1443  }
1444 
1445  StringRef getArgNameStr(unsigned Num) const {
1446  StringInit *Init = getArgName(Num);
1447  return Init ? Init->getValue() : StringRef();
1448  }
1449 
1451  return ArrayRef(getTrailingObjects<Init *>(), NumArgs);
1452  }
1453 
1455  return ArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
1456  }
1457 
1458  Init *resolveReferences(Resolver &R) const override;
1459 
1460  bool isConcrete() const override;
1461  std::string getAsString() const override;
1462 
1465 
1466  inline const_arg_iterator arg_begin() const { return getArgs().begin(); }
1467  inline const_arg_iterator arg_end () const { return getArgs().end(); }
1468 
1469  inline size_t arg_size () const { return NumArgs; }
1470  inline bool arg_empty() const { return NumArgs == 0; }
1471 
1472  inline const_name_iterator name_begin() const { return getArgNames().begin();}
1473  inline const_name_iterator name_end () const { return getArgNames().end(); }
1474 
1475  inline size_t name_size () const { return NumArgNames; }
1476  inline bool name_empty() const { return NumArgNames == 0; }
1477 
1478  Init *getBit(unsigned Bit) const override {
1479  llvm_unreachable("Illegal bit reference off dag");
1480  }
1481 };
1482 
1483 //===----------------------------------------------------------------------===//
1484 // High-Level Classes
1485 //===----------------------------------------------------------------------===//
1486 
1487 /// This class represents a field in a record, including its name, type,
1488 /// value, and source location.
1489 class RecordVal {
1490  friend class Record;
1491 
1492 public:
1493  enum FieldKind {
1494  FK_Normal, // A normal record field.
1495  FK_NonconcreteOK, // A field that can be nonconcrete ('field' keyword).
1496  FK_TemplateArg, // A template argument.
1497  };
1498 
1499 private:
1500  Init *Name;
1501  SMLoc Loc; // Source location of definition of name.
1503  Init *Value;
1504  bool IsUsed = false;
1505 
1506  /// Reference locations to this record value.
1507  SmallVector<SMRange> ReferenceLocs;
1508 
1509 public:
1510  RecordVal(Init *N, RecTy *T, FieldKind K);
1511  RecordVal(Init *N, SMLoc Loc, RecTy *T, FieldKind K);
1512 
1513  /// Get the record keeper used to unique this value.
1514  RecordKeeper &getRecordKeeper() const { return Name->getRecordKeeper(); }
1515 
1516  /// Get the name of the field as a StringRef.
1517  StringRef getName() const;
1518 
1519  /// Get the name of the field as an Init.
1520  Init *getNameInit() const { return Name; }
1521 
1522  /// Get the name of the field as a std::string.
1523  std::string getNameInitAsString() const {
1524  return getNameInit()->getAsUnquotedString();
1525  }
1526 
1527  /// Get the source location of the point where the field was defined.
1528  const SMLoc &getLoc() const { return Loc; }
1529 
1530  /// Is this a field where nonconcrete values are okay?
1531  bool isNonconcreteOK() const {
1532  return TyAndKind.getInt() == FK_NonconcreteOK;
1533  }
1534 
1535  /// Is this a template argument?
1536  bool isTemplateArg() const {
1537  return TyAndKind.getInt() == FK_TemplateArg;
1538  }
1539 
1540  /// Get the type of the field value as a RecTy.
1541  RecTy *getType() const { return TyAndKind.getPointer(); }
1542 
1543  /// Get the type of the field for printing purposes.
1544  std::string getPrintType() const;
1545 
1546  /// Get the value of the field as an Init.
1547  Init *getValue() const { return Value; }
1548 
1549  /// Set the value of the field from an Init.
1550  bool setValue(Init *V);
1551 
1552  /// Set the value and source location of the field.
1553  bool setValue(Init *V, SMLoc NewLoc);
1554 
1555  /// Add a reference to this record value.
1556  void addReferenceLoc(SMRange Loc) { ReferenceLocs.push_back(Loc); }
1557 
1558  /// Return the references of this record value.
1559  ArrayRef<SMRange> getReferenceLocs() const { return ReferenceLocs; }
1560 
1561  /// Whether this value is used. Useful for reporting warnings, for example
1562  /// when a template argument is unused.
1563  void setUsed(bool Used) { IsUsed = Used; }
1564  bool isUsed() const { return IsUsed; }
1565 
1566  void dump() const;
1567 
1568  /// Print the value to an output stream, possibly with a semicolon.
1569  void print(raw_ostream &OS, bool PrintSem = true) const;
1570 };
1571 
1572 inline raw_ostream &operator<<(raw_ostream &OS, const RecordVal &RV) {
1573  RV.print(OS << " ");
1574  return OS;
1575 }
1576 
1577 class Record {
1578 public:
1579  struct AssertionInfo {
1583 
1584  // User-defined constructor to support std::make_unique(). It can be
1585  // removed in C++20 when braced initialization is supported.
1588  };
1589 
1590 private:
1591  Init *Name;
1592  // Location where record was instantiated, followed by the location of
1593  // multiclass prototypes used, and finally by the locations of references to
1594  // this record.
1595  SmallVector<SMLoc, 4> Locs;
1596  SmallVector<SMLoc, 0> ForwardDeclarationLocs;
1597  SmallVector<SMRange, 0> ReferenceLocs;
1600  SmallVector<AssertionInfo, 0> Assertions;
1601 
1602  // All superclasses in the inheritance forest in post-order (yes, it
1603  // must be a forest; diamond-shaped inheritance is not allowed).
1605 
1606  // Tracks Record instances. Not owned by Record.
1607  RecordKeeper &TrackedRecords;
1608 
1609  // The DefInit corresponding to this record.
1610  DefInit *CorrespondingDefInit = nullptr;
1611 
1612  // Unique record ID.
1613  unsigned ID;
1614 
1615  bool IsAnonymous;
1616  bool IsClass;
1617 
1618  void checkName();
1619 
1620 public:
1621  // Constructs a record.
1622  explicit Record(Init *N, ArrayRef<SMLoc> locs, RecordKeeper &records,
1623  bool Anonymous = false, bool Class = false)
1624  : Name(N), Locs(locs.begin(), locs.end()), TrackedRecords(records),
1625  ID(getNewUID(N->getRecordKeeper())), IsAnonymous(Anonymous),
1626  IsClass(Class) {
1627  checkName();
1628  }
1629 
1630  explicit Record(StringRef N, ArrayRef<SMLoc> locs, RecordKeeper &records,
1631  bool Class = false)
1632  : Record(StringInit::get(records, N), locs, records, false, Class) {}
1633 
1634  // When copy-constructing a Record, we must still guarantee a globally unique
1635  // ID number. Don't copy CorrespondingDefInit either, since it's owned by the
1636  // original record. All other fields can be copied normally.
1637  Record(const Record &O)
1638  : Name(O.Name), Locs(O.Locs), TemplateArgs(O.TemplateArgs),
1639  Values(O.Values), Assertions(O.Assertions),
1640  SuperClasses(O.SuperClasses), TrackedRecords(O.TrackedRecords),
1641  ID(getNewUID(O.getRecords())), IsAnonymous(O.IsAnonymous),
1642  IsClass(O.IsClass) {}
1643 
1644  static unsigned getNewUID(RecordKeeper &RK);
1645 
1646  unsigned getID() const { return ID; }
1647 
1648  StringRef getName() const { return cast<StringInit>(Name)->getValue(); }
1649 
1650  Init *getNameInit() const {
1651  return Name;
1652  }
1653 
1654  std::string getNameInitAsString() const {
1655  return getNameInit()->getAsUnquotedString();
1656  }
1657 
1658  void setName(Init *Name); // Also updates RecordKeeper.
1659 
1660  ArrayRef<SMLoc> getLoc() const { return Locs; }
1661  void appendLoc(SMLoc Loc) { Locs.push_back(Loc); }
1662 
1664  return ForwardDeclarationLocs;
1665  }
1666 
1667  /// Add a reference to this record value.
1668  void appendReferenceLoc(SMRange Loc) { ReferenceLocs.push_back(Loc); }
1669 
1670  /// Return the references of this record value.
1671  ArrayRef<SMRange> getReferenceLocs() const { return ReferenceLocs; }
1672 
1673  // Update a class location when encountering a (re-)definition.
1674  void updateClassLoc(SMLoc Loc);
1675 
1676  // Make the type that this record should have based on its superclasses.
1677  RecordRecTy *getType();
1678 
1679  /// get the corresponding DefInit.
1680  DefInit *getDefInit();
1681 
1682  bool isClass() const { return IsClass; }
1683 
1685  return TemplateArgs;
1686  }
1687 
1688  ArrayRef<RecordVal> getValues() const { return Values; }
1689 
1690  ArrayRef<AssertionInfo> getAssertions() const { return Assertions; }
1691 
1693  return SuperClasses;
1694  }
1695 
1696  /// Determine whether this record has the specified direct superclass.
1697  bool hasDirectSuperClass(const Record *SuperClass) const;
1698 
1699  /// Append the direct superclasses of this record to Classes.
1700  void getDirectSuperClasses(SmallVectorImpl<Record *> &Classes) const;
1701 
1702  bool isTemplateArg(Init *Name) const {
1703  return llvm::is_contained(TemplateArgs, Name);
1704  }
1705 
1706  const RecordVal *getValue(const Init *Name) const {
1707  for (const RecordVal &Val : Values)
1708  if (Val.Name == Name) return &Val;
1709  return nullptr;
1710  }
1711 
1712  const RecordVal *getValue(StringRef Name) const {
1713  return getValue(StringInit::get(getRecords(), Name));
1714  }
1715 
1716  RecordVal *getValue(const Init *Name) {
1717  return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
1718  }
1719 
1721  return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
1722  }
1723 
1724  void addTemplateArg(Init *Name) {
1725  assert(!isTemplateArg(Name) && "Template arg already defined!");
1726  TemplateArgs.push_back(Name);
1727  }
1728 
1729  void addValue(const RecordVal &RV) {
1730  assert(getValue(RV.getNameInit()) == nullptr && "Value already added!");
1731  Values.push_back(RV);
1732  }
1733 
1734  void removeValue(Init *Name) {
1735  for (unsigned i = 0, e = Values.size(); i != e; ++i)
1736  if (Values[i].getNameInit() == Name) {
1737  Values.erase(Values.begin()+i);
1738  return;
1739  }
1740  llvm_unreachable("Cannot remove an entry that does not exist!");
1741  }
1742 
1743  void removeValue(StringRef Name) {
1745  }
1746 
1747  void addAssertion(SMLoc Loc, Init *Condition, Init *Message) {
1748  Assertions.push_back(AssertionInfo(Loc, Condition, Message));
1749  }
1750 
1751  void appendAssertions(const Record *Rec) {
1752  Assertions.append(Rec->Assertions);
1753  }
1754 
1755  void checkRecordAssertions();
1756  void checkUnusedTemplateArgs();
1757 
1758  bool isSubClassOf(const Record *R) const {
1759  for (const auto &SCPair : SuperClasses)
1760  if (SCPair.first == R)
1761  return true;
1762  return false;
1763  }
1764 
1765  bool isSubClassOf(StringRef Name) const {
1766  for (const auto &SCPair : SuperClasses) {
1767  if (const auto *SI = dyn_cast<StringInit>(SCPair.first->getNameInit())) {
1768  if (SI->getValue() == Name)
1769  return true;
1770  } else if (SCPair.first->getNameInitAsString() == Name) {
1771  return true;
1772  }
1773  }
1774  return false;
1775  }
1776 
1777  void addSuperClass(Record *R, SMRange Range) {
1778  assert(!CorrespondingDefInit &&
1779  "changing type of record after it has been referenced");
1780  assert(!isSubClassOf(R) && "Already subclassing record!");
1781  SuperClasses.push_back(std::make_pair(R, Range));
1782  }
1783 
1784  /// If there are any field references that refer to fields that have been
1785  /// filled in, we can propagate the values now.
1786  ///
1787  /// This is a final resolve: any error messages, e.g. due to undefined !cast
1788  /// references, are generated now.
1789  void resolveReferences(Init *NewName = nullptr);
1790 
1791  /// Apply the resolver to the name of the record as well as to the
1792  /// initializers of all fields of the record except SkipVal.
1793  ///
1794  /// The resolver should not resolve any of the fields itself, to avoid
1795  /// recursion / infinite loops.
1796  void resolveReferences(Resolver &R, const RecordVal *SkipVal = nullptr);
1797 
1799  return TrackedRecords;
1800  }
1801 
1802  bool isAnonymous() const {
1803  return IsAnonymous;
1804  }
1805 
1806  void dump() const;
1807 
1808  //===--------------------------------------------------------------------===//
1809  // High-level methods useful to tablegen back-ends
1810  //
1811 
1812  /// Return the source location for the named field.
1813  SMLoc getFieldLoc(StringRef FieldName) const;
1814 
1815  /// Return the initializer for a value with the specified name, or throw an
1816  /// exception if the field does not exist.
1817  Init *getValueInit(StringRef FieldName) const;
1818 
1819  /// Return true if the named field is unset.
1820  bool isValueUnset(StringRef FieldName) const {
1821  return isa<UnsetInit>(getValueInit(FieldName));
1822  }
1823 
1824  /// This method looks up the specified field and returns its value as a
1825  /// string, throwing an exception if the field does not exist or if the value
1826  /// is not a string.
1827  StringRef getValueAsString(StringRef FieldName) const;
1828 
1829  /// This method looks up the specified field and returns its value as a
1830  /// string, throwing an exception if the value is not a string and
1831  /// llvm::Optional() if the field does not exist.
1832  std::optional<StringRef> getValueAsOptionalString(StringRef FieldName) const;
1833 
1834  /// This method looks up the specified field and returns its value as a
1835  /// BitsInit, throwing an exception if the field does not exist or if the
1836  /// value is not the right type.
1837  BitsInit *getValueAsBitsInit(StringRef FieldName) const;
1838 
1839  /// This method looks up the specified field and returns its value as a
1840  /// ListInit, throwing an exception if the field does not exist or if the
1841  /// value is not the right type.
1842  ListInit *getValueAsListInit(StringRef FieldName) const;
1843 
1844  /// This method looks up the specified field and returns its value as a
1845  /// vector of records, throwing an exception if the field does not exist or
1846  /// if the value is not the right type.
1847  std::vector<Record*> getValueAsListOfDefs(StringRef FieldName) const;
1848 
1849  /// This method looks up the specified field and returns its value as a
1850  /// vector of integers, throwing an exception if the field does not exist or
1851  /// if the value is not the right type.
1852  std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
1853 
1854  /// This method looks up the specified field and returns its value as a
1855  /// vector of strings, throwing an exception if the field does not exist or
1856  /// if the value is not the right type.
1857  std::vector<StringRef> getValueAsListOfStrings(StringRef FieldName) const;
1858 
1859  /// This method looks up the specified field and returns its value as a
1860  /// Record, throwing an exception if the field does not exist or if the value
1861  /// is not the right type.
1862  Record *getValueAsDef(StringRef FieldName) const;
1863 
1864  /// This method looks up the specified field and returns its value as a
1865  /// Record, returning null if the field exists but is "uninitialized" (i.e.
1866  /// set to `?`), and throwing an exception if the field does not exist or if
1867  /// its value is not the right type.
1868  Record *getValueAsOptionalDef(StringRef FieldName) const;
1869 
1870  /// This method looks up the specified field and returns its value as a bit,
1871  /// throwing an exception if the field does not exist or if the value is not
1872  /// the right type.
1873  bool getValueAsBit(StringRef FieldName) const;
1874 
1875  /// This method looks up the specified field and returns its value as a bit.
1876  /// If the field is unset, sets Unset to true and returns false.
1877  bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
1878 
1879  /// This method looks up the specified field and returns its value as an
1880  /// int64_t, throwing an exception if the field does not exist or if the
1881  /// value is not the right type.
1882  int64_t getValueAsInt(StringRef FieldName) const;
1883 
1884  /// This method looks up the specified field and returns its value as an Dag,
1885  /// throwing an exception if the field does not exist or if the value is not
1886  /// the right type.
1887  DagInit *getValueAsDag(StringRef FieldName) const;
1888 };
1889 
1890 raw_ostream &operator<<(raw_ostream &OS, const Record &R);
1891 
1893  using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
1894  using GlobalMap = std::map<std::string, Init *, std::less<>>;
1895 
1896 public:
1897  RecordKeeper();
1898  ~RecordKeeper();
1899 
1900  /// Return the internal implementation of the RecordKeeper.
1901  detail::RecordKeeperImpl &getImpl() { return *Impl; }
1902 
1903  /// Get the main TableGen input file's name.
1904  const std::string getInputFilename() const { return InputFilename; }
1905 
1906  /// Get the map of classes.
1907  const RecordMap &getClasses() const { return Classes; }
1908 
1909  /// Get the map of records (defs).
1910  const RecordMap &getDefs() const { return Defs; }
1911 
1912  /// Get the map of global variables.
1913  const GlobalMap &getGlobals() const { return ExtraGlobals; }
1914 
1915  /// Get the class with the specified name.
1916  Record *getClass(StringRef Name) const {
1917  auto I = Classes.find(Name);
1918  return I == Classes.end() ? nullptr : I->second.get();
1919  }
1920 
1921  /// Get the concrete record with the specified name.
1922  Record *getDef(StringRef Name) const {
1923  auto I = Defs.find(Name);
1924  return I == Defs.end() ? nullptr : I->second.get();
1925  }
1926 
1927  /// Get the \p Init value of the specified global variable.
1928  Init *getGlobal(StringRef Name) const {
1929  if (Record *R = getDef(Name))
1930  return R->getDefInit();
1931  auto It = ExtraGlobals.find(Name);
1932  return It == ExtraGlobals.end() ? nullptr : It->second;
1933  }
1934 
1935  void saveInputFilename(std::string Filename) {
1936  InputFilename = Filename;
1937  }
1938 
1939  void addClass(std::unique_ptr<Record> R) {
1940  bool Ins = Classes.insert(std::make_pair(std::string(R->getName()),
1941  std::move(R))).second;
1942  (void)Ins;
1943  assert(Ins && "Class already exists");
1944  }
1945 
1946  void addDef(std::unique_ptr<Record> R) {
1947  bool Ins = Defs.insert(std::make_pair(std::string(R->getName()),
1948  std::move(R))).second;
1949  (void)Ins;
1950  assert(Ins && "Record already exists");
1951  }
1952 
1954  bool Ins = ExtraGlobals.insert(std::make_pair(std::string(Name), I)).second;
1955  (void)Ins;
1956  assert(!getDef(Name));
1957  assert(Ins && "Global already exists");
1958  }
1959 
1961 
1962  /// Start phase timing; called if the --time-phases option is specified.
1964  TimingGroup = new TimerGroup("TableGen", "TableGen Phase Timing");
1965  }
1966 
1967  /// Start timing a phase. Automatically stops any previous phase timer.
1968  void startTimer(StringRef Name);
1969 
1970  /// Stop timing a phase.
1971  void stopTimer();
1972 
1973  /// Start timing the overall backend. If the backend itself starts a timer,
1974  /// then this timer is cleared.
1975  void startBackendTimer(StringRef Name);
1976 
1977  /// Stop timing the overall backend.
1978  void stopBackendTimer();
1979 
1980  /// Stop phase timing and print the report.
1982  if (TimingGroup)
1983  delete TimingGroup;
1984  }
1985 
1986  //===--------------------------------------------------------------------===//
1987  // High-level helper methods, useful for tablegen backends.
1988 
1989  /// Get all the concrete records that inherit from the one specified
1990  /// class. The class must be defined.
1991  std::vector<Record *> getAllDerivedDefinitions(StringRef ClassName) const;
1992 
1993  /// Get all the concrete records that inherit from all the specified
1994  /// classes. The classes must be defined.
1995  std::vector<Record *> getAllDerivedDefinitions(
1996  ArrayRef<StringRef> ClassNames) const;
1997 
1998  /// Get all the concrete records that inherit from specified class, if the
1999  /// class is defined. Returns an empty vector if the class is not defined.
2000  std::vector<Record *>
2002 
2003  void dump() const;
2004 
2005 private:
2006  RecordKeeper(RecordKeeper &&) = delete;
2007  RecordKeeper(const RecordKeeper &) = delete;
2008  RecordKeeper &operator=(RecordKeeper &&) = delete;
2009  RecordKeeper &operator=(const RecordKeeper &) = delete;
2010 
2011  std::string InputFilename;
2012  RecordMap Classes, Defs;
2013  mutable StringMap<std::vector<Record *>> ClassRecordsMap;
2014  GlobalMap ExtraGlobals;
2015 
2016  // These members are for the phase timing feature. We need a timer group,
2017  // the last timer started, and a flag to say whether the last timer
2018  // is the special "backend overall timer."
2019  TimerGroup *TimingGroup = nullptr;
2020  Timer *LastTimer = nullptr;
2021  bool BackendTimer = false;
2022 
2023  /// The internal uniquer implementation of the RecordKeeper.
2024  std::unique_ptr<detail::RecordKeeperImpl> Impl;
2025 };
2026 
2027 /// Sorting predicate to sort record pointers by name.
2028 struct LessRecord {
2029  bool operator()(const Record *Rec1, const Record *Rec2) const {
2030  return StringRef(Rec1->getName()).compare_numeric(Rec2->getName()) < 0;
2031  }
2032 };
2033 
2034 /// Sorting predicate to sort record pointers by their
2035 /// unique ID. If you just need a deterministic order, use this, since it
2036 /// just compares two `unsigned`; the other sorting predicates require
2037 /// string manipulation.
2039  bool operator()(const Record *LHS, const Record *RHS) const {
2040  return LHS->getID() < RHS->getID();
2041  }
2042 };
2043 
2044 /// Sorting predicate to sort record pointers by their
2045 /// name field.
2047  bool operator()(const Record *Rec1, const Record *Rec2) const {
2048  return Rec1->getValueAsString("Name") < Rec2->getValueAsString("Name");
2049  }
2050 };
2051 
2053  struct RecordParts {
2055 
2057  if (Rec.empty())
2058  return;
2059 
2060  size_t Len = 0;
2061  const char *Start = Rec.data();
2062  const char *Curr = Start;
2063  bool IsDigitPart = isDigit(Curr[0]);
2064  for (size_t I = 0, E = Rec.size(); I != E; ++I, ++Len) {
2065  bool IsDigit = isDigit(Curr[I]);
2066  if (IsDigit != IsDigitPart) {
2067  Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len)));
2068  Len = 0;
2069  Start = &Curr[I];
2070  IsDigitPart = isDigit(Curr[I]);
2071  }
2072  }
2073  // Push the last part.
2074  Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len)));
2075  }
2076 
2077  size_t size() { return Parts.size(); }
2078 
2079  std::pair<bool, StringRef> getPart(size_t i) {
2080  assert (i < Parts.size() && "Invalid idx!");
2081  return Parts[i];
2082  }
2083  };
2084 
2085  bool operator()(const Record *Rec1, const Record *Rec2) const {
2086  RecordParts LHSParts(StringRef(Rec1->getName()));
2087  RecordParts RHSParts(StringRef(Rec2->getName()));
2088 
2089  size_t LHSNumParts = LHSParts.size();
2090  size_t RHSNumParts = RHSParts.size();
2091  assert (LHSNumParts && RHSNumParts && "Expected at least one part!");
2092 
2093  if (LHSNumParts != RHSNumParts)
2094  return LHSNumParts < RHSNumParts;
2095 
2096  // We expect the registers to be of the form [_a-zA-Z]+([0-9]*[_a-zA-Z]*)*.
2097  for (size_t I = 0, E = LHSNumParts; I < E; I+=2) {
2098  std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
2099  std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
2100  // Expect even part to always be alpha.
2101  assert (LHSPart.first == false && RHSPart.first == false &&
2102  "Expected both parts to be alpha.");
2103  if (int Res = LHSPart.second.compare(RHSPart.second))
2104  return Res < 0;
2105  }
2106  for (size_t I = 1, E = LHSNumParts; I < E; I+=2) {
2107  std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
2108  std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
2109  // Expect odd part to always be numeric.
2110  assert (LHSPart.first == true && RHSPart.first == true &&
2111  "Expected both parts to be numeric.");
2112  if (LHSPart.second.size() != RHSPart.second.size())
2113  return LHSPart.second.size() < RHSPart.second.size();
2114 
2115  unsigned LHSVal, RHSVal;
2116 
2117  bool LHSFailed = LHSPart.second.getAsInteger(10, LHSVal); (void)LHSFailed;
2118  assert(!LHSFailed && "Unable to convert LHS to integer.");
2119  bool RHSFailed = RHSPart.second.getAsInteger(10, RHSVal); (void)RHSFailed;
2120  assert(!RHSFailed && "Unable to convert RHS to integer.");
2121 
2122  if (LHSVal != RHSVal)
2123  return LHSVal < RHSVal;
2124  }
2125  return LHSNumParts < RHSNumParts;
2126  }
2127 };
2128 
2129 raw_ostream &operator<<(raw_ostream &OS, const RecordKeeper &RK);
2130 
2131 //===----------------------------------------------------------------------===//
2132 // Resolvers
2133 //===----------------------------------------------------------------------===//
2134 
2135 /// Interface for looking up the initializer for a variable name, used by
2136 /// Init::resolveReferences.
2137 class Resolver {
2138  Record *CurRec;
2139  bool IsFinal = false;
2140 
2141 public:
2142  explicit Resolver(Record *CurRec) : CurRec(CurRec) {}
2143  virtual ~Resolver() = default;
2144 
2145  Record *getCurrentRecord() const { return CurRec; }
2146 
2147  /// Return the initializer for the given variable name (should normally be a
2148  /// StringInit), or nullptr if the name could not be resolved.
2149  virtual Init *resolve(Init *VarName) = 0;
2150 
2151  // Whether bits in a BitsInit should stay unresolved if resolving them would
2152  // result in a ? (UnsetInit). This behavior is used to represent instruction
2153  // encodings by keeping references to unset variables within a record.
2154  virtual bool keepUnsetBits() const { return false; }
2155 
2156  // Whether this is the final resolve step before adding a record to the
2157  // RecordKeeper. Error reporting during resolve and related constant folding
2158  // should only happen when this is true.
2159  bool isFinal() const { return IsFinal; }
2160 
2161  void setFinal(bool Final) { IsFinal = Final; }
2162 };
2163 
2164 /// Resolve arbitrary mappings.
2165 class MapResolver final : public Resolver {
2166  struct MappedValue {
2167  Init *V;
2168  bool Resolved;
2169 
2170  MappedValue() : V(nullptr), Resolved(false) {}
2171  MappedValue(Init *V, bool Resolved) : V(V), Resolved(Resolved) {}
2172  };
2173 
2175 
2176 public:
2177  explicit MapResolver(Record *CurRec = nullptr) : Resolver(CurRec) {}
2178 
2179  void set(Init *Key, Init *Value) { Map[Key] = {Value, false}; }
2180 
2181  bool isComplete(Init *VarName) const {
2182  auto It = Map.find(VarName);
2183  assert(It != Map.end() && "key must be present in map");
2184  return It->second.V->isComplete();
2185  }
2186 
2187  Init *resolve(Init *VarName) override;
2188 };
2189 
2190 /// Resolve all variables from a record except for unset variables.
2191 class RecordResolver final : public Resolver {
2193  SmallVector<Init *, 4> Stack;
2194  Init *Name = nullptr;
2195 
2196 public:
2197  explicit RecordResolver(Record &R) : Resolver(&R) {}
2198 
2199  void setName(Init *NewName) { Name = NewName; }
2200 
2201  Init *resolve(Init *VarName) override;
2202 
2203  bool keepUnsetBits() const override { return true; }
2204 };
2205 
2206 /// Delegate resolving to a sub-resolver, but shadow some variable names.
2207 class ShadowResolver final : public Resolver {
2208  Resolver &R;
2209  DenseSet<Init *> Shadowed;
2210 
2211 public:
2213  : Resolver(R.getCurrentRecord()), R(R) {
2214  setFinal(R.isFinal());
2215  }
2216 
2217  void addShadow(Init *Key) { Shadowed.insert(Key); }
2218 
2219  Init *resolve(Init *VarName) override {
2220  if (Shadowed.count(VarName))
2221  return nullptr;
2222  return R.resolve(VarName);
2223  }
2224 };
2225 
2226 /// (Optionally) delegate resolving to a sub-resolver, and keep track whether
2227 /// there were unresolved references.
2228 class TrackUnresolvedResolver final : public Resolver {
2229  Resolver *R;
2230  bool FoundUnresolved = false;
2231 
2232 public:
2233  explicit TrackUnresolvedResolver(Resolver *R = nullptr)
2234  : Resolver(R ? R->getCurrentRecord() : nullptr), R(R) {}
2235 
2236  bool foundUnresolved() const { return FoundUnresolved; }
2237 
2238  Init *resolve(Init *VarName) override;
2239 };
2240 
2241 /// Do not resolve anything, but keep track of whether a given variable was
2242 /// referenced.
2243 class HasReferenceResolver final : public Resolver {
2244  Init *VarNameToTrack;
2245  bool Found = false;
2246 
2247 public:
2248  explicit HasReferenceResolver(Init *VarNameToTrack)
2249  : Resolver(nullptr), VarNameToTrack(VarNameToTrack) {}
2250 
2251  bool found() const { return Found; }
2252 
2253  Init *resolve(Init *VarName) override;
2254 };
2255 
2256 void EmitDetailedRecords(RecordKeeper &RK, raw_ostream &OS);
2257 void EmitJSON(RecordKeeper &RK, raw_ostream &OS);
2258 
2259 } // end namespace llvm
2260 
2261 #endif // LLVM_TABLEGEN_RECORD_H
llvm::Init::isComplete
virtual bool isComplete() const
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:351
llvm::CondOpInit::getConds
ArrayRef< Init * > getConds() const
Definition: Record.h:1020
llvm::FieldInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:2153
i
i
Definition: README.txt:29
llvm::VarBitInit::classof
static bool classof(const Init *I)
Definition: Record.h:1214
llvm::Init::IK_BinOpInit
@ IK_BinOpInit
Definition: Record.h:308
llvm::Record::getValue
RecordVal * getValue(StringRef Name)
Definition: Record.h:1720
llvm::TernOpInit::IF
@ IF
Definition: Record.h:918
llvm::Record::isSubClassOf
bool isSubClassOf(const Record *R) const
Definition: Record.h:1758
llvm::ShadowResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.h:2219
llvm::ListInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.cpp:720
llvm::DefInit::getFieldType
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
Definition: Record.cpp:1991
llvm::BinOpInit::XOR
@ XOR
Definition: Record.h:844
llvm::OpInit::operator=
OpInit & operator=(OpInit &)=delete
TrailingObjects.h
llvm::CondOpInit::const_val_iterator
SmallVectorImpl< Init * >::const_iterator const_val_iterator
Definition: Record.h:1037
llvm::RecordKeeper::getInputFilename
const std::string getInputFilename() const
Get the main TableGen input file's name.
Definition: Record.h:1904
llvm::TernOpInit::getOpcode
TernaryOp getOpcode() const
Definition: Record.h:959
llvm::Init::IK_StringInit
@ IK_StringInit
Definition: Record.h:317
llvm::VarBitInit::getBit
Init * getBit(unsigned B) const override
Get the Init value of the specified bit.
Definition: Record.h:1226
llvm::ListInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:736
llvm::ListInit::convertInitListSlice
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This function is used to implement the list slice selection operator.
Definition: Record.cpp:679
llvm::RecordVal::getPrintType
std::string getPrintType() const
Get the type of the field for printing purposes.
Definition: Record.cpp:2437
llvm::StringInit::operator=
StringInit & operator=(const StringInit &)=delete
llvm::IsAOpInit::Fold
Init * Fold() const
Definition: Record.cpp:1712
llvm::Resolver::setFinal
void setFinal(bool Final)
Definition: Record.h:2161
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::TernOpInit::getNumOperands
unsigned getNumOperands() const override
Definition: Record.h:949
llvm::SmallVectorImpl::erase
iterator erase(const_iterator CI)
Definition: SmallVector.h:741
llvm::tgtok::Def
@ Def
Definition: TGLexer.h:50
llvm::StringRecTy
'string' - Represent an string value
Definition: Record.h:168
llvm::IntInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:534
llvm::VarDefInit::args
ArrayRef< Init * > args() const
Definition: Record.h:1343
llvm::StringInit::hasCodeFormat
bool hasCodeFormat() const
Definition: Record.h:670
llvm::RecordKeeper
Definition: Record.h:1892
llvm::ExistsOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1818
llvm::RecordVal::isTemplateArg
bool isTemplateArg() const
Is this a template argument?
Definition: Record.h:1536
llvm::DagInit::name_begin
const_name_iterator name_begin() const
Definition: Record.h:1472
llvm::RecordVal::FK_Normal
@ FK_Normal
Definition: Record.h:1494
llvm::Init::convertInitializerTo
virtual Init * convertInitializerTo(RecTy *Ty) const =0
Convert to a value whose type is Ty, or return null if this is not possible.
llvm::CondOpInit::getCond
Init * getCond(unsigned Num) const
Definition: Record.h:1010
llvm::UnsetInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:489
llvm::Init::Opc
uint8_t Opc
Definition: Record.h:330
llvm::RecTy::DagRecTyKind
@ DagRecTyKind
Definition: Record.h:67
llvm::TypedInit::getCastTo
Init * getCastTo(RecTy *Ty) const override
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
Definition: Record.cpp:1862
llvm::AnonymousNameInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:583
llvm::Init::getCastTo
virtual Init * getCastTo(RecTy *Ty) const =0
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
llvm::Record::getDirectSuperClasses
void getDirectSuperClasses(SmallVectorImpl< Record * > &Classes) const
Append the direct superclasses of this record to Classes.
Definition: Record.cpp:2582
llvm::FieldInit::operator=
FieldInit & operator=(const FieldInit &)=delete
llvm::BitsInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:482
llvm::VarListElementInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1971
llvm::UnOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:919
llvm::OpInit
Base class for operators.
Definition: Record.h:761
llvm::TernOpInit::FOREACH
@ FOREACH
Definition: Record.h:918
llvm::ListInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:651
llvm::BinOpInit::get
static BinOpInit * get(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type)
Definition: Record.cpp:943
llvm::IntInit::convertInitializerBitRange
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
Definition: Record.cpp:562
llvm::OpInit::OpInit
OpInit(InitKind K, RecTy *Type, uint8_t Opc)
Definition: Record.h:763
llvm::Record::getValueAsListOfDefs
std::vector< Record * > getValueAsListOfDefs(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of records,...
Definition: Record.cpp:2743
StringRef.h
llvm::BinOpInit::AND
@ AND
Definition: Record.h:842
llvm::CondOpInit::val_size
size_t val_size() const
Definition: Record.h:1048
llvm::Record::Record
Record(Init *N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Anonymous=false, bool Class=false)
Definition: Record.h:1622
llvm::TernOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1601
llvm::FoldOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:1082
llvm::TypedInit::getFieldType
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
Definition: Record.cpp:1824
llvm::Record::getReferenceLocs
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
Definition: Record.h:1671
llvm::UnsetInit::getRecordKeeper
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
Definition: Record.h:477
llvm::RecordKeeper::getImpl
detail::RecordKeeperImpl & getImpl()
Return the internal implementation of the RecordKeeper.
Definition: Record.h:1901
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::IsAOpInit
!isa<type>(expr) - Dynamically determine the type of an expression.
Definition: Record.h:1092
llvm::RecTy::ListRecTyKind
@ ListRecTyKind
Definition: Record.h:66
llvm::TypedInit::operator=
TypedInit & operator=(const TypedInit &)=delete
llvm::BitsRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:147
llvm::UnsetInit::getAsString
std::string getAsString() const override
Get the string representation of the Init.
Definition: Record.h:492
llvm::OpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:747
llvm::VarListElementInit::getVariable
TypedInit * getVariable() const
Definition: Record.h:1256
llvm::BitsRecTy::getNumBits
unsigned getNumBits() const
Definition: Record.h:140
llvm::DagRecTy::get
static DagRecTy * get(RecordKeeper &RK)
Definition: Record.cpp:198
ErrorHandling.h
llvm::FieldInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:2146
llvm::TernOpInit::clone
OpInit * clone(ArrayRef< Init * > Operands) const override
Definition: Record.h:942
llvm::Record::getSuperClasses
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
Definition: Record.h:1692
llvm::VarDefInit::classof
static bool classof(const Init *I)
Definition: Record.h:1318
llvm::DagInit
(v a, b) - Represent a DAG tree value.
Definition: Record.h:1394
llvm::FieldInit::get
static FieldInit * get(Init *R, StringInit *FN)
Definition: Record.cpp:2132
llvm::tgtok::VarName
@ VarName
Definition: TGLexer.h:72
llvm::UnOpInit::getNumOperands
unsigned getNumOperands() const override
Definition: Record.h:815
llvm::LessRecordByID
Sorting predicate to sort record pointers by their unique ID.
Definition: Record.h:2038
llvm::Init::IK_CondOpInit
@ IK_CondOpInit
Definition: Record.h:312
llvm::OpInit::getOperand
virtual Init * getOperand(unsigned i) const =0
llvm::IntInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:603
llvm::RecordVal::getRecordKeeper
RecordKeeper & getRecordKeeper() const
Get the record keeper used to unique this value.
Definition: Record.h:1514
llvm::VarDefInit::args_empty
bool args_empty() const
Definition: Record.h:1341
llvm::RecordKeeper::~RecordKeeper
~RecordKeeper()
llvm::TrackUnresolvedResolver
(Optionally) delegate resolving to a sub-resolver, and keep track whether there were unresolved refer...
Definition: Record.h:2228
llvm::DagInit::arg_size
size_t arg_size() const
Definition: Record.h:1469
llvm::DefInit::classof
static bool classof(const Init *I)
Definition: Record.h:1277
llvm::RecordVal::getNameInitAsString
std::string getNameInitAsString() const
Get the name of the field as a std::string.
Definition: Record.h:1523
llvm::BinOpInit::DIV
@ DIV
Definition: Record.h:841
llvm::RecTy::print
void print(raw_ostream &OS) const
Definition: Record.h:88
llvm::CondOpInit::const_case_iterator
SmallVectorImpl< Init * >::const_iterator const_case_iterator
Definition: Record.h:1036
llvm::BinOpInit::OR
@ OR
Definition: Record.h:843
llvm::Init::IK_UnOpInit
@ IK_UnOpInit
Definition: Record.h:310
llvm::Record::addAssertion
void addAssertion(SMLoc Loc, Init *Condition, Init *Message)
Definition: Record.h:1747
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Record::getNewUID
static unsigned getNewUID(RecordKeeper &RK)
Definition: Record.cpp:2544
DenseMap.h
llvm::Timer
This class is used to track the amount of time spent between invocations of its startTimer()/stopTime...
Definition: Timer.h:81
llvm::IntRecTy
'int' - Represent an integer value of no particular size
Definition: Record.h:150
llvm::MapResolver::set
void set(Init *Key, Init *Value)
Definition: Record.h:2179
llvm::BinOpInit
!op (X, Y) - Combine two inits.
Definition: Record.h:835
llvm::tgtok::Bits
@ Bits
Definition: TGLexer.h:50
llvm::BinOpInit::SRA
@ SRA
Definition: Record.h:846
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:235
llvm::Record::removeValue
void removeValue(StringRef Name)
Definition: Record.h:1743
llvm::AnonymousNameInit::getNameInit
StringInit * getNameInit() const
Definition: Record.cpp:579
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:226
T1
#define T1
Definition: Mips16ISelLowering.cpp:340
llvm::TernOpInit
!op (X, Y, Z) - Combine two inits.
Definition: Record.h:916
llvm::RecTy::dump
void dump() const
Definition: Record.cpp:105
llvm::BinOpInit::operator=
BinOpInit & operator=(const BinOpInit &)=delete
llvm::DagRecTy
'dag' - Represent a dag fragment
Definition: Record.h:211
llvm::RecTy::BitsRecTyKind
@ BitsRecTyKind
Definition: Record.h:63
llvm::FoldOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1680
llvm::OpInit::clone
virtual OpInit * clone(ArrayRef< Init * > Operands) const =0
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::DagInit::getOperatorAsDef
Record * getOperatorAsDef(ArrayRef< SMLoc > Loc) const
Definition: Record.cpp:2366
llvm::FoldOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1071
llvm::BitRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:125
llvm::DagInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:2400
llvm::Record::getLoc
ArrayRef< SMLoc > getLoc() const
Definition: Record.h:1660
llvm::BinOpInit::GT
@ GT
Definition: Record.h:859
llvm::TernOpInit::SUBST
@ SUBST
Definition: Record.h:918
llvm::VarBitInit::get
static VarBitInit * get(TypedInit *T, unsigned B)
Definition: Record.cpp:1926
llvm::ListInit::get
static ListInit * get(ArrayRef< Init * > Range, RecTy *EltTy)
Definition: Record.cpp:624
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:891
llvm::Record::checkUnusedTemplateArgs
void checkUnusedTemplateArgs()
Definition: Record.cpp:2886
llvm::FoldOpInit::get
static FoldOpInit * get(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
Definition: Record.cpp:1628
llvm::Init::IK_FoldOpInit
@ IK_FoldOpInit
Definition: Record.h:313
llvm::Init::getBit
virtual Init * getBit(unsigned Bit) const =0
Get the Init value of the specified bit.
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::BinOpInit::getStrConcat
static Init * getStrConcat(Init *lhs, Init *rhs)
Definition: Record.cpp:1013
llvm::Init::getKind
InitKind getKind() const
Get the kind (type) of the value.
Definition: Record.h:337
llvm::Record::AssertionInfo::Message
Init * Message
Definition: Record.h:1582
llvm::TernOpInit::SUBSTR
@ SUBSTR
Definition: Record.h:918
llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
llvm::Init::IK_FirstTypedInit
@ IK_FirstTypedInit
Definition: Record.h:299
llvm::Record::getValueAsOptionalDef
Record * getValueAsOptionalDef(StringRef FieldName) const
This method looks up the specified field and returns its value as a Record, returning null if the fie...
Definition: Record.cpp:2814
llvm::Record::AssertionInfo::Loc
SMLoc Loc
Definition: Record.h:1580
llvm::OpInit::classof
static bool classof(const Init *I)
Definition: Record.h:770
llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::count
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
Definition: DenseSet.h:97
llvm::RecordVal::FieldKind
FieldKind
Definition: Record.h:1493
llvm::DagInit::getArg
Init * getArg(unsigned Num) const
Definition: Record.h:1435
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::VarInit
'Opcode' - Represent a reference to an entire variable object.
Definition: Record.h:1159
llvm::RecordRecTy::operator=
RecordRecTy & operator=(const RecordRecTy &)=delete
llvm::FieldInit::getRecord
Init * getRecord() const
Definition: Record.h:1377
llvm::RecordVal::FK_NonconcreteOK
@ FK_NonconcreteOK
Definition: Record.h:1495
llvm::Init::InitKind
InitKind
Discriminator enum (for isa<>, dyn_cast<>, et al.)
Definition: Record.h:297
llvm::IntInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:600
llvm::Record::getFieldLoc
SMLoc getFieldLoc(StringRef FieldName) const
Return the source location for the named field.
Definition: Record.cpp:2678
llvm::TernOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:931
llvm::AnonymousNameInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:587
llvm::DagInit::getOperator
Init * getOperator() const
Definition: Record.h:1424
llvm::RecTy
Definition: Record.h:58
llvm::ListRecTy::typeIsA
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
Definition: Record.cpp:192
llvm::DagInit::const_name_iterator
SmallVectorImpl< StringInit * >::const_iterator const_name_iterator
Definition: Record.h:1464
llvm::Init::operator=
Init & operator=(const Init &)=delete
llvm::TernOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1349
llvm::BitRecTy
'bit' - Represent a single bit
Definition: Record.h:109
llvm::TernOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:1433
llvm::TypedInit::TypedInit
TypedInit(InitKind K, RecTy *T, uint8_t Opc=0)
Definition: Record.h:426
llvm::LessRecordRegister::RecordParts::size
size_t size()
Definition: Record.h:2077
llvm::Record::getValueAsListInit
ListInit * getValueAsListInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a ListInit, throwing an exception i...
Definition: Record.cpp:2730
llvm::UnOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:817
llvm::CondOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:2246
llvm::ListInit::getElementType
RecTy * getElementType() const
Definition: Record.h:723
llvm::BinOpInit::getLHS
Init * getLHS() const
Definition: Record.h:901
PointerIntPair.h
llvm::BitsRecTy
'bits<n>' - Represent a fixed number of bits
Definition: Record.h:127
llvm::RecordKeeper::startBackendTimer
void startBackendTimer(StringRef Name)
Start timing the overall backend.
Definition: Record.cpp:2945
llvm::Resolver
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:2137
llvm::Record::getTemplateArgs
ArrayRef< Init * > getTemplateArgs() const
Definition: Record.h:1684
llvm::StringInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:687
llvm::get
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Definition: PointerIntPair.h:234
llvm::BitsRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:134
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::StringInit::SF_String
@ SF_String
Definition: Record.h:642
llvm::IntRecTy::getAsString
std::string getAsString() const override
Definition: Record.h:162
llvm::BinOpInit::getRHS
Init * getRHS() const
Definition: Record.h:902
llvm::ListInit::begin
const_iterator begin() const
Definition: Record.h:748
llvm::RecordVal::addReferenceLoc
void addReferenceLoc(SMRange Loc)
Add a reference to this record value.
Definition: Record.h:1556
llvm::Record::resolveReferences
void resolveReferences(Init *NewName=nullptr)
If there are any field references that refer to fields that have been filled in, we can propagate the...
Definition: Record.cpp:2631
llvm::RecTy::getRecordKeeper
RecordKeeper & getRecordKeeper() const
Return the RecordKeeper that uniqued this Type.
Definition: Record.h:85
llvm::RecordKeeper::startTimer
void startTimer(StringRef Name)
Start timing a phase. Automatically stops any previous phase timer.
Definition: Record.cpp:2923
llvm::BitsInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:460
llvm::CondOpInit::name_end
const_val_iterator name_end() const
Definition: Record.h:1046
llvm::FieldInit::getFieldName
StringInit * getFieldName() const
Definition: Record.h:1378
llvm::Record::Record
Record(const Record &O)
Definition: Record.h:1637
llvm::CondOpInit::getVals
ArrayRef< Init * > getVals() const
Definition: Record.h:1024
llvm::ShadowResolver::ShadowResolver
ShadowResolver(Resolver &R)
Definition: Record.h:2212
llvm::UnsetInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:482
llvm::Record::AssertionInfo::Condition
Init * Condition
Definition: Record.h:1581
llvm::UnOpInit::GETDAGOP
@ GETDAGOP
Definition: Record.h:788
llvm::LessRecordFieldName
Sorting predicate to sort record pointers by their name field.
Definition: Record.h:2046
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::Resolver::~Resolver
virtual ~Resolver()=default
llvm::BitInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:523
llvm::BitInit::get
static BitInit * get(RecordKeeper &RK, bool V)
Definition: Record.cpp:372
llvm::VarDefInit::getArg
Init * getArg(unsigned i) const
Definition: Record.h:1330
llvm::BitInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:517
llvm::VarListElementInit::getElementNum
unsigned getElementNum() const
Definition: Record.h:1257
llvm::CondOpInit::arg_begin
const_case_iterator arg_begin() const
Definition: Record.h:1039
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::StringRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:177
llvm::Record::AssertionInfo::AssertionInfo
AssertionInfo(SMLoc Loc, Init *Condition, Init *Message)
Definition: Record.h:1586
llvm::ListRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:196
llvm::FoldOpInit
!foldl (a, b, expr, start, lst) - Fold over a list.
Definition: Record.h:1055
llvm::Resolver::keepUnsetBits
virtual bool keepUnsetBits() const
Definition: Record.h:2154
llvm::BitsInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:468
llvm::UnOpInit::UnaryOp
UnaryOp
Definition: Record.h:788
llvm::IsAOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1732
llvm::DagInit::arg_empty
bool arg_empty() const
Definition: Record.h:1470
llvm::BinOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1284
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::BinOpInit::BinaryOp
BinaryOp
Definition: Record.h:837
llvm::ListInit::classof
static bool classof(const Init *I)
Definition: Record.h:712
llvm::AnonymousNameInit::operator=
AnonymousNameInit & operator=(const AnonymousNameInit &)=delete
llvm::ListRecTy::getElementType
RecTy * getElementType() const
Definition: Record.h:201
llvm::TrackUnresolvedResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:3044
llvm::Init::getRecordKeeper
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
Definition: Record.cpp:354
llvm::RecordKeeper::addDef
void addDef(std::unique_ptr< Record > R)
Definition: Record.h:1946
llvm::CondOpInit
!cond(condition_1: value1, ...
Definition: Record.h:980
llvm::Init::getFieldType
virtual RecTy * getFieldType(StringInit *FieldName) const
This function is used to implement the FieldInit class.
Definition: Record.h:400
llvm::StringInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:674
SI
@ SI
Definition: SIInstrInfo.cpp:7993
llvm::Record::AssertionInfo
Definition: Record.h:1579
llvm::DagInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:2390
llvm::UnOpInit::CAST
@ CAST
Definition: Record.h:788
llvm::DagRecTy::getAsString
std::string getAsString() const override
Definition: Record.cpp:202
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:486
DenseSet.h
llvm::Init::dump
void dump() const
Debugging method that may be called through a debugger; just invokes print on stderr.
Definition: Record.cpp:351
false
Definition: StackSlotColoring.cpp:141
llvm::LessRecord
Sorting predicate to sort record pointers by name.
Definition: Record.h:2028
llvm::RecordKeeper::stopBackendTimer
void stopBackendTimer()
Stop timing the overall backend.
Definition: Record.cpp:2952
llvm::BinOpInit::ADD
@ ADD
Definition: Record.h:838
llvm::Init::IK_DefInit
@ IK_DefInit
Definition: Record.h:303
llvm::TernOpInit::getRHS
Init * getRHS() const
Definition: Record.h:962
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Record::addTemplateArg
void addTemplateArg(Init *Name)
Definition: Record.h:1724
llvm::ListInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
Definition: Record.cpp:704
SMLoc.h
llvm::DagInit::classof
static bool classof(const Init *I)
Definition: Record.h:1413
llvm::TypedInit::getType
RecTy * getType() const
Get the type of the Init as a RecTy.
Definition: Record.h:439
llvm::Init::IK_TernOpInit
@ IK_TernOpInit
Definition: Record.h:309
llvm::Record::getNameInitAsString
std::string getNameInitAsString() const
Definition: Record.h:1654
llvm::RecordRecTy::getAsString
std::string getAsString() const override
Definition: Record.cpp:261
llvm::ExistsOpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1814
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::FoldOpInit::operator=
FoldOpInit & operator=(const FoldOpInit &)=delete
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:292
llvm::OpInit::getNumOperands
virtual unsigned getNumOperands() const =0
llvm::BinOpInit::getListConcat
static Init * getListConcat(TypedInit *lhs, Init *rhs)
Definition: Record.cpp:1030
llvm::StringRef::data
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
llvm::DefInit::getDef
Record * getDef() const
Definition: Record.h:1285
llvm::ListInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:728
llvm::DagInit::getName
StringInit * getName() const
Definition: Record.h:1427
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:687
llvm::IsAOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:1115
llvm::IsAOpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1739
llvm::VarDefInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:2031
llvm::Record::getValue
const RecordVal * getValue(StringRef Name) const
Definition: Record.h:1712
llvm::HasReferenceResolver
Do not resolve anything, but keep track of whether a given variable was referenced.
Definition: Record.h:2243
llvm::BitsInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:572
llvm::TernOpInit::get
static TernOpInit * get(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs, RecTy *Type)
Definition: Record.cpp:1334
llvm::RecordVal::getValue
Init * getValue() const
Get the value of the field as an Init.
Definition: Record.h:1547
llvm::RecordKeeper::startPhaseTiming
void startPhaseTiming()
Start phase timing; called if the –time-phases option is specified.
Definition: Record.h:1963
llvm::CondOpInit::getNumConds
unsigned getNumConds() const
Definition: Record.h:1008
llvm::IntInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:524
llvm::CondOpInit::get
static CondOpInit * get(ArrayRef< Init * > C, ArrayRef< Init * > V, RecTy *Type)
Definition: Record.cpp:2198
llvm::UnsetInit::classof
static bool classof(const Init *I)
Definition: Record.h:469
llvm::ShadowResolver::addShadow
void addShadow(Init *Key)
Definition: Record.h:2217
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::AnonymousNameInit
"anonymous_n" - Represent an anonymous record name
Definition: Record.h:609
llvm::DagInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:1478
llvm::DagInit::name_size
size_t name_size() const
Definition: Record.h:1475
llvm::FieldInit
X.Y - Represent a reference to a subfield of a variable.
Definition: Record.h:1351
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:110
llvm::RecordVal::getReferenceLocs
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
Definition: Record.h:1559
llvm::TernOpInit::DAG
@ DAG
Definition: Record.h:918
llvm::RecordVal::dump
void dump() const
Definition: Record.cpp:2501
llvm::Record::dump
void dump() const
Definition: Record.cpp:2639
llvm::IsAOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1743
llvm::ListInit::const_iterator
Init *const * const_iterator
Definition: Record.h:699
llvm::BitsInit::operator=
BitsInit & operator=(const BitsInit &)=delete
llvm::BinOpInit::LISTSPLAT
@ LISTSPLAT
Definition: Record.h:849
llvm::Init::IK_VarDefInit
@ IK_VarDefInit
Definition: Record.h:321
Operands
mir Rename Register Operands
Definition: MIRNamerPass.cpp:74
llvm::LessRecordByID::operator()
bool operator()(const Record *LHS, const Record *RHS) const
Definition: Record.h:2039
llvm::StringInit::SF_Code
@ SF_Code
Definition: Record.h:643
llvm::RecordVal::setUsed
void setUsed(bool Used)
Whether this value is used.
Definition: Record.h:1563
llvm::Init::IK_VarBitInit
@ IK_VarBitInit
Definition: Record.h:320
llvm::BitInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:376
llvm::TernOpInit::TernaryOp
TernaryOp
Definition: Record.h:918
llvm::RecordRecTy::typeIsA
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
Definition: Record.cpp:297
llvm::IntInit::classof
static bool classof(const Init *I)
Definition: Record.h:589
llvm::Record::getValueAsOptionalString
std::optional< StringRef > getValueAsOptionalString(StringRef FieldName) const
This method looks up the specified field and returns its value as a string, throwing an exception if ...
Definition: Record.cpp:2703
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::Record::getAssertions
ArrayRef< AssertionInfo > getAssertions() const
Definition: Record.h:1690
llvm::BinOpInit::NE
@ NE
Definition: Record.h:855
llvm::TrackUnresolvedResolver::TrackUnresolvedResolver
TrackUnresolvedResolver(Resolver *R=nullptr)
Definition: Record.h:2233
llvm::PointerIntPair::getPointer
PointerTy getPointer() const
Definition: PointerIntPair.h:60
llvm::VarBitInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1934
llvm::VarDefInit::operator=
VarDefInit & operator=(const VarDefInit &)=delete
llvm::CondOpInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:2268
llvm::FieldInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:2168
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::UnOpInit
!op (X) - Transform an init.
Definition: Record.h:786
Timer.h
llvm::RecordVal::isUsed
bool isUsed() const
Definition: Record.h:1564
llvm::RecordVal::setValue
bool setValue(Init *V)
Set the value of the field from an Init.
Definition: Record.cpp:2452
llvm::Resolver::getCurrentRecord
Record * getCurrentRecord() const
Definition: Record.h:2145
llvm::Init::isConcrete
virtual bool isConcrete() const
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:355
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:274
llvm::ListInit::operator=
ListInit & operator=(const ListInit &)=delete
llvm::UnOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:800
llvm::Init::IK_AnonymousNameInit
@ IK_AnonymousNameInit
Definition: Record.h:316
llvm::VarDefInit::args_end
const_iterator args_end() const
Definition: Record.h:1338
llvm::UnsetInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:368
llvm::VarListElementInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1958
llvm::BitInit::getValue
bool getValue() const
Definition: Record.h:513
llvm::IsAOpInit::get
static IsAOpInit * get(RecTy *CheckType, Init *Expr)
Definition: Record.cpp:1693
llvm::EmitDetailedRecords
void EmitDetailedRecords(RecordKeeper &RK, raw_ostream &OS)
Definition: DetailedRecordsBackend.cpp:198
llvm::IntInit
'7' - Represent an initialization by a literal integer value.
Definition: Record.h:579
llvm::Record::getDefInit
DefInit * getDefInit()
get the corresponding DefInit.
Definition: Record.cpp:2536
llvm::DefInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1997
llvm::DefInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:1984
llvm::ListInit
[AL, AH, CL] - Represent a list of defs
Definition: Record.h:694
llvm::StringInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:607
llvm::Init::convertInitListSlice
virtual Init * convertInitListSlice(ArrayRef< unsigned > Elements) const
This function is used to implement the list slice selection operator.
Definition: Record.h:393
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::StringInit::classof
static bool classof(const Init *I)
Definition: Record.h:657
llvm::Record::updateClassLoc
void updateClassLoc(SMLoc Loc)
Definition: Record.cpp:2514
llvm::MapResolver
Resolve arbitrary mappings.
Definition: Record.h:2165
llvm::RecordVal::print
void print(raw_ostream &OS, bool PrintSem=true) const
Print the value to an output stream, possibly with a semicolon.
Definition: Record.cpp:2504
llvm::Init::~Init
virtual ~Init()=default
llvm::BitsInit::get
static BitsInit * get(RecordKeeper &RK, ArrayRef< Init * > Range)
Definition: Record.cpp:400
llvm::RecordRecTy::const_record_iterator
Record *const * const_record_iterator
Definition: Record.h:261
llvm::Record::getValues
ArrayRef< RecordVal > getValues() const
Definition: Record.h:1688
llvm::DefInit
AL - Represent a reference to a 'def' in the description.
Definition: Record.h:1266
llvm::TernOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1571
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::Init::IK_ExistsOpInit
@ IK_ExistsOpInit
Definition: Record.h:315
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:31
llvm::DenseMap
Definition: DenseMap.h:714
llvm::VarInit::get
static VarInit * get(StringRef VN, RecTy *T)
Definition: Record.cpp:1896
llvm::Init::Init
Init(InitKind K, uint8_t Opc=0)
Definition: Record.h:343
llvm::RecordRecTy
'[classname]' - Type of record values that have zero or more superclasses.
Definition: Record.h:230
llvm::ShadowResolver
Delegate resolving to a sub-resolver, but shadow some variable names.
Definition: Record.h:2207
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::Record::addValue
void addValue(const RecordVal &RV)
Definition: Record.h:1729
llvm::PointerIntPair::getInt
IntType getInt() const
Definition: PointerIntPair.h:62
llvm::BitsInit::allInComplete
bool allInComplete() const
Definition: Record.h:561
llvm::ListInit::size
size_t size() const
Definition: Record.h:751
StringExtras.h
llvm::Resolver::Resolver
Resolver(Record *CurRec)
Definition: Record.h:2142
llvm::BitInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:522
llvm::Init::IK_First
@ IK_First
Definition: Record.h:298
llvm::Record::appendReferenceLoc
void appendReferenceLoc(SMRange Loc)
Add a reference to this record value.
Definition: Record.h:1668
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1869
llvm::ListInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:754
ArrayRef.h
llvm::Record::isClass
bool isClass() const
Definition: Record.h:1682
llvm::IntInit::getValue
int64_t getValue() const
Definition: Record.h:595
llvm::IntRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:156
llvm::Record::checkRecordAssertions
void checkRecordAssertions()
Definition: Record.cpp:2874
llvm::BinOpInit::clone
OpInit * clone(ArrayRef< Init * > Operands) const override
Definition: Record.h:885
llvm::BitsRecTy::typeIsA
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
Definition: Record.cpp:154
llvm::resolveTypes
RecTy * resolveTypes(RecTy *T1, RecTy *T2)
Find a common type that T1 and T2 convert to.
Definition: Record.cpp:318
llvm::BinOpInit::GE
@ GE
Definition: Record.h:858
llvm::DefInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:1291
llvm::BinOpInit::SHL
@ SHL
Definition: Record.h:845
llvm::UnOpInit::LOG2
@ LOG2
Definition: Record.h:788
llvm::ExistsOpInit::get
static ExistsOpInit * get(RecTy *CheckType, Init *Expr)
Definition: Record.cpp:1755
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:582
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ListRecTy
'list<Ty>' - Represent a list of element values, all of which must be of the specified type.
Definition: Record.h:187
llvm::Record::getValueAsListOfStrings
std::vector< StringRef > getValueAsListOfStrings(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of strings,...
Definition: Record.cpp:2787
llvm::IsAOpInit::operator=
IsAOpInit & operator=(const IsAOpInit &)=delete
llvm::RecordKeeper::RecordKeeper
RecordKeeper()
Definition: Record.cpp:2895
llvm::FoldOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1661
llvm::RecordKeeper::stopPhaseTiming
void stopPhaseTiming()
Stop phase timing and print the report.
Definition: Record.h:1981
llvm::Init::IK_FieldInit
@ IK_FieldInit
Definition: Record.h:304
llvm::TypedInit::convertInitializerBitRange
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
Definition: Record.cpp:1846
llvm::BinOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:1116
llvm::RecordKeeper::getAllDerivedDefinitionsIfDefined
std::vector< Record * > getAllDerivedDefinitionsIfDefined(StringRef ClassName) const
Get all the concrete records that inherit from specified class, if the class is defined.
Definition: Record.cpp:2996
llvm::DefInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:1294
llvm::Init::resolveReferences
virtual Init * resolveReferences(Resolver &R) const
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.h:408
llvm::BinOpInit::LISTCONCAT
@ LISTCONCAT
Definition: Record.h:848
llvm::CondOpInit::arg_end
const_case_iterator arg_end() const
Definition: Record.h:1040
llvm::Init::getAsUnquotedString
virtual std::string getAsUnquotedString() const
Convert this value to a literal form, without adding quotes around a string.
Definition: Record.h:365
llvm::Record::removeValue
void removeValue(Init *Name)
Definition: Record.h:1734
llvm::Record::getValueAsListOfInts
std::vector< int64_t > getValueAsListOfInts(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of integers,...
Definition: Record.cpp:2771
llvm::BinOpInit::EQ
@ EQ
Definition: Record.h:854
llvm::IntInit::get
static IntInit * get(RecordKeeper &RK, int64_t V)
Definition: Record.cpp:517
llvm::Record::getForwardDeclarationLocs
ArrayRef< SMLoc > getForwardDeclarationLocs() const
Definition: Record.h:1663
llvm::RecordResolver::RecordResolver
RecordResolver(Record &R)
Definition: Record.h:2197
llvm::VarBitInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1938
B
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional ldr LCPI1_0 ldr ldr tst movne lsr ldr LCPI1_1 and r0 bx lr it saves an instruction and a register It might be profitable to cse MOVi16 if there are lots of bit immediates with the same bottom half Robert Muth started working on an alternate jump table implementation that does not put the tables in line in the text This is more like the llvm default jump table implementation This might be useful sometime Several revisions of patches are on the mailing beginning while CMP sets them like a subtract Therefore to be able to use CMN for comparisons other than the Z we ll need additional logic to reverse the conditionals associated with the comparison Perhaps a pseudo instruction for the with a post codegen pass to clean up and handle the condition codes See PR5694 for testcase Given the following on int B
Definition: README.txt:592
llvm::Record::getValueAsDag
DagInit * getValueAsDag(StringRef FieldName) const
This method looks up the specified field and returns its value as an Dag, throwing an exception if th...
Definition: Record.cpp:2858
llvm::RecordKeeper::getDefs
const RecordMap & getDefs() const
Get the map of records (defs).
Definition: Record.h:1910
llvm::Record
Definition: Record.h:1577
llvm::VarInit::getName
StringRef getName() const
Definition: Record.cpp:1909
llvm::MapResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:3001
llvm::ExistsOpInit
!exists<type>(expr) - Dynamically determine if a record of type named expr exists.
Definition: Record.h:1126
llvm::RecordKeeper::getClass
Record * getClass(StringRef Name) const
Get the class with the specified name.
Definition: Record.h:1916
llvm::BinOpInit::SUB
@ SUB
Definition: Record.h:839
llvm::AnonymousNameInit::classof
static bool classof(const Init *I)
Definition: Record.h:619
llvm::Init::getAsString
virtual std::string getAsString() const =0
Convert this value to a literal form.
llvm::StringRef::compare_numeric
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Definition: StringRef.cpp:61
llvm::VarInit::getNameInitAsString
std::string getNameInitAsString() const
Definition: Record.h:1179
llvm::RecordResolver::setName
void setName(Init *NewName)
Definition: Record.h:2199
llvm::StringRecTy::getAsString
std::string getAsString() const override
Definition: Record.cpp:173
llvm::Record::Record
Record(StringRef N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Class=false)
Definition: Record.h:1630
llvm::UnOpInit::NOT
@ NOT
Definition: Record.h:788
llvm::Record::getValueAsBitsInit
BitsInit * getValueAsBitsInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a BitsInit, throwing an exception i...
Definition: Record.cpp:2718
llvm::VarInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:1192
llvm::Record::getType
RecordRecTy * getType()
Definition: Record.cpp:2530
llvm::RecordKeeper::getClasses
const RecordMap & getClasses() const
Get the map of classes.
Definition: Record.h:1907
llvm::TypedInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:1835
llvm::VarInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This method is used by classes that refer to other variables which may not be defined at the time the...
Definition: Record.cpp:1920
llvm::StringInit
"foo" - Represent an initialization by a string value.
Definition: Record.h:639
llvm::BitsInit::convertInitializerTo
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
Definition: Record.cpp:422
llvm::BinOpInit::INTERLEAVE
@ INTERLEAVE
Definition: Record.h:852
isDigit
static bool isDigit(const char C)
Definition: RustDemangle.cpp:173
llvm::Record::isSubClassOf
bool isSubClassOf(StringRef Name) const
Definition: Record.h:1765
llvm::RecordKeeper::getAllDerivedDefinitions
std::vector< Record * > getAllDerivedDefinitions(StringRef ClassName) const
Get all the concrete records that inherit from the one specified class.
Definition: Record.cpp:2962
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:33
llvm::Record::addSuperClass
void addSuperClass(Record *R, SMRange Range)
Definition: Record.h:1777
llvm::CondOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:2292
llvm::UnOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:774
llvm::Init::IK_IntInit
@ IK_IntInit
Definition: Record.h:305
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::LessRecordRegister::RecordParts::Parts
SmallVector< std::pair< bool, StringRef >, 4 > Parts
Definition: Record.h:2054
llvm::BitsInit::getNumBits
unsigned getNumBits() const
Definition: Record.h:550
llvm::TernOpInit::getLHS
Init * getLHS() const
Definition: Record.h:960
llvm::FoldingSetBase::Node
Node - This class is used to maintain the singly linked bucket list in a folding set.
Definition: FoldingSet.h:136
llvm::AnonymousNameInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:633
llvm::BitInit
'true'/'false' - Represent a concrete initializer for a bit.
Definition: Record.h:496
llvm::RecordKeeper::getGlobal
Init * getGlobal(StringRef Name) const
Get the Init value of the specified global variable.
Definition: Record.h:1928
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::CondOpInit::getVal
Init * getVal(unsigned Num) const
Definition: Record.h:1015
llvm::RecordVal::getNameInit
Init * getNameInit() const
Get the name of the field as an Init.
Definition: Record.h:1520
llvm::RecTy::typeIsA
virtual bool typeIsA(const RecTy *RHS) const
Return true if 'this' type is equal to or a subtype of RHS.
Definition: Record.cpp:119
llvm::EmitJSON
void EmitJSON(RecordKeeper &RK, raw_ostream &OS)
Definition: JSONBackend.cpp:184
llvm::Record::getNameInit
Init * getNameInit() const
Definition: Record.h:1650
llvm::RecordRecTy::getClasses
ArrayRef< Record * > getClasses() const
Definition: Record.h:257
llvm::CondOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.cpp:2280
llvm::FoldOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1643
llvm::ListRecTy::get
static ListRecTy * get(RecTy *T)
Definition: Record.h:200
llvm::Record::getID
unsigned getID() const
Definition: Record.h:1646
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:318
llvm::ListInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:645
llvm::ListInit::empty
bool empty() const
Definition: Record.h:752
llvm::VarDefInit::args_size
size_t args_size() const
Definition: Record.h:1340
llvm::DagInit::getArgNames
ArrayRef< StringInit * > getArgNames() const
Definition: Record.h:1454
llvm::HasReferenceResolver::found
bool found() const
Definition: Record.h:2251
llvm::Init::IK_DagInit
@ IK_DagInit
Definition: Record.h:302
llvm::DagInit::const_arg_iterator
SmallVectorImpl< Init * >::const_iterator const_arg_iterator
Definition: Record.h:1463
llvm::Init::IK_BitsInit
@ IK_BitsInit
Definition: Record.h:301
llvm::BitRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:115
llvm::DagInit::operator=
DagInit & operator=(const DagInit &)=delete
llvm::RecordVal::FK_TemplateArg
@ FK_TemplateArg
Definition: Record.h:1496
llvm::DagInit::getArgs
ArrayRef< Init * > getArgs() const
Definition: Record.h:1450
llvm::MapResolver::isComplete
bool isComplete(Init *VarName) const
Definition: Record.h:2181
llvm::Init
Definition: Record.h:282
llvm::BitRecTy::getAsString
std::string getAsString() const override
Definition: Record.h:121
llvm::DagInit::getArgNameStr
StringRef getArgNameStr(unsigned Num) const
Definition: Record.h:1445
llvm::Record::getValueAsBitOrUnset
bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const
This method looks up the specified field and returns its value as a bit.
Definition: Record.cpp:2841
llvm::RecTy::getListTy
ListRecTy * getListTy()
Returns the type representing list<thistype>.
Definition: Record.cpp:108
llvm::Init::IK_VarListElementInit
@ IK_VarListElementInit
Definition: Record.h:319
llvm::IsAOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1708
llvm::MapResolver::MapResolver
MapResolver(Record *CurRec=nullptr)
Definition: Record.h:2177
llvm::RecordVal::getName
StringRef getName() const
Get the name of the field as a StringRef.
Definition: Record.cpp:2433
llvm::CondOpInit::name_begin
const_val_iterator name_begin() const
Definition: Record.h:1045
llvm::RecordKeeper::stopTimer
void stopTimer()
Stop timing a phase.
Definition: Record.cpp:2938
FoldingSet.h
llvm::BitsInit::classof
static bool classof(const Init *I)
Definition: Record.h:542
llvm::RecordRecTy::classes_end
const_record_iterator classes_end() const
Definition: Record.h:264
llvm::BinOpInit::CompareInit
std::optional< bool > CompareInit(unsigned Opc, Init *LHS, Init *RHS) const
Definition: Record.cpp:1040
llvm::ExistsOpInit::operator=
ExistsOpInit & operator=(const ExistsOpInit &)=delete
llvm::Record::getValueAsInt
int64_t getValueAsInt(StringRef FieldName) const
This method looks up the specified field and returns its value as an int64_t, throwing an exception i...
Definition: Record.cpp:2756
llvm::DagInit::arg_begin
const_arg_iterator arg_begin() const
Definition: Record.h:1466
llvm::LessRecordRegister
Definition: Record.h:2052
llvm::BitsInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:418
llvm::DagInit::getNumArgs
unsigned getNumArgs() const
Definition: Record.h:1433
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
llvm::FieldInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:1386
llvm::VarBitInit::operator=
VarBitInit & operator=(const VarBitInit &)=delete
llvm::CondOpInit::getValType
RecTy * getValType() const
Definition: Record.h:1006
llvm::LessRecordRegister::RecordParts::getPart
std::pair< bool, StringRef > getPart(size_t i)
Definition: Record.h:2079
llvm::HasReferenceResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:3064
llvm::BitsInit::convertInitializerBitRange
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
Definition: Record.cpp:449
llvm::BitsRecTy::get
static BitsRecTy * get(RecordKeeper &RK, unsigned Sz)
Definition: Record.cpp:133
llvm::ListInit::getValues
ArrayRef< Init * > getValues() const
Definition: Record.h:744
llvm::UnsetInit
'?' - Represents an uninitialized value.
Definition: Record.h:457
llvm::CondOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:997
llvm::DagInit::get
static DagInit * get(Init *V, StringInit *VN, ArrayRef< Init * > ArgRange, ArrayRef< StringInit * > NameRange)
Definition: Record.cpp:2323
llvm::BinOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:892
llvm::UnOpInit::SIZE
@ SIZE
Definition: Record.h:788
llvm::BinOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1294
llvm::DagInit::getNameStr
StringRef getNameStr() const
Definition: Record.h:1429
llvm::TernOpInit::getMHS
Init * getMHS() const
Definition: Record.h:961
llvm::LessRecordRegister::RecordParts
Definition: Record.h:2053
llvm::RecordVal::getType
RecTy * getType() const
Get the type of the field value as a RecTy.
Definition: Record.h:1541
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::UnOpInit::get
static UnOpInit * get(UnaryOp opc, Init *lhs, RecTy *Type)
Definition: Record.cpp:760
llvm::Init::IK_FirstOpInit
@ IK_FirstOpInit
Definition: Record.h:307
llvm::TimerGroup
The TimerGroup class is used to group together related timers into a single report that is printed wh...
Definition: Timer.h:175
llvm::StringRecTy::get
static StringRecTy * get(RecordKeeper &RK)
Definition: Record.cpp:169
llvm::RecordRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:247
llvm::BinOpInit::SRL
@ SRL
Definition: Record.h:847
llvm::StringInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:676
llvm::TernOpInit::FILTER
@ FILTER
Definition: Record.h:918
NC
#define NC
Definition: regutils.h:42
llvm::ListInit::end
const_iterator end() const
Definition: Record.h:749
llvm::Resolver::resolve
virtual Init * resolve(Init *VarName)=0
Return the initializer for the given variable name (should normally be a StringInit),...
llvm::FieldInit::classof
static bool classof(const Init *I)
Definition: Record.h:1371
llvm::RecordVal::isNonconcreteOK
bool isNonconcreteOK() const
Is this a field where nonconcrete values are okay?
Definition: Record.h:1531
llvm::VarDefInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:2087
llvm::Record::getRecords
RecordKeeper & getRecords() const
Definition: Record.h:1798
llvm::BinOpInit::getOpcode
BinaryOp getOpcode() const
Definition: Record.h:900
llvm::Record::isAnonymous
bool isAnonymous() const
Definition: Record.h:1802
llvm::Record::getValue
const RecordVal * getValue(const Init *Name) const
Definition: Record.h:1706
llvm::VarInit::getNameInit
Init * getNameInit() const
Definition: Record.h:1177
llvm::StringInit::getValue
StringRef getValue() const
Definition: Record.h:668
llvm::FieldInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:2140
llvm::RecordResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:3019
Casting.h
llvm::DagInit::name_empty
bool name_empty() const
Definition: Record.h:1476
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::CondOpInit::case_size
size_t case_size() const
Definition: Record.h:1042
llvm::Init::IK_VarInit
@ IK_VarInit
Definition: Record.h:318
llvm::LessRecord::operator()
bool operator()(const Record *Rec1, const Record *Rec2) const
Definition: Record.h:2029
llvm::VarBitInit::getBitNum
unsigned getBitNum() const
Definition: Record.h:1221
llvm::BitInit::operator=
BitInit & operator=(BitInit &)=delete
llvm::TrailingObjects
See the file comment for details on the usage of the TrailingObjects type.
Definition: TrailingObjects.h:212
llvm::TypedInit::getRecordKeeper
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
Definition: Record.h:442
llvm::UnOpInit::TAIL
@ TAIL
Definition: Record.h:788
llvm::detail::RecordKeeperImpl
This class represents the internal implementation of the RecordKeeper.
Definition: Record.cpp:53
llvm::ListRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:186
llvm::BinOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:873
llvm::Record::getValueInit
Init * getValueInit(StringRef FieldName) const
Return the initializer for a value with the specified name, or throw an exception if the field does n...
Definition: Record.cpp:2686
llvm::UnOpInit::HEAD
@ HEAD
Definition: Record.h:788
llvm::Init::convertInitializerBitRange
virtual Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const
This function is used to implement the bit range selection operator.
Definition: Record.h:385
llvm::RecTy::StringRecTyKind
@ StringRecTyKind
Definition: Record.h:65
llvm::VarInit::classof
static bool classof(const Init *I)
Definition: Record.h:1169
llvm::ListRecTy::getAsString
std::string getAsString() const override
Definition: Record.cpp:182
llvm::DagInit::arg_end
const_arg_iterator arg_end() const
Definition: Record.h:1467
llvm::Init::print
void print(raw_ostream &OS) const
Print this value.
Definition: Record.h:358
llvm::ExistsOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:1807
llvm::RecordRecTy::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:257
llvm::CondOpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:2303
llvm::tgtok::Class
@ Class
Definition: TGLexer.h:50
llvm::UnOpInit::clone
OpInit * clone(ArrayRef< Init * > Operands) const override
Definition: Record.h:809
llvm::VarInit::operator=
VarInit & operator=(const VarInit &)=delete
llvm::VarListElementInit::get
static VarListElementInit * get(TypedInit *T, unsigned E)
Definition: Record.cpp:1946
llvm::DefInit::operator=
DefInit & operator=(const DefInit &)=delete
llvm::UnsetInit::getCastTo
Init * getCastTo(RecTy *Ty) const override
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
Definition: Record.cpp:364
llvm::RecTy::~RecTy
virtual ~RecTy()=default
llvm::LessRecordRegister::operator()
bool operator()(const Record *Rec1, const Record *Rec2) const
Definition: Record.h:2085
llvm::RecordKeeper::saveInputFilename
void saveInputFilename(std::string Filename)
Definition: Record.h:1935
llvm::Record::isTemplateArg
bool isTemplateArg(Init *Name) const
Definition: Record.h:1702
llvm::UnsetInit::operator=
UnsetInit & operator=(const UnsetInit &)=delete
llvm::RecTy::typeIsConvertibleTo
virtual bool typeIsConvertibleTo(const RecTy *RHS) const
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:114
llvm::CondOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:2223
llvm::RecordVal::getLoc
const SMLoc & getLoc() const
Get the source location of the point where the field was defined.
Definition: Record.h:1528
llvm::RecordRecTy::classes_begin
const_record_iterator classes_begin() const
Definition: Record.h:263
llvm::BinOpInit::LT
@ LT
Definition: Record.h:857
llvm::VarListElementInit::operator=
VarListElementInit & operator=(const VarListElementInit &)=delete
llvm::TernOpInit::FIND
@ FIND
Definition: Record.h:918
llvm::RecTy::getAsString
virtual std::string getAsString() const =0
llvm::Init::IK_ListInit
@ IK_ListInit
Definition: Record.h:306
SuperClass
llvm::PointerIntPair
PointerIntPair - This class implements a pair of a pointer and small integer.
Definition: PointerIntPair.h:46
llvm::BinOpInit::SETDAGOP
@ SETDAGOP
Definition: Record.h:860
llvm::VarDefInit::const_iterator
Init *const * const_iterator
Definition: Record.h:1335
llvm::RecordVal::RecordVal
RecordVal(Init *N, RecTy *T, FieldKind K)
Definition: Record.cpp:2419
llvm::RecTy::RecordRecTyKind
@ RecordRecTyKind
Definition: Record.h:68
SmallVector.h
llvm::RecTy::getRecTyKind
RecTyKind getRecTyKind() const
Definition: Record.h:82
llvm::Record::getName
StringRef getName() const
Definition: Record.h:1648
llvm::RecTy::BitRecTyKind
@ BitRecTyKind
Definition: Record.h:62
llvm::IntInit::operator=
IntInit & operator=(const IntInit &)=delete
llvm::RecordRecTy::get
static RecordRecTy * get(RecordKeeper &RK, ArrayRef< Record * > Classes)
Get the record type with the given non-redundant list of superclasses.
Definition: Record.cpp:213
llvm::ListInit::getElementAsRecord
Record * getElementAsRecord(unsigned i) const
Definition: Record.cpp:696
llvm::Record::appendLoc
void appendLoc(SMLoc Loc)
Definition: Record.h:1661
llvm::RecordResolver::keepUnsetBits
bool keepUnsetBits() const override
Definition: Record.h:2203
llvm::FoldOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:1647
llvm::SMRange
Represents a range in source code.
Definition: SMLoc.h:48
List
const NodeList & List
Definition: RDFGraph.cpp:199
llvm::UnOpInit::Fold
Init * Fold(Record *CurRec, bool IsFinal=false) const
Definition: Record.cpp:778
N
#define N
llvm::StringInit::determineFormat
static StringFormat determineFormat(StringFormat Fmt1, StringFormat Fmt2)
Definition: Record.h:664
llvm::Init::IK_LastOpInit
@ IK_LastOpInit
Definition: Record.h:311
llvm::Record::getValueAsBit
bool getValueAsBit(StringRef FieldName) const
This method looks up the specified field and returns its value as a bit, throwing an exception if the...
Definition: Record.cpp:2829
llvm::Record::appendAssertions
void appendAssertions(const Record *Rec)
Definition: Record.h:1751
llvm::RecTy::RecTyKind
RecTyKind
Subclass discriminator (for dyn_cast<> et al.)
Definition: Record.h:61
llvm::VarBitInit
Opcode{0} - Represent access to one bit of a variable or field.
Definition: Record.h:1196
llvm::CondOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:2192
llvm::TrackUnresolvedResolver::foundUnresolved
bool foundUnresolved() const
Definition: Record.h:2236
llvm::BinOpInit::STRCONCAT
@ STRCONCAT
Definition: Record.h:851
llvm::VarBitInit::getBitVar
Init * getBitVar() const
Definition: Record.h:1220
llvm::TernOpInit::operator=
TernOpInit & operator=(const TernOpInit &)=delete
llvm::Record::getValueAsString
StringRef getValueAsString(StringRef FieldName) const
This method looks up the specified field and returns its value as a string, throwing an exception if ...
Definition: Record.cpp:2694
llvm::RecordKeeper::getNewAnonymousName
Init * getNewAnonymousName()
GetNewAnonymousName - Generate a unique anonymous name that can be used as an identifier.
Definition: Record.cpp:2916
llvm::DagInit::getArgName
StringInit * getArgName(unsigned Num) const
Definition: Record.h:1440
llvm::tgtok::Bit
@ Bit
Definition: TGLexer.h:50
llvm::BitsRecTy::getAsString
std::string getAsString() const override
Definition: Record.cpp:143
llvm::UnOpInit::getOperand
Init * getOperand() const
Definition: Record.h:823
llvm::UnOpInit::EMPTY
@ EMPTY
Definition: Record.h:788
llvm::BinOpInit::MUL
@ MUL
Definition: Record.h:840
llvm::DagInit::name_end
const_name_iterator name_end() const
Definition: Record.h:1473
llvm::UnsetInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:487
llvm::CondOpInit::val_empty
bool val_empty() const
Definition: Record.h:1049
llvm::MipsISD::Ins
@ Ins
Definition: MipsISelLowering.h:160
llvm::TernOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:968
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::VarDefInit::args_begin
const_iterator args_begin() const
Definition: Record.h:1337
llvm::StringInit::getFormat
StringFormat getFormat() const
Definition: Record.h:669
llvm::VarListElementInit::classof
static bool classof(const Init *I)
Definition: Record.h:1250
llvm::BitInit::classof
static bool classof(const Init *I)
Definition: Record.h:507
llvm::BinOpInit::LE
@ LE
Definition: Record.h:856
llvm::ArrayRef
ArrayRef(const T &OneElt) -> ArrayRef< T >
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:222
llvm::StringInit::StringFormat
StringFormat
Definition: Record.h:641
llvm::RecordResolver
Resolve all variables from a record except for unset variables.
Definition: Record.h:2191
llvm::RecordKeeper::addClass
void addClass(std::unique_ptr< Record > R)
Definition: Record.h:1939
llvm::StringInit::getAsUnquotedString
std::string getAsUnquotedString() const override
Convert this value to a literal form, without adding quotes around a string.
Definition: Record.h:683
llvm::DagInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:2373
llvm::UnOpInit::resolveReferences
Init * resolveReferences(Resolver &R) const override
This function is used by classes that refer to other variables which may not be defined at the time t...
Definition: Record.cpp:910
llvm::CondOpInit::case_empty
bool case_empty() const
Definition: Record.h:1043
llvm::AnonymousNameInit::getValue
unsigned getValue() const
Definition: Record.h:625
llvm::BinOpInit::CONCAT
@ CONCAT
Definition: Record.h:853
llvm::VarDefInit::get
static VarDefInit * get(Record *Class, ArrayRef< Init * > Args)
Definition: Record.cpp:2013
llvm::BitsInit
'{ a, b, c }' - Represents an initializer for a BitsRecTy value.
Definition: Record.h:528
llvm::CondOpInit::operator=
CondOpInit & operator=(const CondOpInit &)=delete
llvm::LessRecordFieldName::operator()
bool operator()(const Record *Rec1, const Record *Rec2) const
Definition: Record.h:2047
llvm::IsAOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1105
llvm::VarListElementInit
List[4] - Represent access to one element of a var or field.
Definition: Record.h:1234
llvm::TypedInit::classof
static bool classof(const Init *I)
Definition: Record.h:433
TemplateArgs
Definition: ItaniumDemangle.h:1383
llvm::VarInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1914
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::VarDefInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:1345
llvm::VarDefInit::Fold
Init * Fold() const
Definition: Record.cpp:2108
llvm::Init::IK_BitInit
@ IK_BitInit
Definition: Record.h:300
llvm::DagRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:217
llvm::RecTy::IntRecTyKind
@ IntRecTyKind
Definition: Record.h:64
llvm::RecordKeeper::getDef
Record * getDef(StringRef Name) const
Get the concrete record with the specified name.
Definition: Record.h:1922
llvm::UnOpInit::getOpcode
UnaryOp getOpcode() const
Definition: Record.h:822
llvm::RecordKeeper::addExtraGlobal
void addExtraGlobal(StringRef Name, Init *I)
Definition: Record.h:1953
raw_ostream.h
llvm::TernOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:950
llvm::ExistsOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1769
llvm::RecordVal
This class represents a field in a record, including its name, type, value, and source location.
Definition: Record.h:1489
llvm::IntRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:164
llvm::RecTy::RecTy
RecTy(RecTyKind K, RecordKeeper &RK)
Definition: Record.h:79
llvm::RecordRecTy::isSubClassOf
bool isSubClassOf(Record *Class) const
Definition: Record.cpp:277
llvm::VarDefInit
classname<targs...> - Represent an uninstantiated anonymous class instantiation.
Definition: Record.h:1301
llvm::UnOpInit::operator=
UnOpInit & operator=(const UnOpInit &)=delete
llvm::RecordRecTy::typeIsConvertibleTo
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
Definition: Record.cpp:284
llvm::ExistsOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:1149
llvm::DagInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:2360
llvm::BitRecTy::get
static BitRecTy * get(RecordKeeper &RK)
Definition: Record.cpp:121
llvm::RecordKeeper::dump
void dump() const
Definition: Record.cpp:2900
llvm::Init::IK_UnsetInit
@ IK_UnsetInit
Definition: Record.h:323
llvm::IntRecTy::get
static IntRecTy * get(RecordKeeper &RK)
Definition: Record.cpp:160
llvm::Record::setName
void setName(Init *Name)
Definition: Record.cpp:2548
llvm::Record::hasDirectSuperClass
bool hasDirectSuperClass(const Record *SuperClass) const
Determine whether this record has the specified direct superclass.
Definition: Record.cpp:2569
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::TypedInit::convertInitListSlice
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This function is used to implement the list slice selection operator.
Definition: Record.cpp:1880
llvm::Init::IK_LastTypedInit
@ IK_LastTypedInit
Definition: Record.h:322
llvm::ExistsOpInit::Fold
Init * Fold(Record *CurRec, bool IsFinal=false) const
Definition: Record.cpp:1773
llvm::ListInit::getElement
Init * getElement(unsigned i) const
Definition: Record.h:719
llvm::BitsInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:555
llvm::BinOpInit::getNumOperands
unsigned getNumOperands() const override
Definition: Record.h:891
llvm::Record::isValueUnset
bool isValueUnset(StringRef FieldName) const
Return true if the named field is unset.
Definition: Record.h:1820
llvm::DefInit::get
static DefInit * get(Record *)
Definition: Record.cpp:1980
llvm::BinOpInit::LISTREMOVE
@ LISTREMOVE
Definition: Record.h:850
llvm::BinOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:957
llvm::StringInit::get
static StringInit * get(RecordKeeper &RK, StringRef, StringFormat Fmt=SF_String)
Definition: Record.cpp:597
llvm::VarDefInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:2121
llvm::Record::getValue
RecordVal * getValue(const Init *Name)
Definition: Record.h:1716
llvm::Record::getValueAsDef
Record * getValueAsDef(StringRef FieldName) const
This method looks up the specified field and returns its value as a Record, throwing an exception if ...
Definition: Record.cpp:2802
llvm::Init::IK_IsAOpInit
@ IK_IsAOpInit
Definition: Record.h:314
llvm::LessRecordRegister::RecordParts::RecordParts
RecordParts(StringRef Rec)
Definition: Record.h:2056
llvm::ExistsOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1139
llvm::UnsetInit::get
static UnsetInit * get(RecordKeeper &RK)
Get the singleton unset Init.
Definition: Record.cpp:360
llvm::StringRecTy::classof
static bool classof(const RecTy *RT)
Definition: Record.h:174
llvm::Resolver::isFinal
bool isFinal() const
Definition: Record.h:2159
llvm::AnonymousNameInit::get
static AnonymousNameInit * get(RecordKeeper &RK, unsigned)
Definition: Record.cpp:575
llvm::HasReferenceResolver::HasReferenceResolver
HasReferenceResolver(Init *VarNameToTrack)
Definition: Record.h:2248
llvm::RecordKeeper::getGlobals
const GlobalMap & getGlobals() const
Get the map of global variables.
Definition: Record.h:1913
llvm::TypedInit
This is the common superclass of types that have a specific, explicit type, stored in ValueTy.
Definition: Record.h:422
llvm::FoldOpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1676
llvm::VarListElementInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1954