LLVM  16.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 {
842  OR,
852  EQ,
853  NE,
854  LE,
855  LT,
856  GE,
857  GT,
859  };
860 
861 private:
862  Init *LHS, *RHS;
863 
864  BinOpInit(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type) :
865  OpInit(IK_BinOpInit, Type, opc), LHS(lhs), RHS(rhs) {}
866 
867 public:
868  BinOpInit(const BinOpInit &) = delete;
869  BinOpInit &operator=(const BinOpInit &) = delete;
870 
871  static bool classof(const Init *I) {
872  return I->getKind() == IK_BinOpInit;
873  }
874 
875  static BinOpInit *get(BinaryOp opc, Init *lhs, Init *rhs,
876  RecTy *Type);
877  static Init *getStrConcat(Init *lhs, Init *rhs);
878  static Init *getListConcat(TypedInit *lhs, Init *rhs);
879 
880  void Profile(FoldingSetNodeID &ID) const;
881 
882  // Clone - Clone this operator, replacing arguments with the new list
884  assert(Operands.size() == 2 &&
885  "Wrong number of operands for binary operation");
886  return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
887  }
888 
889  unsigned getNumOperands() const override { return 2; }
890  Init *getOperand(unsigned i) const override {
891  switch (i) {
892  default: llvm_unreachable("Invalid operand id for binary operator");
893  case 0: return getLHS();
894  case 1: return getRHS();
895  }
896  }
897 
898  BinaryOp getOpcode() const { return (BinaryOp)Opc; }
899  Init *getLHS() const { return LHS; }
900  Init *getRHS() const { return RHS; }
901 
902  // Fold - If possible, fold this to a simpler init. Return this if not
903  // possible to fold.
904  Init *Fold(Record *CurRec) const;
905 
906  Init *resolveReferences(Resolver &R) const override;
907 
908  std::string getAsString() const override;
909 };
910 
911 /// !op (X, Y, Z) - Combine two inits.
912 class TernOpInit : public OpInit, public FoldingSetNode {
913 public:
914  enum TernaryOp : uint8_t { SUBST, FOREACH, FILTER, IF, DAG, SUBSTR, FIND };
915 
916 private:
917  Init *LHS, *MHS, *RHS;
918 
919  TernOpInit(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs,
920  RecTy *Type) :
921  OpInit(IK_TernOpInit, Type, opc), LHS(lhs), MHS(mhs), RHS(rhs) {}
922 
923 public:
924  TernOpInit(const TernOpInit &) = delete;
925  TernOpInit &operator=(const TernOpInit &) = delete;
926 
927  static bool classof(const Init *I) {
928  return I->getKind() == IK_TernOpInit;
929  }
930 
931  static TernOpInit *get(TernaryOp opc, Init *lhs,
932  Init *mhs, Init *rhs,
933  RecTy *Type);
934 
935  void Profile(FoldingSetNodeID &ID) const;
936 
937  // Clone - Clone this operator, replacing arguments with the new list
939  assert(Operands.size() == 3 &&
940  "Wrong number of operands for ternary operation");
941  return TernOpInit::get(getOpcode(), Operands[0], Operands[1], Operands[2],
942  getType());
943  }
944 
945  unsigned getNumOperands() const override { return 3; }
946  Init *getOperand(unsigned i) const override {
947  switch (i) {
948  default: llvm_unreachable("Invalid operand id for ternary operator");
949  case 0: return getLHS();
950  case 1: return getMHS();
951  case 2: return getRHS();
952  }
953  }
954 
955  TernaryOp getOpcode() const { return (TernaryOp)Opc; }
956  Init *getLHS() const { return LHS; }
957  Init *getMHS() const { return MHS; }
958  Init *getRHS() const { return RHS; }
959 
960  // Fold - If possible, fold this to a simpler init. Return this if not
961  // possible to fold.
962  Init *Fold(Record *CurRec) const;
963 
964  bool isComplete() const override {
965  return LHS->isComplete() && MHS->isComplete() && RHS->isComplete();
966  }
967 
968  Init *resolveReferences(Resolver &R) const override;
969 
970  std::string getAsString() const override;
971 };
972 
973 /// !cond(condition_1: value1, ... , condition_n: value)
974 /// Selects the first value for which condition is true.
975 /// Otherwise reports an error.
976 class CondOpInit final : public TypedInit, public FoldingSetNode,
977  public TrailingObjects<CondOpInit, Init *> {
978  unsigned NumConds;
979  RecTy *ValType;
980 
981  CondOpInit(unsigned NC, RecTy *Type)
983  NumConds(NC), ValType(Type) {}
984 
985  size_t numTrailingObjects(OverloadToken<Init *>) const {
986  return 2*NumConds;
987  }
988 
989 public:
990  CondOpInit(const CondOpInit &) = delete;
991  CondOpInit &operator=(const CondOpInit &) = delete;
992 
993  static bool classof(const Init *I) {
994  return I->getKind() == IK_CondOpInit;
995  }
996 
998  RecTy *Type);
999 
1000  void Profile(FoldingSetNodeID &ID) const;
1001 
1002  RecTy *getValType() const { return ValType; }
1003 
1004  unsigned getNumConds() const { return NumConds; }
1005 
1006  Init *getCond(unsigned Num) const {
1007  assert(Num < NumConds && "Condition number out of range!");
1008  return getTrailingObjects<Init *>()[Num];
1009  }
1010 
1011  Init *getVal(unsigned Num) const {
1012  assert(Num < NumConds && "Val number out of range!");
1013  return getTrailingObjects<Init *>()[Num+NumConds];
1014  }
1015 
1017  return makeArrayRef(getTrailingObjects<Init *>(), NumConds);
1018  }
1019 
1021  return makeArrayRef(getTrailingObjects<Init *>()+NumConds, NumConds);
1022  }
1023 
1024  Init *Fold(Record *CurRec) const;
1025 
1026  Init *resolveReferences(Resolver &R) const override;
1027 
1028  bool isConcrete() const override;
1029  bool isComplete() const override;
1030  std::string getAsString() const override;
1031 
1034 
1035  inline const_case_iterator arg_begin() const { return getConds().begin(); }
1036  inline const_case_iterator arg_end () const { return getConds().end(); }
1037 
1038  inline size_t case_size () const { return NumConds; }
1039  inline bool case_empty() const { return NumConds == 0; }
1040 
1041  inline const_val_iterator name_begin() const { return getVals().begin();}
1042  inline const_val_iterator name_end () const { return getVals().end(); }
1043 
1044  inline size_t val_size () const { return NumConds; }
1045  inline bool val_empty() const { return NumConds == 0; }
1046 
1047  Init *getBit(unsigned Bit) const override;
1048 };
1049 
1050 /// !foldl (a, b, expr, start, lst) - Fold over a list.
1051 class FoldOpInit : public TypedInit, public FoldingSetNode {
1052 private:
1053  Init *Start;
1054  Init *List;
1055  Init *A;
1056  Init *B;
1057  Init *Expr;
1058 
1059  FoldOpInit(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
1060  : TypedInit(IK_FoldOpInit, Type), Start(Start), List(List), A(A), B(B),
1061  Expr(Expr) {}
1062 
1063 public:
1064  FoldOpInit(const FoldOpInit &) = delete;
1065  FoldOpInit &operator=(const FoldOpInit &) = delete;
1066 
1067  static bool classof(const Init *I) { return I->getKind() == IK_FoldOpInit; }
1068 
1069  static FoldOpInit *get(Init *Start, Init *List, Init *A, Init *B, Init *Expr,
1070  RecTy *Type);
1071 
1072  void Profile(FoldingSetNodeID &ID) const;
1073 
1074  // Fold - If possible, fold this to a simpler init. Return this if not
1075  // possible to fold.
1076  Init *Fold(Record *CurRec) const;
1077 
1078  bool isComplete() const override { return false; }
1079 
1080  Init *resolveReferences(Resolver &R) const override;
1081 
1082  Init *getBit(unsigned Bit) const override;
1083 
1084  std::string getAsString() const override;
1085 };
1086 
1087 /// !isa<type>(expr) - Dynamically determine the type of an expression.
1088 class IsAOpInit : public TypedInit, public FoldingSetNode {
1089 private:
1090  RecTy *CheckType;
1091  Init *Expr;
1092 
1093  IsAOpInit(RecTy *CheckType, Init *Expr)
1095  CheckType(CheckType), Expr(Expr) {}
1096 
1097 public:
1098  IsAOpInit(const IsAOpInit &) = delete;
1099  IsAOpInit &operator=(const IsAOpInit &) = delete;
1100 
1101  static bool classof(const Init *I) { return I->getKind() == IK_IsAOpInit; }
1102 
1103  static IsAOpInit *get(RecTy *CheckType, Init *Expr);
1104 
1105  void Profile(FoldingSetNodeID &ID) const;
1106 
1107  // Fold - If possible, fold this to a simpler init. Return this if not
1108  // possible to fold.
1109  Init *Fold() const;
1110 
1111  bool isComplete() const override { return false; }
1112 
1113  Init *resolveReferences(Resolver &R) const override;
1114 
1115  Init *getBit(unsigned Bit) const override;
1116 
1117  std::string getAsString() const override;
1118 };
1119 
1120 /// !exists<type>(expr) - Dynamically determine if a record of `type` named
1121 /// `expr` exists.
1122 class ExistsOpInit : public TypedInit, public FoldingSetNode {
1123 private:
1124  RecTy *CheckType;
1125  Init *Expr;
1126 
1127  ExistsOpInit(RecTy *CheckType, Init *Expr)
1129  CheckType(CheckType), Expr(Expr) {}
1130 
1131 public:
1132  ExistsOpInit(const ExistsOpInit &) = delete;
1133  ExistsOpInit &operator=(const ExistsOpInit &) = delete;
1134 
1135  static bool classof(const Init *I) { return I->getKind() == IK_ExistsOpInit; }
1136 
1137  static ExistsOpInit *get(RecTy *CheckType, Init *Expr);
1138 
1139  void Profile(FoldingSetNodeID &ID) const;
1140 
1141  // Fold - If possible, fold this to a simpler init. Return this if not
1142  // possible to fold.
1143  Init *Fold(Record *CurRec, bool IsFinal = false) const;
1144 
1145  bool isComplete() const override { return false; }
1146 
1147  Init *resolveReferences(Resolver &R) const override;
1148 
1149  Init *getBit(unsigned Bit) const override;
1150 
1151  std::string getAsString() const override;
1152 };
1153 
1154 /// 'Opcode' - Represent a reference to an entire variable object.
1155 class VarInit : public TypedInit {
1156  Init *VarName;
1157 
1158  explicit VarInit(Init *VN, RecTy *T)
1159  : TypedInit(IK_VarInit, T), VarName(VN) {}
1160 
1161 public:
1162  VarInit(const VarInit &) = delete;
1163  VarInit &operator=(const VarInit &) = delete;
1164 
1165  static bool classof(const Init *I) {
1166  return I->getKind() == IK_VarInit;
1167  }
1168 
1169  static VarInit *get(StringRef VN, RecTy *T);
1170  static VarInit *get(Init *VN, RecTy *T);
1171 
1172  StringRef getName() const;
1173  Init *getNameInit() const { return VarName; }
1174 
1175  std::string getNameInitAsString() const {
1176  return getNameInit()->getAsUnquotedString();
1177  }
1178 
1179  /// This method is used by classes that refer to other
1180  /// variables which may not be defined at the time they expression is formed.
1181  /// If a value is set for the variable later, this method will be called on
1182  /// users of the value to allow the value to propagate out.
1183  ///
1184  Init *resolveReferences(Resolver &R) const override;
1185 
1186  Init *getBit(unsigned Bit) const override;
1187 
1188  std::string getAsString() const override { return std::string(getName()); }
1189 };
1190 
1191 /// Opcode{0} - Represent access to one bit of a variable or field.
1192 class VarBitInit final : public TypedInit {
1193  TypedInit *TI;
1194  unsigned Bit;
1195 
1196  VarBitInit(TypedInit *T, unsigned B)
1197  : TypedInit(IK_VarBitInit, BitRecTy::get(T->getRecordKeeper())), TI(T),
1198  Bit(B) {
1199  assert(T->getType() &&
1200  (isa<IntRecTy>(T->getType()) ||
1201  (isa<BitsRecTy>(T->getType()) &&
1202  cast<BitsRecTy>(T->getType())->getNumBits() > B)) &&
1203  "Illegal VarBitInit expression!");
1204  }
1205 
1206 public:
1207  VarBitInit(const VarBitInit &) = delete;
1208  VarBitInit &operator=(const VarBitInit &) = delete;
1209 
1210  static bool classof(const Init *I) {
1211  return I->getKind() == IK_VarBitInit;
1212  }
1213 
1214  static VarBitInit *get(TypedInit *T, unsigned B);
1215 
1216  Init *getBitVar() const { return TI; }
1217  unsigned getBitNum() const { return Bit; }
1218 
1219  std::string getAsString() const override;
1220  Init *resolveReferences(Resolver &R) const override;
1221 
1222  Init *getBit(unsigned B) const override {
1223  assert(B < 1 && "Bit index out of range!");
1224  return const_cast<VarBitInit*>(this);
1225  }
1226 };
1227 
1228 /// List[4] - Represent access to one element of a var or
1229 /// field.
1231  TypedInit *TI;
1232  unsigned Element;
1233 
1234  VarListElementInit(TypedInit *T, unsigned E)
1236  cast<ListRecTy>(T->getType())->getElementType()),
1237  TI(T), Element(E) {
1238  assert(T->getType() && isa<ListRecTy>(T->getType()) &&
1239  "Illegal VarBitInit expression!");
1240  }
1241 
1242 public:
1243  VarListElementInit(const VarListElementInit &) = delete;
1244  VarListElementInit &operator=(const VarListElementInit &) = delete;
1245 
1246  static bool classof(const Init *I) {
1247  return I->getKind() == IK_VarListElementInit;
1248  }
1249 
1250  static VarListElementInit *get(TypedInit *T, unsigned E);
1251 
1252  TypedInit *getVariable() const { return TI; }
1253  unsigned getElementNum() const { return Element; }
1254 
1255  std::string getAsString() const override;
1256  Init *resolveReferences(Resolver &R) const override;
1257 
1258  Init *getBit(unsigned Bit) const override;
1259 };
1260 
1261 /// AL - Represent a reference to a 'def' in the description
1262 class DefInit : public TypedInit {
1263  friend class Record;
1264 
1265  Record *Def;
1266 
1267  explicit DefInit(Record *D);
1268 
1269 public:
1270  DefInit(const DefInit &) = delete;
1271  DefInit &operator=(const DefInit &) = delete;
1272 
1273  static bool classof(const Init *I) {
1274  return I->getKind() == IK_DefInit;
1275  }
1276 
1277  static DefInit *get(Record*);
1278 
1279  Init *convertInitializerTo(RecTy *Ty) const override;
1280 
1281  Record *getDef() const { return Def; }
1282 
1283  //virtual Init *convertInitializerBitRange(ArrayRef<unsigned> Bits);
1284 
1285  RecTy *getFieldType(StringInit *FieldName) const override;
1286 
1287  bool isConcrete() const override { return true; }
1288  std::string getAsString() const override;
1289 
1290  Init *getBit(unsigned Bit) const override {
1291  llvm_unreachable("Illegal bit reference off def");
1292  }
1293 };
1294 
1295 /// classname<targs...> - Represent an uninstantiated anonymous class
1296 /// instantiation.
1297 class VarDefInit final : public TypedInit, public FoldingSetNode,
1298  public TrailingObjects<VarDefInit, Init *> {
1299  Record *Class;
1300  DefInit *Def = nullptr; // after instantiation
1301  unsigned NumArgs;
1302 
1303  explicit VarDefInit(Record *Class, unsigned N);
1304 
1305  DefInit *instantiate();
1306 
1307 public:
1308  VarDefInit(const VarDefInit &) = delete;
1309  VarDefInit &operator=(const VarDefInit &) = delete;
1310 
1311  // Do not use sized deallocation due to trailing objects.
1312  void operator delete(void *p) { ::operator delete(p); }
1313 
1314  static bool classof(const Init *I) {
1315  return I->getKind() == IK_VarDefInit;
1316  }
1317  static VarDefInit *get(Record *Class, ArrayRef<Init *> Args);
1318 
1319  void Profile(FoldingSetNodeID &ID) const;
1320 
1321  Init *resolveReferences(Resolver &R) const override;
1322  Init *Fold() const;
1323 
1324  std::string getAsString() const override;
1325 
1326  Init *getArg(unsigned i) const {
1327  assert(i < NumArgs && "Argument index out of range!");
1328  return getTrailingObjects<Init *>()[i];
1329  }
1330 
1331  using const_iterator = Init *const *;
1332 
1333  const_iterator args_begin() const { return getTrailingObjects<Init *>(); }
1334  const_iterator args_end () const { return args_begin() + NumArgs; }
1335 
1336  size_t args_size () const { return NumArgs; }
1337  bool args_empty() const { return NumArgs == 0; }
1338 
1339  ArrayRef<Init *> args() const { return makeArrayRef(args_begin(), NumArgs); }
1340 
1341  Init *getBit(unsigned Bit) const override {
1342  llvm_unreachable("Illegal bit reference off anonymous def");
1343  }
1344 };
1345 
1346 /// X.Y - Represent a reference to a subfield of a variable
1347 class FieldInit : public TypedInit {
1348  Init *Rec; // Record we are referring to
1349  StringInit *FieldName; // Field we are accessing
1350 
1351  FieldInit(Init *R, StringInit *FN)
1352  : TypedInit(IK_FieldInit, R->getFieldType(FN)), Rec(R), FieldName(FN) {
1353 #ifndef NDEBUG
1354  if (!getType()) {
1355  llvm::errs() << "In Record = " << Rec->getAsString()
1356  << ", got FieldName = " << *FieldName
1357  << " with non-record type!\n";
1358  llvm_unreachable("FieldInit with non-record type!");
1359  }
1360 #endif
1361  }
1362 
1363 public:
1364  FieldInit(const FieldInit &) = delete;
1365  FieldInit &operator=(const FieldInit &) = delete;
1366 
1367  static bool classof(const Init *I) {
1368  return I->getKind() == IK_FieldInit;
1369  }
1370 
1371  static FieldInit *get(Init *R, StringInit *FN);
1372 
1373  Init *getRecord() const { return Rec; }
1374  StringInit *getFieldName() const { return FieldName; }
1375 
1376  Init *getBit(unsigned Bit) const override;
1377 
1378  Init *resolveReferences(Resolver &R) const override;
1379  Init *Fold(Record *CurRec) const;
1380 
1381  bool isConcrete() const override;
1382  std::string getAsString() const override {
1383  return Rec->getAsString() + "." + FieldName->getValue().str();
1384  }
1385 };
1386 
1387 /// (v a, b) - Represent a DAG tree value. DAG inits are required
1388 /// to have at least one value then a (possibly empty) list of arguments. Each
1389 /// argument can have a name associated with it.
1390 class DagInit final : public TypedInit, public FoldingSetNode,
1391  public TrailingObjects<DagInit, Init *, StringInit *> {
1392  friend TrailingObjects;
1393 
1394  Init *Val;
1395  StringInit *ValName;
1396  unsigned NumArgs;
1397  unsigned NumArgNames;
1398 
1399  DagInit(Init *V, StringInit *VN, unsigned NumArgs, unsigned NumArgNames)
1401  ValName(VN), NumArgs(NumArgs), NumArgNames(NumArgNames) {}
1402 
1403  size_t numTrailingObjects(OverloadToken<Init *>) const { return NumArgs; }
1404 
1405 public:
1406  DagInit(const DagInit &) = delete;
1407  DagInit &operator=(const DagInit &) = delete;
1408 
1409  static bool classof(const Init *I) {
1410  return I->getKind() == IK_DagInit;
1411  }
1412 
1413  static DagInit *get(Init *V, StringInit *VN, ArrayRef<Init *> ArgRange,
1414  ArrayRef<StringInit*> NameRange);
1415  static DagInit *get(Init *V, StringInit *VN,
1416  ArrayRef<std::pair<Init*, StringInit*>> Args);
1417 
1418  void Profile(FoldingSetNodeID &ID) const;
1419 
1420  Init *getOperator() const { return Val; }
1422 
1423  StringInit *getName() const { return ValName; }
1424 
1426  return ValName ? ValName->getValue() : StringRef();
1427  }
1428 
1429  unsigned getNumArgs() const { return NumArgs; }
1430 
1431  Init *getArg(unsigned Num) const {
1432  assert(Num < NumArgs && "Arg number out of range!");
1433  return getTrailingObjects<Init *>()[Num];
1434  }
1435 
1436  StringInit *getArgName(unsigned Num) const {
1437  assert(Num < NumArgNames && "Arg number out of range!");
1438  return getTrailingObjects<StringInit *>()[Num];
1439  }
1440 
1441  StringRef getArgNameStr(unsigned Num) const {
1442  StringInit *Init = getArgName(Num);
1443  return Init ? Init->getValue() : StringRef();
1444  }
1445 
1447  return makeArrayRef(getTrailingObjects<Init *>(), NumArgs);
1448  }
1449 
1451  return makeArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
1452  }
1453 
1454  Init *resolveReferences(Resolver &R) const override;
1455 
1456  bool isConcrete() const override;
1457  std::string getAsString() const override;
1458 
1461 
1462  inline const_arg_iterator arg_begin() const { return getArgs().begin(); }
1463  inline const_arg_iterator arg_end () const { return getArgs().end(); }
1464 
1465  inline size_t arg_size () const { return NumArgs; }
1466  inline bool arg_empty() const { return NumArgs == 0; }
1467 
1468  inline const_name_iterator name_begin() const { return getArgNames().begin();}
1469  inline const_name_iterator name_end () const { return getArgNames().end(); }
1470 
1471  inline size_t name_size () const { return NumArgNames; }
1472  inline bool name_empty() const { return NumArgNames == 0; }
1473 
1474  Init *getBit(unsigned Bit) const override {
1475  llvm_unreachable("Illegal bit reference off dag");
1476  }
1477 };
1478 
1479 //===----------------------------------------------------------------------===//
1480 // High-Level Classes
1481 //===----------------------------------------------------------------------===//
1482 
1483 /// This class represents a field in a record, including its name, type,
1484 /// value, and source location.
1485 class RecordVal {
1486  friend class Record;
1487 
1488 public:
1489  enum FieldKind {
1490  FK_Normal, // A normal record field.
1491  FK_NonconcreteOK, // A field that can be nonconcrete ('field' keyword).
1492  FK_TemplateArg, // A template argument.
1493  };
1494 
1495 private:
1496  Init *Name;
1497  SMLoc Loc; // Source location of definition of name.
1499  Init *Value;
1500  bool IsUsed = false;
1501 
1502  /// Reference locations to this record value.
1503  SmallVector<SMRange> ReferenceLocs;
1504 
1505 public:
1506  RecordVal(Init *N, RecTy *T, FieldKind K);
1507  RecordVal(Init *N, SMLoc Loc, RecTy *T, FieldKind K);
1508 
1509  /// Get the record keeper used to unique this value.
1510  RecordKeeper &getRecordKeeper() const { return Name->getRecordKeeper(); }
1511 
1512  /// Get the name of the field as a StringRef.
1513  StringRef getName() const;
1514 
1515  /// Get the name of the field as an Init.
1516  Init *getNameInit() const { return Name; }
1517 
1518  /// Get the name of the field as a std::string.
1519  std::string getNameInitAsString() const {
1520  return getNameInit()->getAsUnquotedString();
1521  }
1522 
1523  /// Get the source location of the point where the field was defined.
1524  const SMLoc &getLoc() const { return Loc; }
1525 
1526  /// Is this a field where nonconcrete values are okay?
1527  bool isNonconcreteOK() const {
1528  return TyAndKind.getInt() == FK_NonconcreteOK;
1529  }
1530 
1531  /// Is this a template argument?
1532  bool isTemplateArg() const {
1533  return TyAndKind.getInt() == FK_TemplateArg;
1534  }
1535 
1536  /// Get the type of the field value as a RecTy.
1537  RecTy *getType() const { return TyAndKind.getPointer(); }
1538 
1539  /// Get the type of the field for printing purposes.
1540  std::string getPrintType() const;
1541 
1542  /// Get the value of the field as an Init.
1543  Init *getValue() const { return Value; }
1544 
1545  /// Set the value of the field from an Init.
1546  bool setValue(Init *V);
1547 
1548  /// Set the value and source location of the field.
1549  bool setValue(Init *V, SMLoc NewLoc);
1550 
1551  /// Add a reference to this record value.
1552  void addReferenceLoc(SMRange Loc) { ReferenceLocs.push_back(Loc); }
1553 
1554  /// Return the references of this record value.
1555  ArrayRef<SMRange> getReferenceLocs() const { return ReferenceLocs; }
1556 
1557  /// Whether this value is used. Useful for reporting warnings, for example
1558  /// when a template argument is unused.
1559  void setUsed(bool Used) { IsUsed = Used; }
1560  bool isUsed() const { return IsUsed; }
1561 
1562  void dump() const;
1563 
1564  /// Print the value to an output stream, possibly with a semicolon.
1565  void print(raw_ostream &OS, bool PrintSem = true) const;
1566 };
1567 
1568 inline raw_ostream &operator<<(raw_ostream &OS, const RecordVal &RV) {
1569  RV.print(OS << " ");
1570  return OS;
1571 }
1572 
1573 class Record {
1574 public:
1575  struct AssertionInfo {
1579 
1580  // User-defined constructor to support std::make_unique(). It can be
1581  // removed in C++20 when braced initialization is supported.
1584  };
1585 
1586 private:
1587  Init *Name;
1588  // Location where record was instantiated, followed by the location of
1589  // multiclass prototypes used, and finally by the locations of references to
1590  // this record.
1591  SmallVector<SMLoc, 4> Locs;
1592  SmallVector<SMLoc, 0> ForwardDeclarationLocs;
1593  SmallVector<SMRange, 0> ReferenceLocs;
1596  SmallVector<AssertionInfo, 0> Assertions;
1597 
1598  // All superclasses in the inheritance forest in post-order (yes, it
1599  // must be a forest; diamond-shaped inheritance is not allowed).
1601 
1602  // Tracks Record instances. Not owned by Record.
1603  RecordKeeper &TrackedRecords;
1604 
1605  // The DefInit corresponding to this record.
1606  DefInit *CorrespondingDefInit = nullptr;
1607 
1608  // Unique record ID.
1609  unsigned ID;
1610 
1611  bool IsAnonymous;
1612  bool IsClass;
1613 
1614  void checkName();
1615 
1616 public:
1617  // Constructs a record.
1618  explicit Record(Init *N, ArrayRef<SMLoc> locs, RecordKeeper &records,
1619  bool Anonymous = false, bool Class = false)
1620  : Name(N), Locs(locs.begin(), locs.end()), TrackedRecords(records),
1621  ID(getNewUID(N->getRecordKeeper())), IsAnonymous(Anonymous),
1622  IsClass(Class) {
1623  checkName();
1624  }
1625 
1626  explicit Record(StringRef N, ArrayRef<SMLoc> locs, RecordKeeper &records,
1627  bool Class = false)
1628  : Record(StringInit::get(records, N), locs, records, false, Class) {}
1629 
1630  // When copy-constructing a Record, we must still guarantee a globally unique
1631  // ID number. Don't copy CorrespondingDefInit either, since it's owned by the
1632  // original record. All other fields can be copied normally.
1633  Record(const Record &O)
1634  : Name(O.Name), Locs(O.Locs), TemplateArgs(O.TemplateArgs),
1635  Values(O.Values), Assertions(O.Assertions),
1636  SuperClasses(O.SuperClasses), TrackedRecords(O.TrackedRecords),
1637  ID(getNewUID(O.getRecords())), IsAnonymous(O.IsAnonymous),
1638  IsClass(O.IsClass) {}
1639 
1640  static unsigned getNewUID(RecordKeeper &RK);
1641 
1642  unsigned getID() const { return ID; }
1643 
1644  StringRef getName() const { return cast<StringInit>(Name)->getValue(); }
1645 
1646  Init *getNameInit() const {
1647  return Name;
1648  }
1649 
1650  std::string getNameInitAsString() const {
1651  return getNameInit()->getAsUnquotedString();
1652  }
1653 
1654  void setName(Init *Name); // Also updates RecordKeeper.
1655 
1656  ArrayRef<SMLoc> getLoc() const { return Locs; }
1657  void appendLoc(SMLoc Loc) { Locs.push_back(Loc); }
1658 
1660  return ForwardDeclarationLocs;
1661  }
1662 
1663  /// Add a reference to this record value.
1664  void appendReferenceLoc(SMRange Loc) { ReferenceLocs.push_back(Loc); }
1665 
1666  /// Return the references of this record value.
1667  ArrayRef<SMRange> getReferenceLocs() const { return ReferenceLocs; }
1668 
1669  // Update a class location when encountering a (re-)definition.
1670  void updateClassLoc(SMLoc Loc);
1671 
1672  // Make the type that this record should have based on its superclasses.
1673  RecordRecTy *getType();
1674 
1675  /// get the corresponding DefInit.
1676  DefInit *getDefInit();
1677 
1678  bool isClass() const { return IsClass; }
1679 
1681  return TemplateArgs;
1682  }
1683 
1684  ArrayRef<RecordVal> getValues() const { return Values; }
1685 
1686  ArrayRef<AssertionInfo> getAssertions() const { return Assertions; }
1687 
1689  return SuperClasses;
1690  }
1691 
1692  /// Determine whether this record has the specified direct superclass.
1693  bool hasDirectSuperClass(const Record *SuperClass) const;
1694 
1695  /// Append the direct superclasses of this record to Classes.
1696  void getDirectSuperClasses(SmallVectorImpl<Record *> &Classes) const;
1697 
1698  bool isTemplateArg(Init *Name) const {
1699  return llvm::is_contained(TemplateArgs, Name);
1700  }
1701 
1702  const RecordVal *getValue(const Init *Name) const {
1703  for (const RecordVal &Val : Values)
1704  if (Val.Name == Name) return &Val;
1705  return nullptr;
1706  }
1707 
1708  const RecordVal *getValue(StringRef Name) const {
1709  return getValue(StringInit::get(getRecords(), Name));
1710  }
1711 
1712  RecordVal *getValue(const Init *Name) {
1713  return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
1714  }
1715 
1717  return const_cast<RecordVal *>(static_cast<const Record *>(this)->getValue(Name));
1718  }
1719 
1720  void addTemplateArg(Init *Name) {
1721  assert(!isTemplateArg(Name) && "Template arg already defined!");
1722  TemplateArgs.push_back(Name);
1723  }
1724 
1725  void addValue(const RecordVal &RV) {
1726  assert(getValue(RV.getNameInit()) == nullptr && "Value already added!");
1727  Values.push_back(RV);
1728  }
1729 
1730  void removeValue(Init *Name) {
1731  for (unsigned i = 0, e = Values.size(); i != e; ++i)
1732  if (Values[i].getNameInit() == Name) {
1733  Values.erase(Values.begin()+i);
1734  return;
1735  }
1736  llvm_unreachable("Cannot remove an entry that does not exist!");
1737  }
1738 
1739  void removeValue(StringRef Name) {
1741  }
1742 
1743  void addAssertion(SMLoc Loc, Init *Condition, Init *Message) {
1744  Assertions.push_back(AssertionInfo(Loc, Condition, Message));
1745  }
1746 
1747  void appendAssertions(const Record *Rec) {
1748  Assertions.append(Rec->Assertions);
1749  }
1750 
1751  void checkRecordAssertions();
1752  void checkUnusedTemplateArgs();
1753 
1754  bool isSubClassOf(const Record *R) const {
1755  for (const auto &SCPair : SuperClasses)
1756  if (SCPair.first == R)
1757  return true;
1758  return false;
1759  }
1760 
1761  bool isSubClassOf(StringRef Name) const {
1762  for (const auto &SCPair : SuperClasses) {
1763  if (const auto *SI = dyn_cast<StringInit>(SCPair.first->getNameInit())) {
1764  if (SI->getValue() == Name)
1765  return true;
1766  } else if (SCPair.first->getNameInitAsString() == Name) {
1767  return true;
1768  }
1769  }
1770  return false;
1771  }
1772 
1773  void addSuperClass(Record *R, SMRange Range) {
1774  assert(!CorrespondingDefInit &&
1775  "changing type of record after it has been referenced");
1776  assert(!isSubClassOf(R) && "Already subclassing record!");
1777  SuperClasses.push_back(std::make_pair(R, Range));
1778  }
1779 
1780  /// If there are any field references that refer to fields that have been
1781  /// filled in, we can propagate the values now.
1782  ///
1783  /// This is a final resolve: any error messages, e.g. due to undefined !cast
1784  /// references, are generated now.
1785  void resolveReferences(Init *NewName = nullptr);
1786 
1787  /// Apply the resolver to the name of the record as well as to the
1788  /// initializers of all fields of the record except SkipVal.
1789  ///
1790  /// The resolver should not resolve any of the fields itself, to avoid
1791  /// recursion / infinite loops.
1792  void resolveReferences(Resolver &R, const RecordVal *SkipVal = nullptr);
1793 
1795  return TrackedRecords;
1796  }
1797 
1798  bool isAnonymous() const {
1799  return IsAnonymous;
1800  }
1801 
1802  void dump() const;
1803 
1804  //===--------------------------------------------------------------------===//
1805  // High-level methods useful to tablegen back-ends
1806  //
1807 
1808  /// Return the source location for the named field.
1809  SMLoc getFieldLoc(StringRef FieldName) const;
1810 
1811  /// Return the initializer for a value with the specified name, or throw an
1812  /// exception if the field does not exist.
1813  Init *getValueInit(StringRef FieldName) const;
1814 
1815  /// Return true if the named field is unset.
1816  bool isValueUnset(StringRef FieldName) const {
1817  return isa<UnsetInit>(getValueInit(FieldName));
1818  }
1819 
1820  /// This method looks up the specified field and returns its value as a
1821  /// string, throwing an exception if the field does not exist or if the value
1822  /// is not a string.
1823  StringRef getValueAsString(StringRef FieldName) const;
1824 
1825  /// This method looks up the specified field and returns its value as a
1826  /// string, throwing an exception if the value is not a string and
1827  /// llvm::Optional() if the field does not exist.
1829 
1830  /// This method looks up the specified field and returns its value as a
1831  /// BitsInit, throwing an exception if the field does not exist or if the
1832  /// value is not the right type.
1833  BitsInit *getValueAsBitsInit(StringRef FieldName) const;
1834 
1835  /// This method looks up the specified field and returns its value as a
1836  /// ListInit, throwing an exception if the field does not exist or if the
1837  /// value is not the right type.
1838  ListInit *getValueAsListInit(StringRef FieldName) const;
1839 
1840  /// This method looks up the specified field and returns its value as a
1841  /// vector of records, throwing an exception if the field does not exist or
1842  /// if the value is not the right type.
1843  std::vector<Record*> getValueAsListOfDefs(StringRef FieldName) const;
1844 
1845  /// This method looks up the specified field and returns its value as a
1846  /// vector of integers, throwing an exception if the field does not exist or
1847  /// if the value is not the right type.
1848  std::vector<int64_t> getValueAsListOfInts(StringRef FieldName) const;
1849 
1850  /// This method looks up the specified field and returns its value as a
1851  /// vector of strings, throwing an exception if the field does not exist or
1852  /// if the value is not the right type.
1853  std::vector<StringRef> getValueAsListOfStrings(StringRef FieldName) const;
1854 
1855  /// This method looks up the specified field and returns its value as a
1856  /// Record, throwing an exception if the field does not exist or if the value
1857  /// is not the right type.
1858  Record *getValueAsDef(StringRef FieldName) const;
1859 
1860  /// This method looks up the specified field and returns its value as a
1861  /// Record, returning null if the field exists but is "uninitialized" (i.e.
1862  /// set to `?`), and throwing an exception if the field does not exist or if
1863  /// its value is not the right type.
1864  Record *getValueAsOptionalDef(StringRef FieldName) const;
1865 
1866  /// This method looks up the specified field and returns its value as a bit,
1867  /// throwing an exception if the field does not exist or if the value is not
1868  /// the right type.
1869  bool getValueAsBit(StringRef FieldName) const;
1870 
1871  /// This method looks up the specified field and returns its value as a bit.
1872  /// If the field is unset, sets Unset to true and returns false.
1873  bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const;
1874 
1875  /// This method looks up the specified field and returns its value as an
1876  /// int64_t, throwing an exception if the field does not exist or if the
1877  /// value is not the right type.
1878  int64_t getValueAsInt(StringRef FieldName) const;
1879 
1880  /// This method looks up the specified field and returns its value as an Dag,
1881  /// throwing an exception if the field does not exist or if the value is not
1882  /// the right type.
1883  DagInit *getValueAsDag(StringRef FieldName) const;
1884 };
1885 
1886 raw_ostream &operator<<(raw_ostream &OS, const Record &R);
1887 
1889  using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
1890  using GlobalMap = std::map<std::string, Init *, std::less<>>;
1891 
1892 public:
1893  RecordKeeper();
1894  ~RecordKeeper();
1895 
1896  /// Return the internal implementation of the RecordKeeper.
1897  detail::RecordKeeperImpl &getImpl() { return *Impl; }
1898 
1899  /// Get the main TableGen input file's name.
1900  const std::string getInputFilename() const { return InputFilename; }
1901 
1902  /// Get the map of classes.
1903  const RecordMap &getClasses() const { return Classes; }
1904 
1905  /// Get the map of records (defs).
1906  const RecordMap &getDefs() const { return Defs; }
1907 
1908  /// Get the map of global variables.
1909  const GlobalMap &getGlobals() const { return ExtraGlobals; }
1910 
1911  /// Get the class with the specified name.
1913  auto I = Classes.find(Name);
1914  return I == Classes.end() ? nullptr : I->second.get();
1915  }
1916 
1917  /// Get the concrete record with the specified name.
1919  auto I = Defs.find(Name);
1920  return I == Defs.end() ? nullptr : I->second.get();
1921  }
1922 
1923  /// Get the \p Init value of the specified global variable.
1925  if (Record *R = getDef(Name))
1926  return R->getDefInit();
1927  auto It = ExtraGlobals.find(Name);
1928  return It == ExtraGlobals.end() ? nullptr : It->second;
1929  }
1930 
1931  void saveInputFilename(std::string Filename) {
1932  InputFilename = Filename;
1933  }
1934 
1935  void addClass(std::unique_ptr<Record> R) {
1936  bool Ins = Classes.insert(std::make_pair(std::string(R->getName()),
1937  std::move(R))).second;
1938  (void)Ins;
1939  assert(Ins && "Class already exists");
1940  }
1941 
1942  void addDef(std::unique_ptr<Record> R) {
1943  bool Ins = Defs.insert(std::make_pair(std::string(R->getName()),
1944  std::move(R))).second;
1945  (void)Ins;
1946  assert(Ins && "Record already exists");
1947  }
1948 
1950  bool Ins = ExtraGlobals.insert(std::make_pair(std::string(Name), I)).second;
1951  (void)Ins;
1952  assert(!getDef(Name));
1953  assert(Ins && "Global already exists");
1954  }
1955 
1957 
1958  /// Start phase timing; called if the --time-phases option is specified.
1960  TimingGroup = new TimerGroup("TableGen", "TableGen Phase Timing");
1961  }
1962 
1963  /// Start timing a phase. Automatically stops any previous phase timer.
1964  void startTimer(StringRef Name);
1965 
1966  /// Stop timing a phase.
1967  void stopTimer();
1968 
1969  /// Start timing the overall backend. If the backend itself starts a timer,
1970  /// then this timer is cleared.
1972 
1973  /// Stop timing the overall backend.
1974  void stopBackendTimer();
1975 
1976  /// Stop phase timing and print the report.
1978  if (TimingGroup)
1979  delete TimingGroup;
1980  }
1981 
1982  //===--------------------------------------------------------------------===//
1983  // High-level helper methods, useful for tablegen backends.
1984 
1985  /// Get all the concrete records that inherit from the one specified
1986  /// class. The class must be defined.
1987  std::vector<Record *> getAllDerivedDefinitions(StringRef ClassName) const;
1988 
1989  /// Get all the concrete records that inherit from all the specified
1990  /// classes. The classes must be defined.
1991  std::vector<Record *> getAllDerivedDefinitions(
1992  ArrayRef<StringRef> ClassNames) const;
1993 
1994  /// Get all the concrete records that inherit from specified class, if the
1995  /// class is defined. Returns an empty vector if the class is not defined.
1996  std::vector<Record *>
1998 
1999  void dump() const;
2000 
2001 private:
2002  RecordKeeper(RecordKeeper &&) = delete;
2003  RecordKeeper(const RecordKeeper &) = delete;
2004  RecordKeeper &operator=(RecordKeeper &&) = delete;
2005  RecordKeeper &operator=(const RecordKeeper &) = delete;
2006 
2007  std::string InputFilename;
2008  RecordMap Classes, Defs;
2009  mutable StringMap<std::vector<Record *>> ClassRecordsMap;
2010  GlobalMap ExtraGlobals;
2011 
2012  // These members are for the phase timing feature. We need a timer group,
2013  // the last timer started, and a flag to say whether the last timer
2014  // is the special "backend overall timer."
2015  TimerGroup *TimingGroup = nullptr;
2016  Timer *LastTimer = nullptr;
2017  bool BackendTimer = false;
2018 
2019  /// The internal uniquer implementation of the RecordKeeper.
2020  std::unique_ptr<detail::RecordKeeperImpl> Impl;
2021 };
2022 
2023 /// Sorting predicate to sort record pointers by name.
2024 struct LessRecord {
2025  bool operator()(const Record *Rec1, const Record *Rec2) const {
2026  return StringRef(Rec1->getName()).compare_numeric(Rec2->getName()) < 0;
2027  }
2028 };
2029 
2030 /// Sorting predicate to sort record pointers by their
2031 /// unique ID. If you just need a deterministic order, use this, since it
2032 /// just compares two `unsigned`; the other sorting predicates require
2033 /// string manipulation.
2035  bool operator()(const Record *LHS, const Record *RHS) const {
2036  return LHS->getID() < RHS->getID();
2037  }
2038 };
2039 
2040 /// Sorting predicate to sort record pointers by their
2041 /// name field.
2043  bool operator()(const Record *Rec1, const Record *Rec2) const {
2044  return Rec1->getValueAsString("Name") < Rec2->getValueAsString("Name");
2045  }
2046 };
2047 
2049  struct RecordParts {
2051 
2053  if (Rec.empty())
2054  return;
2055 
2056  size_t Len = 0;
2057  const char *Start = Rec.data();
2058  const char *Curr = Start;
2059  bool IsDigitPart = isDigit(Curr[0]);
2060  for (size_t I = 0, E = Rec.size(); I != E; ++I, ++Len) {
2061  bool IsDigit = isDigit(Curr[I]);
2062  if (IsDigit != IsDigitPart) {
2063  Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len)));
2064  Len = 0;
2065  Start = &Curr[I];
2066  IsDigitPart = isDigit(Curr[I]);
2067  }
2068  }
2069  // Push the last part.
2070  Parts.push_back(std::make_pair(IsDigitPart, StringRef(Start, Len)));
2071  }
2072 
2073  size_t size() { return Parts.size(); }
2074 
2075  std::pair<bool, StringRef> getPart(size_t i) {
2076  assert (i < Parts.size() && "Invalid idx!");
2077  return Parts[i];
2078  }
2079  };
2080 
2081  bool operator()(const Record *Rec1, const Record *Rec2) const {
2082  RecordParts LHSParts(StringRef(Rec1->getName()));
2083  RecordParts RHSParts(StringRef(Rec2->getName()));
2084 
2085  size_t LHSNumParts = LHSParts.size();
2086  size_t RHSNumParts = RHSParts.size();
2087  assert (LHSNumParts && RHSNumParts && "Expected at least one part!");
2088 
2089  if (LHSNumParts != RHSNumParts)
2090  return LHSNumParts < RHSNumParts;
2091 
2092  // We expect the registers to be of the form [_a-zA-Z]+([0-9]*[_a-zA-Z]*)*.
2093  for (size_t I = 0, E = LHSNumParts; I < E; I+=2) {
2094  std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
2095  std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
2096  // Expect even part to always be alpha.
2097  assert (LHSPart.first == false && RHSPart.first == false &&
2098  "Expected both parts to be alpha.");
2099  if (int Res = LHSPart.second.compare(RHSPart.second))
2100  return Res < 0;
2101  }
2102  for (size_t I = 1, E = LHSNumParts; I < E; I+=2) {
2103  std::pair<bool, StringRef> LHSPart = LHSParts.getPart(I);
2104  std::pair<bool, StringRef> RHSPart = RHSParts.getPart(I);
2105  // Expect odd part to always be numeric.
2106  assert (LHSPart.first == true && RHSPart.first == true &&
2107  "Expected both parts to be numeric.");
2108  if (LHSPart.second.size() != RHSPart.second.size())
2109  return LHSPart.second.size() < RHSPart.second.size();
2110 
2111  unsigned LHSVal, RHSVal;
2112 
2113  bool LHSFailed = LHSPart.second.getAsInteger(10, LHSVal); (void)LHSFailed;
2114  assert(!LHSFailed && "Unable to convert LHS to integer.");
2115  bool RHSFailed = RHSPart.second.getAsInteger(10, RHSVal); (void)RHSFailed;
2116  assert(!RHSFailed && "Unable to convert RHS to integer.");
2117 
2118  if (LHSVal != RHSVal)
2119  return LHSVal < RHSVal;
2120  }
2121  return LHSNumParts < RHSNumParts;
2122  }
2123 };
2124 
2125 raw_ostream &operator<<(raw_ostream &OS, const RecordKeeper &RK);
2126 
2127 //===----------------------------------------------------------------------===//
2128 // Resolvers
2129 //===----------------------------------------------------------------------===//
2130 
2131 /// Interface for looking up the initializer for a variable name, used by
2132 /// Init::resolveReferences.
2133 class Resolver {
2134  Record *CurRec;
2135  bool IsFinal = false;
2136 
2137 public:
2138  explicit Resolver(Record *CurRec) : CurRec(CurRec) {}
2139  virtual ~Resolver() = default;
2140 
2141  Record *getCurrentRecord() const { return CurRec; }
2142 
2143  /// Return the initializer for the given variable name (should normally be a
2144  /// StringInit), or nullptr if the name could not be resolved.
2145  virtual Init *resolve(Init *VarName) = 0;
2146 
2147  // Whether bits in a BitsInit should stay unresolved if resolving them would
2148  // result in a ? (UnsetInit). This behavior is used to represent instruction
2149  // encodings by keeping references to unset variables within a record.
2150  virtual bool keepUnsetBits() const { return false; }
2151 
2152  // Whether this is the final resolve step before adding a record to the
2153  // RecordKeeper. Error reporting during resolve and related constant folding
2154  // should only happen when this is true.
2155  bool isFinal() const { return IsFinal; }
2156 
2157  void setFinal(bool Final) { IsFinal = Final; }
2158 };
2159 
2160 /// Resolve arbitrary mappings.
2161 class MapResolver final : public Resolver {
2162  struct MappedValue {
2163  Init *V;
2164  bool Resolved;
2165 
2166  MappedValue() : V(nullptr), Resolved(false) {}
2167  MappedValue(Init *V, bool Resolved) : V(V), Resolved(Resolved) {}
2168  };
2169 
2171 
2172 public:
2173  explicit MapResolver(Record *CurRec = nullptr) : Resolver(CurRec) {}
2174 
2175  void set(Init *Key, Init *Value) { Map[Key] = {Value, false}; }
2176 
2177  bool isComplete(Init *VarName) const {
2178  auto It = Map.find(VarName);
2179  assert(It != Map.end() && "key must be present in map");
2180  return It->second.V->isComplete();
2181  }
2182 
2183  Init *resolve(Init *VarName) override;
2184 };
2185 
2186 /// Resolve all variables from a record except for unset variables.
2187 class RecordResolver final : public Resolver {
2189  SmallVector<Init *, 4> Stack;
2190  Init *Name = nullptr;
2191 
2192 public:
2193  explicit RecordResolver(Record &R) : Resolver(&R) {}
2194 
2195  void setName(Init *NewName) { Name = NewName; }
2196 
2197  Init *resolve(Init *VarName) override;
2198 
2199  bool keepUnsetBits() const override { return true; }
2200 };
2201 
2202 /// Delegate resolving to a sub-resolver, but shadow some variable names.
2203 class ShadowResolver final : public Resolver {
2204  Resolver &R;
2205  DenseSet<Init *> Shadowed;
2206 
2207 public:
2209  : Resolver(R.getCurrentRecord()), R(R) {
2210  setFinal(R.isFinal());
2211  }
2212 
2213  void addShadow(Init *Key) { Shadowed.insert(Key); }
2214 
2215  Init *resolve(Init *VarName) override {
2216  if (Shadowed.count(VarName))
2217  return nullptr;
2218  return R.resolve(VarName);
2219  }
2220 };
2221 
2222 /// (Optionally) delegate resolving to a sub-resolver, and keep track whether
2223 /// there were unresolved references.
2224 class TrackUnresolvedResolver final : public Resolver {
2225  Resolver *R;
2226  bool FoundUnresolved = false;
2227 
2228 public:
2229  explicit TrackUnresolvedResolver(Resolver *R = nullptr)
2230  : Resolver(R ? R->getCurrentRecord() : nullptr), R(R) {}
2231 
2232  bool foundUnresolved() const { return FoundUnresolved; }
2233 
2234  Init *resolve(Init *VarName) override;
2235 };
2236 
2237 /// Do not resolve anything, but keep track of whether a given variable was
2238 /// referenced.
2239 class HasReferenceResolver final : public Resolver {
2240  Init *VarNameToTrack;
2241  bool Found = false;
2242 
2243 public:
2244  explicit HasReferenceResolver(Init *VarNameToTrack)
2245  : Resolver(nullptr), VarNameToTrack(VarNameToTrack) {}
2246 
2247  bool found() const { return Found; }
2248 
2249  Init *resolve(Init *VarName) override;
2250 };
2251 
2252 void EmitDetailedRecords(RecordKeeper &RK, raw_ostream &OS);
2253 void EmitJSON(RecordKeeper &RK, raw_ostream &OS);
2254 
2255 } // end namespace llvm
2256 
2257 #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:1016
llvm::FieldInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:2080
i
i
Definition: README.txt:29
llvm::VarBitInit::classof
static bool classof(const Init *I)
Definition: Record.h:1210
llvm::Init::IK_BinOpInit
@ IK_BinOpInit
Definition: Record.h:307
llvm::Record::getValue
RecordVal * getValue(StringRef Name)
Definition: Record.h:1716
llvm::TernOpInit::IF
@ IF
Definition: Record.h:914
llvm::Record::isSubClassOf
bool isSubClassOf(const Record *R) const
Definition: Record.h:1754
llvm::ShadowResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.h:2215
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:1918
llvm::BinOpInit::XOR
@ XOR
Definition: Record.h:843
llvm::OpInit::operator=
OpInit & operator=(OpInit &)=delete
TrailingObjects.h
llvm::CondOpInit::const_val_iterator
SmallVectorImpl< Init * >::const_iterator const_val_iterator
Definition: Record.h:1033
llvm::RecordKeeper::getInputFilename
const std::string getInputFilename() const
Get the main TableGen input file's name.
Definition: Record.h:1900
llvm::TernOpInit::getOpcode
TernaryOp getOpcode() const
Definition: Record.h:955
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:1222
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:2363
llvm::StringInit::operator=
StringInit & operator=(const StringInit &)=delete
llvm::IsAOpInit::Fold
Init * Fold() const
Definition: Record.cpp:1639
llvm::Resolver::setFinal
void setFinal(bool Final)
Definition: Record.h:2157
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::TernOpInit::getNumOperands
unsigned getNumOperands() const override
Definition: Record.h:945
llvm::SmallVectorImpl::erase
iterator erase(const_iterator CI)
Definition: SmallVector.h:723
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:1339
llvm::StringInit::hasCodeFormat
bool hasCodeFormat() const
Definition: Record.h:669
llvm::RecordKeeper
Definition: Record.h:1888
llvm::ExistsOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1745
llvm::RecordVal::isTemplateArg
bool isTemplateArg() const
Is this a template argument?
Definition: Record.h:1532
llvm::DagInit::name_begin
const_name_iterator name_begin() const
Definition: Record.h:1468
llvm::RecordVal::FK_Normal
@ FK_Normal
Definition: Record.h:1490
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:1006
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:1789
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:2508
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:1898
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:914
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:2669
StringRef.h
llvm::BinOpInit::AND
@ AND
Definition: Record.h:841
llvm::CondOpInit::val_size
size_t val_size() const
Definition: Record.h:1044
llvm::Record::Record
Record(Init *N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Anonymous=false, bool Class=false)
Definition: Record.h:1618
llvm::TernOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1528
llvm::FoldOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:1078
llvm::TypedInit::getFieldType
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
Definition: Record.cpp:1751
llvm::Record::getReferenceLocs
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
Definition: Record.h:1667
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:1897
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
llvm::IsAOpInit
!isa<type>(expr) - Dynamically determine the type of an expression.
Definition: Record.h:1088
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:1252
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:2073
llvm::TernOpInit::clone
OpInit * clone(ArrayRef< Init * > Operands) const override
Definition: Record.h:938
llvm::Record::getSuperClasses
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
Definition: Record.h:1688
llvm::VarDefInit::classof
static bool classof(const Init *I)
Definition: Record.h:1314
llvm::DagInit
(v a, b) - Represent a DAG tree value.
Definition: Record.h:1390
llvm::FieldInit::get
static FieldInit * get(Init *R, StringInit *FN)
Definition: Record.cpp:2059
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:2034
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:1510
llvm::VarDefInit::args_empty
bool args_empty() const
Definition: Record.h:1337
llvm::RecordKeeper::~RecordKeeper
~RecordKeeper()
llvm::TrackUnresolvedResolver
(Optionally) delegate resolving to a sub-resolver, and keep track whether there were unresolved refer...
Definition: Record.h:2224
llvm::DagInit::arg_size
size_t arg_size() const
Definition: Record.h:1465
llvm::DefInit::classof
static bool classof(const Init *I)
Definition: Record.h:1273
llvm::RecordVal::getNameInitAsString
std::string getNameInitAsString() const
Get the name of the field as a std::string.
Definition: Record.h:1519
llvm::BinOpInit::DIV
@ DIV
Definition: Record.h:840
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:1032
llvm::BinOpInit::OR
@ OR
Definition: Record.h:842
llvm::Init::IK_UnOpInit
@ IK_UnOpInit
Definition: Record.h:309
llvm::Record::addAssertion
void addAssertion(SMLoc Loc, Init *Condition, Init *Message)
Definition: Record.h:1743
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:2470
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:2175
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:845
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:1739
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:912
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:1607
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:2292
llvm::FoldOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1067
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:2326
llvm::Record::getLoc
ArrayRef< SMLoc > getLoc() const
Definition: Record.h:1656
llvm::BinOpInit::GT
@ GT
Definition: Record.h:857
llvm::TernOpInit::SUBST
@ SUBST
Definition: Record.h:914
llvm::VarBitInit::get
static VarBitInit * get(TypedInit *T, unsigned B)
Definition: Record.cpp:1853
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:891
llvm::Record::checkUnusedTemplateArgs
void checkUnusedTemplateArgs()
Definition: Record.cpp:2812
llvm::FoldOpInit::get
static FoldOpInit * get(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
Definition: Record.cpp:1555
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:1578
llvm::TernOpInit::SUBSTR
@ SUBSTR
Definition: Record.h:914
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:2740
llvm::Record::AssertionInfo::Loc
SMLoc Loc
Definition: Record.h:1576
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:1489
llvm::DagInit::getArg
Init * getArg(unsigned Num) const
Definition: Record.h:1431
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:1155
llvm::RecordRecTy::operator=
RecordRecTy & operator=(const RecordRecTy &)=delete
llvm::FieldInit::getRecord
Init * getRecord() const
Definition: Record.h:1373
llvm::RecordVal::FK_NonconcreteOK
@ FK_NonconcreteOK
Definition: Record.h:1491
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:2604
llvm::TernOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:927
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:1420
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:1460
llvm::Init::operator=
Init & operator=(const Init &)=delete
llvm::TernOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1276
llvm::BitRecTy
'bit' - Represent a single bit
Definition: Record.h:108
llvm::TernOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:1360
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:2073
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:2656
llvm::UnOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:816
llvm::CondOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:2174
llvm::ListInit::getElementType
RecTy * getElementType() const
Definition: Record.h:722
llvm::BinOpInit::getLHS
Init * getLHS() const
Definition: Record.h:899
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:2871
llvm::Resolver
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:2133
llvm::Record::getTemplateArgs
ArrayRef< Init * > getTemplateArgs() const
Definition: Record.h:1680
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:900
llvm::ListInit::begin
const_iterator begin() const
Definition: Record.h:747
llvm::RecordVal::addReferenceLoc
void addReferenceLoc(SMRange Loc)
Add a reference to this record value.
Definition: Record.h:1552
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:2557
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:2849
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:1042
llvm::FieldInit::getFieldName
StringInit * getFieldName() const
Definition: Record.h:1374
llvm::Record::Record
Record(const Record &O)
Definition: Record.h:1633
llvm::CondOpInit::getVals
ArrayRef< Init * > getVals() const
Definition: Record.h:1020
llvm::ShadowResolver::ShadowResolver
ShadowResolver(Resolver &R)
Definition: Record.h:2208
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:1577
llvm::UnOpInit::GETDAGOP
@ GETDAGOP
Definition: Record.h:787
llvm::LessRecordFieldName
Sorting predicate to sort record pointers by their name field.
Definition: Record.h:2042
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:1326
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:1253
llvm::CondOpInit::arg_begin
const_case_iterator arg_begin() const
Definition: Record.h:1035
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::Record::AssertionInfo::AssertionInfo
AssertionInfo(SMLoc Loc, Init *Condition, Init *Message)
Definition: Record.h:1582
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:1051
llvm::Resolver::keepUnsetBits
virtual bool keepUnsetBits() const
Definition: Record.h:2150
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:1659
llvm::DagInit::arg_empty
bool arg_empty() const
Definition: Record.h:1466
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:1212
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:2970
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:1942
llvm::CondOpInit
!cond(condition_1: value1, ...
Definition: Record.h:976
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:1575
llvm::DagInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:2316
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:2024
llvm::RecordKeeper::stopBackendTimer
void stopBackendTimer()
Stop timing the overall backend.
Definition: Record.cpp:2878
llvm::BinOpInit::ADD
@ ADD
Definition: Record.h:837
llvm::Init::IK_DefInit
@ IK_DefInit
Definition: Record.h:302
llvm::TernOpInit::getRHS
Init * getRHS() const
Definition: Record.h:958
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Record::addTemplateArg
void addTemplateArg(Init *Name)
Definition: Record.h:1720
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:1409
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::Record::getNameInitAsString
std::string getNameInitAsString() const
Definition: Record.h:1650
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:1741
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::FoldOpInit::operator=
FoldOpInit & operator=(const FoldOpInit &)=delete
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::OpInit::getNumOperands
virtual unsigned getNumOperands() const =0
llvm::BinOpInit::getListConcat
static Init * getListConcat(TypedInit *lhs, Init *rhs)
Definition: Record.cpp:1011
llvm::StringRef::data
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
llvm::DefInit::getDef
Record * getDef() const
Definition: Record.h:1281
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:1423
llvm::SmallVectorImpl::append
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:669
llvm::IsAOpInit::isComplete
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Definition: Record.h:1111
llvm::IsAOpInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1666
llvm::VarDefInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1958
llvm::Record::getValue
const RecordVal * getValue(StringRef Name) const
Definition: Record.h:1708
llvm::HasReferenceResolver
Do not resolve anything, but keep track of whether a given variable was referenced.
Definition: Record.h:2239
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:1261
llvm::RecordVal::getValue
Init * getValue() const
Get the value of the field as an Init.
Definition: Record.h:1543
llvm::RecordKeeper::startPhaseTiming
void startPhaseTiming()
Start phase timing; called if the –time-phases option is specified.
Definition: Record.h:1959
llvm::CondOpInit::getNumConds
unsigned getNumConds() const
Definition: Record.h:1004
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:2126
llvm::UnsetInit::classof
static bool classof(const Init *I)
Definition: Record.h:468
llvm::ShadowResolver::addShadow
void addShadow(Init *Key)
Definition: Record.h:2213
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:1474
llvm::DagInit::name_size
size_t name_size() const
Definition: Record.h:1471
llvm::FieldInit
X.Y - Represent a reference to a subfield of a variable.
Definition: Record.h:1347
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:110
llvm::RecordVal::getReferenceLocs
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
Definition: Record.h:1555
llvm::TernOpInit::DAG
@ DAG
Definition: Record.h:914
llvm::RecordVal::dump
void dump() const
Definition: Record.cpp:2427
llvm::Record::dump
void dump() const
Definition: Record.cpp:2565
llvm::IsAOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1670
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:848
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:2035
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:1559
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:914
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::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::Record::getAssertions
ArrayRef< AssertionInfo > getAssertions() const
Definition: Record.h:1686
llvm::BinOpInit::NE
@ NE
Definition: Record.h:853
llvm::TrackUnresolvedResolver::TrackUnresolvedResolver
TrackUnresolvedResolver(Resolver *R=nullptr)
Definition: Record.h:2229
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:1861
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:2196
llvm::FieldInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.cpp:2095
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:1560
llvm::RecordVal::setValue
bool setValue(Init *V)
Set the value of the field from an Init.
Definition: Record.cpp:2378
llvm::Resolver::getCurrentRecord
Record * getCurrentRecord() const
Definition: Record.h:2141
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:264
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:1334
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:1885
llvm::BitInit::getValue
bool getValue() const
Definition: Record.h:512
llvm::IsAOpInit::get
static IsAOpInit * get(RecTy *CheckType, Init *Expr)
Definition: Record.cpp:1620
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:2462
llvm::DefInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1924
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:1911
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::Record::updateClassLoc
void updateClassLoc(SMLoc Loc)
Definition: Record.cpp:2440
llvm::MapResolver
Resolve arbitrary mappings.
Definition: Record.h:2161
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:2430
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:1684
llvm::DefInit
AL - Represent a reference to a 'def' in the description.
Definition: Record.h:1262
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:1498
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:53
llvm::DenseMap
Definition: DenseMap.h:714
llvm::VarInit::get
static VarInit * get(StringRef VN, RecTy *T)
Definition: Record.cpp:1823
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:2203
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::Record::addValue
void addValue(const RecordVal &RV)
Definition: Record.h:1725
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:2138
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::Record::appendReferenceLoc
void appendReferenceLoc(SMRange Loc)
Add a reference to this record value.
Definition: Record.h:1664
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:1673
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:1678
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:2800
llvm::BinOpInit::clone
OpInit * clone(ArrayRef< Init * > Operands) const override
Definition: Record.h:883
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:856
llvm::DefInit::isConcrete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Definition: Record.h:1287
llvm::BinOpInit::SHL
@ SHL
Definition: Record.h:844
llvm::ExistsOpInit::get
static ExistsOpInit * get(RecTy *CheckType, Init *Expr)
Definition: Record.cpp:1682
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:564
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:2713
llvm::IsAOpInit::operator=
IsAOpInit & operator=(const IsAOpInit &)=delete
llvm::RecordKeeper::RecordKeeper
RecordKeeper()
Definition: Record.cpp:2821
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:1588
llvm::RecordKeeper::stopPhaseTiming
void stopPhaseTiming()
Stop phase timing and print the report.
Definition: Record.h:1977
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:1773
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:2922
llvm::DefInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.h:1290
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:847
llvm::CondOpInit::arg_end
const_case_iterator arg_end() const
Definition: Record.h:1036
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:1730
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:2697
llvm::BinOpInit::EQ
@ EQ
Definition: Record.h:852
llvm::IntInit::get
static IntInit * get(RecordKeeper &RK, int64_t V)
Definition: Record.cpp:516
llvm::Record::getForwardDeclarationLocs
ArrayRef< SMLoc > getForwardDeclarationLocs() const
Definition: Record.h:1659
llvm::RecordResolver::RecordResolver
RecordResolver(Record &R)
Definition: Record.h:2193
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:1865
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:2784
llvm::RecordKeeper::getDefs
const RecordMap & getDefs() const
Get the map of records (defs).
Definition: Record.h:1906
llvm::Record
Definition: Record.h:1573
llvm::VarInit::getName
StringRef getName() const
Definition: Record.cpp:1836
llvm::MapResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:2927
llvm::ExistsOpInit
!exists<type>(expr) - Dynamically determine if a record of type named expr exists.
Definition: Record.h:1122
llvm::RecordKeeper::getClass
Record * getClass(StringRef Name) const
Get the class with the specified name.
Definition: Record.h:1912
llvm::BinOpInit::SUB
@ SUB
Definition: Record.h:838
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
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:1175
llvm::RecordResolver::setName
void setName(Init *NewName)
Definition: Record.h:2195
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:1626
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:2644
llvm::VarInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:1188
llvm::Record::getType
RecordRecTy * getType()
Definition: Record.cpp:2456
llvm::RecordKeeper::getClasses
const RecordMap & getClasses() const
Get the map of classes.
Definition: Record.h:1903
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:1762
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:1847
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:850
isDigit
static bool isDigit(const char C)
Definition: RustDemangle.cpp:176
llvm::Record::isSubClassOf
bool isSubClassOf(StringRef Name) const
Definition: Record.h:1761
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:2888
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:1773
llvm::CondOpInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:2220
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:50
llvm::LessRecordRegister::RecordParts::Parts
SmallVector< std::pair< bool, StringRef >, 4 > Parts
Definition: Record.h:2050
llvm::BitsInit::getNumBits
unsigned getNumBits() const
Definition: Record.h:549
llvm::TernOpInit::getLHS
Init * getLHS() const
Definition: Record.h:956
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:1924
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:1011
llvm::RecordVal::getNameInit
Init * getNameInit() const
Get the name of the field as an Init.
Definition: Record.h:1516
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:1646
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:2208
llvm::FoldOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1570
llvm::ListRecTy::get
static ListRecTy * get(RecTy *T)
Definition: Record.h:199
llvm::Record::getID
unsigned getID() const
Definition: Record.h:1642
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:1336
llvm::DagInit::getArgNames
ArrayRef< StringInit * > getArgNames() const
Definition: Record.h:1450
llvm::HasReferenceResolver::found
bool found() const
Definition: Record.h:2247
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:1459
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:1492
llvm::DagInit::getArgs
ArrayRef< Init * > getArgs() const
Definition: Record.h:1446
llvm::MapResolver::isComplete
bool isComplete(Init *VarName) const
Definition: Record.h:2177
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:1441
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:2767
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:1635
llvm::MapResolver::MapResolver
MapResolver(Record *CurRec=nullptr)
Definition: Record.h:2173
llvm::RecordVal::getName
StringRef getName() const
Get the name of the field as a StringRef.
Definition: Record.cpp:2359
llvm::CondOpInit::name_begin
const_val_iterator name_begin() const
Definition: Record.h:1041
llvm::RecordKeeper::stopTimer
void stopTimer()
Stop timing a phase.
Definition: Record.cpp:2864
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:2682
llvm::DagInit::arg_begin
const_arg_iterator arg_begin() const
Definition: Record.h:1462
llvm::LessRecordRegister
Definition: Record.h:2048
llvm::BitsInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:417
llvm::DagInit::getNumArgs
unsigned getNumArgs() const
Definition: Record.h:1429
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:137
llvm::FieldInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.h:1382
llvm::VarBitInit::operator=
VarBitInit & operator=(const VarBitInit &)=delete
llvm::CondOpInit::getValType
RecTy * getValType() const
Definition: Record.h:1002
llvm::LessRecordRegister::RecordParts::getPart
std::pair< bool, StringRef > getPart(size_t i)
Definition: Record.h:2075
llvm::HasReferenceResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:2990
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:993
llvm::DagInit::get
static DagInit * get(Init *V, StringInit *VN, ArrayRef< Init * > ArgRange, ArrayRef< StringInit * > NameRange)
Definition: Record.cpp:2251
llvm::BinOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:890
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:1222
llvm::DagInit::getNameStr
StringRef getNameStr() const
Definition: Record.h:1425
llvm::TernOpInit::getMHS
Init * getMHS() const
Definition: Record.h:957
llvm::LessRecordRegister::RecordParts
Definition: Record.h:2049
llvm::RecordVal::getType
RecTy * getType() const
Get the type of the field value as a RecTy.
Definition: Record.h:1537
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:846
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:914
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:1367
llvm::RecordVal::isNonconcreteOK
bool isNonconcreteOK() const
Is this a field where nonconcrete values are okay?
Definition: Record.h:1527
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:2014
llvm::Record::getRecords
RecordKeeper & getRecords() const
Definition: Record.h:1794
llvm::BinOpInit::getOpcode
BinaryOp getOpcode() const
Definition: Record.h:898
llvm::Record::isAnonymous
bool isAnonymous() const
Definition: Record.h:1798
llvm::Record::getValue
const RecordVal * getValue(const Init *Name) const
Definition: Record.h:1702
llvm::VarInit::getNameInit
Init * getNameInit() const
Definition: Record.h:1173
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:2067
llvm::RecordResolver::resolve
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Definition: Record.cpp:2945
Casting.h
llvm::DagInit::name_empty
bool name_empty() const
Definition: Record.h:1472
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::CondOpInit::case_size
size_t case_size() const
Definition: Record.h:1038
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:2025
llvm::VarBitInit::getBitNum
unsigned getBitNum() const
Definition: Record.h:1217
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:871
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:2612
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:1165
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:1463
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:1734
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:2231
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:1873
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:2081
llvm::RecordKeeper::saveInputFilename
void saveInputFilename(std::string Filename)
Definition: Record.h:1931
llvm::Record::isTemplateArg
bool isTemplateArg(Init *Name) const
Definition: Record.h:1698
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:2151
llvm::RecordVal::getLoc
const SMLoc & getLoc() const
Get the source location of the point where the field was defined.
Definition: Record.h:1524
llvm::RecordRecTy::classes_begin
const_record_iterator classes_begin() const
Definition: Record.h:262
llvm::BinOpInit::LT
@ LT
Definition: Record.h:855
llvm::VarListElementInit::operator=
VarListElementInit & operator=(const VarListElementInit &)=delete
llvm::TernOpInit::FIND
@ FIND
Definition: Record.h:914
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:858
llvm::VarDefInit::const_iterator
Init *const * const_iterator
Definition: Record.h:1331
llvm::RecordVal::RecordVal
RecordVal(Init *N, RecTy *T, FieldKind K)
Definition: Record.cpp:2345
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:1644
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:1657
llvm::RecordResolver::keepUnsetBits
bool keepUnsetBits() const override
Definition: Record.h:2199
llvm::FoldOpInit::Fold
Init * Fold(Record *CurRec) const
Definition: Record.cpp:1574
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:2755
llvm::Record::appendAssertions
void appendAssertions(const Record *Rec)
Definition: Record.h:1747
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:1192
llvm::CondOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:2119
llvm::TrackUnresolvedResolver::foundUnresolved
bool foundUnresolved() const
Definition: Record.h:2232
llvm::BinOpInit::STRCONCAT
@ STRCONCAT
Definition: Record.h:849
llvm::VarBitInit::getBitVar
Init * getBitVar() const
Definition: Record.h:1216
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:2620
llvm::RecordKeeper::getNewAnonymousName
Init * getNewAnonymousName()
GetNewAnonymousName - Generate a unique anonymous name that can be used as an identifier.
Definition: Record.cpp:2842
llvm::DagInit::getArgName
StringInit * getArgName(unsigned Num) const
Definition: Record.h:1436
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::BinOpInit::MUL
@ MUL
Definition: Record.h:839
llvm::DagInit::name_end
const_name_iterator name_end() const
Definition: Record.h:1469
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:1045
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:964
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:1333
llvm::StringInit::getFormat
StringFormat getFormat() const
Definition: Record.h:668
llvm::VarListElementInit::classof
static bool classof(const Init *I)
Definition: Record.h:1246
llvm::BitInit::classof
static bool classof(const Init *I)
Definition: Record.h:506
llvm::BinOpInit::LE
@ LE
Definition: Record.h:854
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:221
llvm::StringInit::StringFormat
StringFormat
Definition: Record.h:640
llvm::RecordResolver
Resolve all variables from a record except for unset variables.
Definition: Record.h:2187
llvm::RecordKeeper::addClass
void addClass(std::unique_ptr< Record > R)
Definition: Record.h:1935
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:2299
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:1039
llvm::AnonymousNameInit::getValue
unsigned getValue() const
Definition: Record.h:624
llvm::BinOpInit::CONCAT
@ CONCAT
Definition: Record.h:851
llvm::VarDefInit::get
static VarDefInit * get(Record *Class, ArrayRef< Init * > Args)
Definition: Record.cpp:1940
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:2043
llvm::IsAOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1101
llvm::VarListElementInit
List[4] - Represent access to one element of a var or field.
Definition: Record.h:1230
llvm::TypedInit::classof
static bool classof(const Init *I)
Definition: Record.h:432
TemplateArgs
Definition: ItaniumDemangle.h:1382
llvm::VarInit::getBit
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Definition: Record.cpp:1841
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:1341
llvm::VarDefInit::Fold
Init * Fold() const
Definition: Record.cpp:2035
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:1918
llvm::UnOpInit::getOpcode
UnaryOp getOpcode() const
Definition: Record.h:821
llvm::RecordKeeper::addExtraGlobal
void addExtraGlobal(StringRef Name, Init *I)
Definition: Record.h:1949
raw_ostream.h
llvm::TernOpInit::getOperand
Init * getOperand(unsigned i) const override
Definition: Record.h:946
llvm::ExistsOpInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:1696
llvm::RecordVal
This class represents a field in a record, including its name, type, value, and source location.
Definition: Record.h:1485
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:1297
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:1145
llvm::DagInit::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Record.cpp:2288
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:2629
llvm::BitRecTy::get
static BitRecTy * get(RecordKeeper &RK)
Definition: Record.cpp:120
llvm::RecordKeeper::dump
void dump() const
Definition: Record.cpp:2826
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:2474
llvm::Record::hasDirectSuperClass
bool hasDirectSuperClass(const Record *SuperClass) const
Determine whether this record has the specified direct superclass.
Definition: Record.cpp:2495
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:1807
llvm::Init::IK_LastTypedInit
@ IK_LastTypedInit
Definition: Record.h:321
llvm::ExistsOpInit::Fold
Init * Fold(Record *CurRec, bool IsFinal=false) const
Definition: Record.cpp:1700
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:889
llvm::Record::isValueUnset
bool isValueUnset(StringRef FieldName) const
Return true if the named field is unset.
Definition: Record.h:1816
llvm::DefInit::get
static DefInit * get(Record *)
Definition: Record.cpp:1907
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:2048
llvm::Record::getValue
RecordVal * getValue(const Init *Name)
Definition: Record.h:1712
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:2728
llvm::Init::IK_IsAOpInit
@ IK_IsAOpInit
Definition: Record.h:313
llvm::LessRecordRegister::RecordParts::RecordParts
RecordParts(StringRef Rec)
Definition: Record.h:2052
llvm::ExistsOpInit::classof
static bool classof(const Init *I)
Definition: Record.h:1135
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:2155
llvm::AnonymousNameInit::get
static AnonymousNameInit * get(RecordKeeper &RK, unsigned)
Definition: Record.cpp:574
llvm::HasReferenceResolver::HasReferenceResolver
HasReferenceResolver(Init *VarNameToTrack)
Definition: Record.h:2244
llvm::RecordKeeper::getGlobals
const GlobalMap & getGlobals() const
Get the map of global variables.
Definition: Record.h:1909
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:1603
llvm::VarListElementInit::getAsString
std::string getAsString() const override
Convert this value to a literal form.
Definition: Record.cpp:1881