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