Go to the documentation of this file.
14 #ifndef LLVM_TABLEGEN_RECORD_H
15 #define LLVM_TABLEGEN_RECORD_H
43 struct RecordKeeperImpl;
80 virtual ~RecTy() =
default;
245 void operator delete(
void *
p) { ::operator
delete(
p); }
258 return ArrayRef(getTrailingObjects<Record *>(), NumClasses);
333 virtual void anchor();
348 virtual ~Init() =
default;
409 return const_cast<Init *
>(
this);
417 I.print(OS);
return OS;
518 assert(
Bit < 1 &&
"Bit index out of range!");
519 return const_cast<BitInit*
>(
this);
540 void operator delete(
void *
p) { ::operator
delete(
p); }
573 assert(
Bit < NumBits &&
"Bit index out of range!");
574 return getTrailingObjects<Init *>()[
Bit];
654 StringInit(
const StringInit &) =
delete;
655 StringInit &
operator=(
const StringInit &) =
delete;
678 return "\"" +
Value.str() +
"\"";
680 return "[{" +
Value.str() +
"}]";
684 return std::string(
Value);
710 void operator delete(
void *
p) { ::operator
delete(
p); }
720 assert(
i < NumValues &&
"List element index out of range!");
721 return getTrailingObjects<Init *>()[
i];
724 return cast<ListRecTy>(
getType())->getElementType();
745 return ArrayRef(getTrailingObjects<Init *>(), NumValues);
751 size_t size ()
const {
return NumValues; }
752 bool empty()
const {
return NumValues == 0; }
797 UnOpInit(
const UnOpInit &) =
delete;
798 UnOpInit &
operator=(
const UnOpInit &) =
delete;
811 "Wrong number of operands for unary operation");
818 assert(
i == 0 &&
"Invalid operand id for unary operator");
870 BinOpInit(
const BinOpInit &) =
delete;
871 BinOpInit &
operator=(
const BinOpInit &) =
delete;
887 "Wrong number of operands for binary operation");
921 Init *LHS, *MHS, *RHS;
928 TernOpInit(
const TernOpInit &) =
delete;
929 TernOpInit &
operator=(
const TernOpInit &) =
delete;
944 "Wrong number of operands for ternary operation");
987 NumConds(
NC), ValType(
Type) {}
989 size_t numTrailingObjects(OverloadToken<Init *>)
const {
1011 assert(Num < NumConds &&
"Condition number out of range!");
1012 return getTrailingObjects<Init *>()[Num];
1016 assert(Num < NumConds &&
"Val number out of range!");
1017 return getTrailingObjects<Init *>()[Num+NumConds];
1021 return ArrayRef(getTrailingObjects<Init *>(), NumConds);
1025 return ArrayRef(getTrailingObjects<Init *>() + NumConds, NumConds);
1099 CheckType(CheckType), Expr(Expr) {}
1133 CheckType(CheckType), Expr(Expr) {}
1204 (isa<IntRecTy>(
T->getType()) ||
1205 (isa<BitsRecTy>(
T->getType()) &&
1206 cast<BitsRecTy>(
T->getType())->getNumBits() >
B)) &&
1207 "Illegal VarBitInit expression!");
1227 assert(
B < 1 &&
"Bit index out of range!");
1240 cast<ListRecTy>(
T->getType())->getElementType()),
1242 assert(
T->getType() && isa<ListRecTy>(
T->getType()) &&
1243 "Illegal VarBitInit expression!");
1316 void operator delete(
void *
p) { ::operator
delete(
p); }
1331 assert(
i < NumArgs &&
"Argument index out of range!");
1332 return getTrailingObjects<Init *>()[
i];
1360 <<
", got FieldName = " << *FieldName
1361 <<
" with non-record type!\n";
1401 unsigned NumArgNames;
1405 ValName(VN), NumArgs(NumArgs), NumArgNames(NumArgNames) {}
1407 size_t numTrailingObjects(OverloadToken<Init *>)
const {
return NumArgs; }
1436 assert(Num < NumArgs &&
"Arg number out of range!");
1437 return getTrailingObjects<Init *>()[Num];
1441 assert(Num < NumArgNames &&
"Arg number out of range!");
1442 return getTrailingObjects<StringInit *>()[Num];
1451 return ArrayRef(getTrailingObjects<Init *>(), NumArgs);
1455 return ArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
1504 bool IsUsed =
false;
1573 RV.
print(OS <<
" ");
1610 DefInit *CorrespondingDefInit =
nullptr;
1623 bool Anonymous =
false,
bool Class =
false)
1624 : Name(
N), Locs(locs.
begin(), locs.
end()), TrackedRecords(records),
1625 ID(
getNewUID(
N->getRecordKeeper())), IsAnonymous(Anonymous),
1639 Values(
O.Values), Assertions(
O.Assertions),
1640 SuperClasses(
O.SuperClasses), TrackedRecords(
O.TrackedRecords),
1642 IsClass(
O.IsClass) {}
1664 return ForwardDeclarationLocs;
1693 return SuperClasses;
1708 if (Val.Name == Name)
return &Val;
1731 Values.push_back(RV);
1735 for (
unsigned i = 0,
e = Values.size();
i !=
e; ++
i)
1737 Values.
erase(Values.begin()+
i);
1748 Assertions.push_back(
AssertionInfo(Loc, Condition, Message));
1752 Assertions.
append(Rec->Assertions);
1759 for (
const auto &SCPair : SuperClasses)
1760 if (SCPair.first == R)
1766 for (
const auto &SCPair : SuperClasses) {
1767 if (
const auto *
SI = dyn_cast<StringInit>(SCPair.first->getNameInit())) {
1768 if (
SI->getValue() == Name)
1770 }
else if (SCPair.first->getNameInitAsString() == Name) {
1778 assert(!CorrespondingDefInit &&
1779 "changing type of record after it has been referenced");
1781 SuperClasses.push_back(std::make_pair(R, Range));
1799 return TrackedRecords;
1890 raw_ostream &
operator<<(raw_ostream &OS,
const Record &R);
1893 using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
1894 using GlobalMap = std::map<std::string, Init *, std::less<>>;
1917 auto I = Classes.find(Name);
1918 return I == Classes.end() ? nullptr :
I->second.get();
1923 auto I = Defs.find(Name);
1924 return I == Defs.end() ? nullptr :
I->second.get();
1930 return R->getDefInit();
1931 auto It = ExtraGlobals.find(Name);
1932 return It == ExtraGlobals.end() ? nullptr : It->second;
1936 InputFilename = Filename;
1940 bool Ins = Classes.insert(std::make_pair(std::string(R->getName()),
1947 bool Ins = Defs.insert(std::make_pair(std::string(R->getName()),
1954 bool Ins = ExtraGlobals.insert(std::make_pair(std::string(Name),
I)).second;
1964 TimingGroup =
new TimerGroup(
"TableGen",
"TableGen Phase Timing");
2000 std::vector<Record *>
2011 std::string InputFilename;
2012 RecordMap Classes, Defs;
2014 GlobalMap ExtraGlobals;
2020 Timer *LastTimer =
nullptr;
2021 bool BackendTimer =
false;
2024 std::unique_ptr<detail::RecordKeeperImpl> Impl;
2040 return LHS->getID() <
RHS->getID();
2061 const char *Start = Rec.
data();
2062 const char *Curr = Start;
2063 bool IsDigitPart =
isDigit(Curr[0]);
2064 for (
size_t I = 0,
E = Rec.
size();
I !=
E; ++
I, ++Len) {
2066 if (IsDigit != IsDigitPart) {
2067 Parts.push_back(std::make_pair(IsDigitPart,
StringRef(Start, Len)));
2074 Parts.push_back(std::make_pair(IsDigitPart,
StringRef(Start, Len)));
2089 size_t LHSNumParts = LHSParts.
size();
2090 size_t RHSNumParts = RHSParts.
size();
2091 assert (LHSNumParts && RHSNumParts &&
"Expected at least one part!");
2093 if (LHSNumParts != RHSNumParts)
2094 return LHSNumParts < RHSNumParts;
2097 for (
size_t I = 0,
E = LHSNumParts;
I <
E;
I+=2) {
2098 std::pair<bool, StringRef> LHSPart = LHSParts.
getPart(
I);
2099 std::pair<bool, StringRef> RHSPart = RHSParts.
getPart(
I);
2101 assert (LHSPart.first ==
false && RHSPart.first ==
false &&
2102 "Expected both parts to be alpha.");
2103 if (
int Res = LHSPart.second.compare(RHSPart.second))
2106 for (
size_t I = 1,
E = LHSNumParts;
I <
E;
I+=2) {
2107 std::pair<bool, StringRef> LHSPart = LHSParts.
getPart(
I);
2108 std::pair<bool, StringRef> RHSPart = RHSParts.
getPart(
I);
2110 assert (LHSPart.first ==
true && RHSPart.first ==
true &&
2111 "Expected both parts to be numeric.");
2112 if (LHSPart.second.size() != RHSPart.second.size())
2113 return LHSPart.second.size() < RHSPart.second.size();
2115 unsigned LHSVal, RHSVal;
2117 bool LHSFailed = LHSPart.second.getAsInteger(10, LHSVal); (void)LHSFailed;
2118 assert(!LHSFailed &&
"Unable to convert LHS to integer.");
2119 bool RHSFailed = RHSPart.second.getAsInteger(10, RHSVal); (void)RHSFailed;
2120 assert(!RHSFailed &&
"Unable to convert RHS to integer.");
2122 if (LHSVal != RHSVal)
2123 return LHSVal < RHSVal;
2125 return LHSNumParts < RHSNumParts;
2129 raw_ostream &
operator<<(raw_ostream &OS,
const RecordKeeper &RK);
2139 bool IsFinal =
false;
2166 struct MappedValue {
2170 MappedValue() : V(
nullptr), Resolved(
false) {}
2171 MappedValue(
Init *V,
bool Resolved) : V(V), Resolved(Resolved) {}
2183 assert(It != Map.end() &&
"key must be present in map");
2184 return It->second.V->isComplete();
2194 Init *Name =
nullptr;
2230 bool FoundUnresolved =
false;
2244 Init *VarNameToTrack;
2249 :
Resolver(nullptr), VarNameToTrack(VarNameToTrack) {}
2257 void EmitJSON(RecordKeeper &RK, raw_ostream &OS);
2261 #endif // LLVM_TABLEGEN_RECORD_H
virtual bool isComplete() const
Is this a complete value with no unset (uninitialized) subvalues?
ArrayRef< Init * > getConds() const
Init * Fold(Record *CurRec) const
static bool classof(const Init *I)
RecordVal * getValue(StringRef Name)
bool isSubClassOf(const Record *R) const
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
OpInit & operator=(OpInit &)=delete
SmallVectorImpl< Init * >::const_iterator const_val_iterator
const std::string getInputFilename() const
Get the main TableGen input file's name.
TernaryOp getOpcode() const
Init * getBit(unsigned B) const override
Get the Init value of the specified bit.
std::string getAsString() const override
Convert this value to a literal form.
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This function is used to implement the list slice selection operator.
std::string getPrintType() const
Get the type of the field for printing purposes.
StringInit & operator=(const StringInit &)=delete
void setFinal(bool Final)
This is an optimization pass for GlobalISel generic memory operations.
unsigned getNumOperands() const override
iterator erase(const_iterator CI)
'string' - Represent an string value
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
ArrayRef< Init * > args() const
bool hasCodeFormat() const
std::string getAsString() const override
Convert this value to a literal form.
bool isTemplateArg() const
Is this a template argument?
const_name_iterator name_begin() const
virtual Init * convertInitializerTo(RecTy *Ty) const =0
Convert to a value whose type is Ty, or return null if this is not possible.
Init * getCond(unsigned Num) const
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Init * getCastTo(RecTy *Ty) const override
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
std::string getAsString() const override
Convert this value to a literal form.
virtual Init * getCastTo(RecTy *Ty) const =0
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
void getDirectSuperClasses(SmallVectorImpl< Record * > &Classes) const
Append the direct superclasses of this record to Classes.
FieldInit & operator=(const FieldInit &)=delete
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...
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
std::string getAsString() const override
Convert this value to a literal form.
Base class for operators.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
static BinOpInit * get(BinaryOp opc, Init *lhs, Init *rhs, RecTy *Type)
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
OpInit(InitKind K, RecTy *Type, uint8_t Opc)
std::vector< Record * > getValueAsListOfDefs(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of records,...
Record(Init *N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Anonymous=false, bool Class=false)
std::string getAsString() const override
Convert this value to a literal form.
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
RecTy * getFieldType(StringInit *FieldName) const override
This method is used to implement the FieldInit class.
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
detail::RecordKeeperImpl & getImpl()
Return the internal implementation of the RecordKeeper.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
!isa<type>(expr) - Dynamically determine the type of an expression.
TypedInit & operator=(const TypedInit &)=delete
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
std::string getAsString() const override
Get the string representation of the Init.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
TypedInit * getVariable() const
unsigned getNumBits() const
static DagRecTy * get(RecordKeeper &RK)
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...
OpInit * clone(ArrayRef< Init * > Operands) const override
ArrayRef< std::pair< Record *, SMRange > > getSuperClasses() const
static bool classof(const Init *I)
(v a, b) - Represent a DAG tree value.
static FieldInit * get(Init *R, StringInit *FN)
unsigned getNumOperands() const override
Sorting predicate to sort record pointers by their unique ID.
virtual Init * getOperand(unsigned i) const =0
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
RecordKeeper & getRecordKeeper() const
Get the record keeper used to unique this value.
(Optionally) delegate resolving to a sub-resolver, and keep track whether there were unresolved refer...
static bool classof(const Init *I)
std::string getNameInitAsString() const
Get the name of the field as a std::string.
void print(raw_ostream &OS) const
SmallVectorImpl< Init * >::const_iterator const_case_iterator
void addAssertion(SMLoc Loc, Init *Condition, Init *Message)
The instances of the Type class are immutable: once they are created, they are never changed.
static unsigned getNewUID(RecordKeeper &RK)
This class is used to track the amount of time spent between invocations of its startTimer()/stopTime...
'int' - Represent an integer value of no particular size
void set(Init *Key, Init *Value)
!op (X, Y) - Combine two inits.
const_iterator end(StringRef path)
Get end iterator over path.
void removeValue(StringRef Name)
StringInit * getNameInit() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
!op (X, Y, Z) - Combine two inits.
BinOpInit & operator=(const BinOpInit &)=delete
'dag' - Represent a dag fragment
std::string getAsString() const override
Convert this value to a literal form.
virtual OpInit * clone(ArrayRef< Init * > Operands) const =0
Record * getOperatorAsDef(ArrayRef< SMLoc > Loc) const
static bool classof(const Init *I)
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
std::string getAsString() const override
Convert this value to a literal form.
ArrayRef< SMLoc > getLoc() const
static VarBitInit * get(TypedInit *T, unsigned B)
static ListInit * get(ArrayRef< Init * > Range, RecTy *EltTy)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void checkUnusedTemplateArgs()
static FoldOpInit * get(Init *Start, Init *List, Init *A, Init *B, Init *Expr, RecTy *Type)
virtual Init * getBit(unsigned Bit) const =0
Get the Init value of the specified bit.
static Init * getStrConcat(Init *lhs, Init *rhs)
InitKind getKind() const
Get the kind (type) of the value.
std::pair< iterator, bool > insert(const ValueT &V)
Record * getValueAsOptionalDef(StringRef FieldName) const
This method looks up the specified field and returns its value as a Record, returning null if the fie...
static bool classof(const Init *I)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
Init * getArg(unsigned Num) const
the resulting code requires compare and branches when and if * p
'Opcode' - Represent a reference to an entire variable object.
RecordRecTy & operator=(const RecordRecTy &)=delete
InitKind
Discriminator enum (for isa<>, dyn_cast<>, et al.)
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
SMLoc getFieldLoc(StringRef FieldName) const
Return the source location for the named field.
static bool classof(const Init *I)
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...
Init * getOperator() const
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
SmallVectorImpl< StringInit * >::const_iterator const_name_iterator
Init & operator=(const Init &)=delete
void Profile(FoldingSetNodeID &ID) const
'bit' - Represent a single bit
Init * Fold(Record *CurRec) const
TypedInit(InitKind K, RecTy *T, uint8_t Opc=0)
ListInit * getValueAsListInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a ListInit, throwing an exception i...
Init * getOperand(unsigned i) const override
Init * Fold(Record *CurRec) const
RecTy * getElementType() const
'bits<n>' - Represent a fixed number of bits
void startBackendTimer(StringRef Name)
Start timing the overall backend.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
ArrayRef< Init * > getTemplateArgs() const
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
static bool classof(const RecTy *RT)
std::string getAsString() const override
const_iterator begin() const
void addReferenceLoc(SMRange Loc)
Add a reference to this record value.
void resolveReferences(Init *NewName=nullptr)
If there are any field references that refer to fields that have been filled in, we can propagate the...
RecordKeeper & getRecordKeeper() const
Return the RecordKeeper that uniqued this Type.
void startTimer(StringRef Name)
Start timing a phase. Automatically stops any previous phase timer.
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
const_val_iterator name_end() const
StringInit * getFieldName() const
ArrayRef< Init * > getVals() const
ShadowResolver(Resolver &R)
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Sorting predicate to sort record pointers by their name field.
Represents a location in source code.
virtual ~Resolver()=default
std::string getAsString() const override
Convert this value to a literal form.
static BitInit * get(RecordKeeper &RK, bool V)
Init * getArg(unsigned i) const
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
unsigned getElementNum() const
const_case_iterator arg_begin() const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
AssertionInfo(SMLoc Loc, Init *Condition, Init *Message)
static bool classof(const RecTy *RT)
!foldl (a, b, expr, start, lst) - Fold over a list.
virtual bool keepUnsetBits() const
std::string getAsString() const override
Convert this value to a literal form.
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...
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...
(vector float) vec_cmpeq(*A, *B) C
static bool classof(const Init *I)
AnonymousNameInit & operator=(const AnonymousNameInit &)=delete
RecTy * getElementType() const
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
void addDef(std::unique_ptr< Record > R)
!cond(condition_1: value1, ...
virtual RecTy * getFieldType(StringInit *FieldName) const
This function is used to implement the FieldInit class.
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
std::string getAsString() const override
void dump() const
Debugging method that may be called through a debugger; just invokes print on stderr.
Sorting predicate to sort record pointers by name.
void stopBackendTimer()
Stop timing the overall backend.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void addTemplateArg(Init *Name)
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...
static bool classof(const Init *I)
RecTy * getType() const
Get the type of the Init as a RecTy.
std::string getNameInitAsString() const
std::string getAsString() const override
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
This class implements an extremely fast bulk output stream that can only output to a stream.
FoldOpInit & operator=(const FoldOpInit &)=delete
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
virtual unsigned getNumOperands() const =0
static Init * getListConcat(TypedInit *lhs, Init *rhs)
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
StringInit * getName() const
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
void Profile(FoldingSetNodeID &ID) const
const RecordVal * getValue(StringRef Name) const
Do not resolve anything, but keep track of whether a given variable was referenced.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
static TernOpInit * get(TernaryOp opc, Init *lhs, Init *mhs, Init *rhs, RecTy *Type)
Init * getValue() const
Get the value of the field as an Init.
void startPhaseTiming()
Start phase timing; called if the –time-phases option is specified.
unsigned getNumConds() const
std::string getAsString() const override
Convert this value to a literal form.
static CondOpInit * get(ArrayRef< Init * > C, ArrayRef< Init * > V, RecTy *Type)
static bool classof(const Init *I)
void addShadow(Init *Key)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
"anonymous_n" - Represent an anonymous record name
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
X.Y - Represent a reference to a subfield of a variable.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
ArrayRef< SMRange > getReferenceLocs() const
Return the references of this record value.
std::string getAsString() const override
Convert this value to a literal form.
Init *const * const_iterator
BitsInit & operator=(const BitsInit &)=delete
mir Rename Register Operands
bool operator()(const Record *LHS, const Record *RHS) const
void setUsed(bool Used)
Whether this value is used.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
static bool classof(const Init *I)
std::optional< StringRef > getValueAsOptionalString(StringRef FieldName) const
This method looks up the specified field and returns its value as a string, throwing an exception if ...
constexpr bool empty() const
empty - Check if the string is empty.
ArrayRef< AssertionInfo > getAssertions() const
TrackUnresolvedResolver(Resolver *R=nullptr)
PointerTy getPointer() const
std::string getAsString() const override
Convert this value to a literal form.
VarDefInit & operator=(const VarDefInit &)=delete
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
Implements a dense probed hash-table based set.
!op (X) - Transform an init.
bool setValue(Init *V)
Set the value of the field from an Init.
Record * getCurrentRecord() const
virtual bool isConcrete() const
Is this a concrete and fully resolved value without any references or stuck operations?...
ListInit & operator=(const ListInit &)=delete
static bool classof(const Init *I)
const_iterator args_end() const
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
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...
static IsAOpInit * get(RecTy *CheckType, Init *Expr)
void EmitDetailedRecords(RecordKeeper &RK, raw_ostream &OS)
'7' - Represent an initialization by a literal integer value.
DefInit * getDefInit()
get the corresponding DefInit.
std::string getAsString() const override
Convert this value to a literal form.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
[AL, AH, CL] - Represent a list of defs
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
virtual Init * convertInitListSlice(ArrayRef< unsigned > Elements) const
This function is used to implement the list slice selection operator.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static bool classof(const Init *I)
void updateClassLoc(SMLoc Loc)
Resolve arbitrary mappings.
void print(raw_ostream &OS, bool PrintSem=true) const
Print the value to an output stream, possibly with a semicolon.
static BitsInit * get(RecordKeeper &RK, ArrayRef< Init * > Range)
Record *const * const_record_iterator
ArrayRef< RecordVal > getValues() const
AL - Represent a reference to a 'def' in the description.
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...
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
static VarInit * get(StringRef VN, RecTy *T)
Init(InitKind K, uint8_t Opc=0)
'[classname]' - Type of record values that have zero or more superclasses.
Delegate resolving to a sub-resolver, but shadow some variable names.
void addValue(const RecordVal &RV)
bool allInComplete() const
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
void appendReferenceLoc(SMRange Loc)
Add a reference to this record value.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
static bool classof(const RecTy *RT)
void checkRecordAssertions()
OpInit * clone(ArrayRef< Init * > Operands) const override
bool typeIsA(const RecTy *RHS) const override
Return true if 'this' type is equal to or a subtype of RHS.
RecTy * resolveTypes(RecTy *T1, RecTy *T2)
Find a common type that T1 and T2 convert to.
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
static ExistsOpInit * get(RecTy *CheckType, Init *Expr)
typename SuperClass::const_iterator const_iterator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
'list<Ty>' - Represent a list of element values, all of which must be of the specified type.
std::vector< StringRef > getValueAsListOfStrings(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of strings,...
IsAOpInit & operator=(const IsAOpInit &)=delete
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...
void stopPhaseTiming()
Stop phase timing and print the report.
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
Init * Fold(Record *CurRec) const
std::vector< Record * > getAllDerivedDefinitionsIfDefined(StringRef ClassName) const
Get all the concrete records that inherit from specified class, if the class is defined.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
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...
const_case_iterator arg_end() const
virtual std::string getAsUnquotedString() const
Convert this value to a literal form, without adding quotes around a string.
void removeValue(Init *Name)
std::vector< int64_t > getValueAsListOfInts(StringRef FieldName) const
This method looks up the specified field and returns its value as a vector of integers,...
static IntInit * get(RecordKeeper &RK, int64_t V)
ArrayRef< SMLoc > getForwardDeclarationLocs() const
RecordResolver(Record &R)
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...
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
DagInit * getValueAsDag(StringRef FieldName) const
This method looks up the specified field and returns its value as an Dag, throwing an exception if th...
const RecordMap & getDefs() const
Get the map of records (defs).
StringRef getName() const
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
!exists<type>(expr) - Dynamically determine if a record of type named expr exists.
Record * getClass(StringRef Name) const
Get the class with the specified name.
static bool classof(const Init *I)
virtual std::string getAsString() const =0
Convert this value to a literal form.
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
std::string getNameInitAsString() const
void setName(Init *NewName)
std::string getAsString() const override
Record(StringRef N, ArrayRef< SMLoc > locs, RecordKeeper &records, bool Class=false)
BitsInit * getValueAsBitsInit(StringRef FieldName) const
This method looks up the specified field and returns its value as a BitsInit, throwing an exception i...
std::string getAsString() const override
Convert this value to a literal form.
const RecordMap & getClasses() const
Get the map of classes.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
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...
"foo" - Represent an initialization by a string value.
Init * convertInitializerTo(RecTy *Ty) const override
Convert to a value whose type is Ty, or return null if this is not possible.
static bool isDigit(const char C)
bool isSubClassOf(StringRef Name) const
std::vector< Record * > getAllDerivedDefinitions(StringRef ClassName) const
Get all the concrete records that inherit from the one specified class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void addSuperClass(Record *R, SMRange Range)
std::string getAsString() const override
Convert this value to a literal form.
void Profile(FoldingSetNodeID &ID) const
StringRef - Represent a constant reference to a string, i.e.
SmallVector< std::pair< bool, StringRef >, 4 > Parts
unsigned getNumBits() const
Node - This class is used to maintain the singly linked bucket list in a folding set.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
'true'/'false' - Represent a concrete initializer for a bit.
Init * getGlobal(StringRef Name) const
Get the Init value of the specified global variable.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Init * getVal(unsigned Num) const
Init * getNameInit() const
Get the name of the field as an Init.
virtual bool typeIsA(const RecTy *RHS) const
Return true if 'this' type is equal to or a subtype of RHS.
void EmitJSON(RecordKeeper &RK, raw_ostream &OS)
Init * getNameInit() const
ArrayRef< Record * > getClasses() const
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
void Profile(FoldingSetNodeID &ID) const
static ListRecTy * get(RecTy *T)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
void Profile(FoldingSetNodeID &ID) const
ArrayRef< StringInit * > getArgNames() const
SmallVectorImpl< Init * >::const_iterator const_arg_iterator
static bool classof(const RecTy *RT)
DagInit & operator=(const DagInit &)=delete
ArrayRef< Init * > getArgs() const
bool isComplete(Init *VarName) const
std::string getAsString() const override
StringRef getArgNameStr(unsigned Num) const
bool getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const
This method looks up the specified field and returns its value as a bit.
ListRecTy * getListTy()
Returns the type representing list<thistype>.
void Profile(FoldingSetNodeID &ID) const
MapResolver(Record *CurRec=nullptr)
StringRef getName() const
Get the name of the field as a StringRef.
const_val_iterator name_begin() const
void stopTimer()
Stop timing a phase.
static bool classof(const Init *I)
const_record_iterator classes_end() const
std::optional< bool > CompareInit(unsigned Opc, Init *LHS, Init *RHS) const
ExistsOpInit & operator=(const ExistsOpInit &)=delete
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...
const_arg_iterator arg_begin() const
void Profile(FoldingSetNodeID &ID) const
unsigned getNumArgs() const
constexpr size_t size() const
size - Get the string size.
std::string getAsString() const override
Convert this value to a literal form.
VarBitInit & operator=(const VarBitInit &)=delete
RecTy * getValType() const
std::pair< bool, StringRef > getPart(size_t i)
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const override
This function is used to implement the bit range selection operator.
static BitsRecTy * get(RecordKeeper &RK, unsigned Sz)
ArrayRef< Init * > getValues() const
'?' - Represents an uninitialized value.
static bool classof(const Init *I)
static DagInit * get(Init *V, StringInit *VN, ArrayRef< Init * > ArgRange, ArrayRef< StringInit * > NameRange)
Init * getOperand(unsigned i) const override
std::string getAsString() const override
Convert this value to a literal form.
StringRef getNameStr() const
RecTy * getType() const
Get the type of the field value as a RecTy.
static UnOpInit * get(UnaryOp opc, Init *lhs, RecTy *Type)
The TimerGroup class is used to group together related timers into a single report that is printed wh...
static StringRecTy * get(RecordKeeper &RK)
static bool classof(const RecTy *RT)
std::string getAsString() const override
Convert this value to a literal form.
const_iterator end() const
virtual Init * resolve(Init *VarName)=0
Return the initializer for the given variable name (should normally be a StringInit),...
static bool classof(const Init *I)
bool isNonconcreteOK() const
Is this a field where nonconcrete values are okay?
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...
RecordKeeper & getRecords() const
BinaryOp getOpcode() const
const RecordVal * getValue(const Init *Name) const
Init * getNameInit() const
StringRef getValue() const
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
Init * resolve(Init *VarName) override
Return the initializer for the given variable name (should normally be a StringInit),...
bool operator()(const Record *Rec1, const Record *Rec2) const
unsigned getBitNum() const
BitInit & operator=(BitInit &)=delete
See the file comment for details on the usage of the TrailingObjects type.
RecordKeeper & getRecordKeeper() const
Get the record keeper that initialized this Init.
This class represents the internal implementation of the RecordKeeper.
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
static bool classof(const Init *I)
Init * getValueInit(StringRef FieldName) const
Return the initializer for a value with the specified name, or throw an exception if the field does n...
virtual Init * convertInitializerBitRange(ArrayRef< unsigned > Bits) const
This function is used to implement the bit range selection operator.
static bool classof(const Init *I)
std::string getAsString() const override
const_arg_iterator arg_end() const
void print(raw_ostream &OS) const
Print this value.
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...
void Profile(FoldingSetNodeID &ID) const
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
OpInit * clone(ArrayRef< Init * > Operands) const override
VarInit & operator=(const VarInit &)=delete
static VarListElementInit * get(TypedInit *T, unsigned E)
DefInit & operator=(const DefInit &)=delete
Init * getCastTo(RecTy *Ty) const override
If this value is convertible to type Ty, return a value whose type is Ty, generating a !...
bool operator()(const Record *Rec1, const Record *Rec2) const
void saveInputFilename(std::string Filename)
bool isTemplateArg(Init *Name) const
UnsetInit & operator=(const UnsetInit &)=delete
virtual bool typeIsConvertibleTo(const RecTy *RHS) const
Return true if all values of 'this' type can be converted to the specified type.
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...
const SMLoc & getLoc() const
Get the source location of the point where the field was defined.
const_record_iterator classes_begin() const
VarListElementInit & operator=(const VarListElementInit &)=delete
virtual std::string getAsString() const =0
PointerIntPair - This class implements a pair of a pointer and small integer.
Init *const * const_iterator
RecordVal(Init *N, RecTy *T, FieldKind K)
RecTyKind getRecTyKind() const
StringRef getName() const
IntInit & operator=(const IntInit &)=delete
static RecordRecTy * get(RecordKeeper &RK, ArrayRef< Record * > Classes)
Get the record type with the given non-redundant list of superclasses.
Record * getElementAsRecord(unsigned i) const
void appendLoc(SMLoc Loc)
bool keepUnsetBits() const override
Init * Fold(Record *CurRec) const
Represents a range in source code.
Init * Fold(Record *CurRec, bool IsFinal=false) const
static StringFormat determineFormat(StringFormat Fmt1, StringFormat Fmt2)
bool getValueAsBit(StringRef FieldName) const
This method looks up the specified field and returns its value as a bit, throwing an exception if the...
void appendAssertions(const Record *Rec)
RecTyKind
Subclass discriminator (for dyn_cast<> et al.)
Opcode{0} - Represent access to one bit of a variable or field.
void Profile(FoldingSetNodeID &ID) const
bool foundUnresolved() const
TernOpInit & operator=(const TernOpInit &)=delete
StringRef getValueAsString(StringRef FieldName) const
This method looks up the specified field and returns its value as a string, throwing an exception if ...
Init * getNewAnonymousName()
GetNewAnonymousName - Generate a unique anonymous name that can be used as an identifier.
StringInit * getArgName(unsigned Num) const
std::string getAsString() const override
Init * getOperand() const
const_name_iterator name_end() const
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
const_iterator args_begin() const
StringFormat getFormat() const
static bool classof(const Init *I)
static bool classof(const Init *I)
ArrayRef(const T &OneElt) -> ArrayRef< T >
std::string str() const
str - Get the contents as an std::string.
Resolve all variables from a record except for unset variables.
void addClass(std::unique_ptr< Record > R)
std::string getAsUnquotedString() const override
Convert this value to a literal form, without adding quotes around a string.
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...
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...
unsigned getValue() const
static VarDefInit * get(Record *Class, ArrayRef< Init * > Args)
'{ a, b, c }' - Represents an initializer for a BitsRecTy value.
CondOpInit & operator=(const CondOpInit &)=delete
bool operator()(const Record *Rec1, const Record *Rec2) const
static bool classof(const Init *I)
List[4] - Represent access to one element of a var or field.
static bool classof(const Init *I)
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
static bool classof(const RecTy *RT)
Record * getDef(StringRef Name) const
Get the concrete record with the specified name.
UnaryOp getOpcode() const
void addExtraGlobal(StringRef Name, Init *I)
Init * getOperand(unsigned i) const override
void Profile(FoldingSetNodeID &ID) const
This class represents a field in a record, including its name, type, value, and source location.
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
RecTy(RecTyKind K, RecordKeeper &RK)
bool isSubClassOf(Record *Class) const
classname<targs...> - Represent an uninstantiated anonymous class instantiation.
UnOpInit & operator=(const UnOpInit &)=delete
bool typeIsConvertibleTo(const RecTy *RHS) const override
Return true if all values of 'this' type can be converted to the specified type.
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
void Profile(FoldingSetNodeID &ID) const
static BitRecTy * get(RecordKeeper &RK)
static IntRecTy * get(RecordKeeper &RK)
bool hasDirectSuperClass(const Record *SuperClass) const
Determine whether this record has the specified direct superclass.
LLVM Value Representation.
Init * convertInitListSlice(ArrayRef< unsigned > Elements) const override
This function is used to implement the list slice selection operator.
Init * Fold(Record *CurRec, bool IsFinal=false) const
Init * getElement(unsigned i) const
bool isComplete() const override
Is this a complete value with no unset (uninitialized) subvalues?
unsigned getNumOperands() const override
bool isValueUnset(StringRef FieldName) const
Return true if the named field is unset.
static DefInit * get(Record *)
void Profile(FoldingSetNodeID &ID) const
static StringInit * get(RecordKeeper &RK, StringRef, StringFormat Fmt=SF_String)
std::string getAsString() const override
Convert this value to a literal form.
RecordVal * getValue(const Init *Name)
Record * getValueAsDef(StringRef FieldName) const
This method looks up the specified field and returns its value as a Record, throwing an exception if ...
RecordParts(StringRef Rec)
static bool classof(const Init *I)
static UnsetInit * get(RecordKeeper &RK)
Get the singleton unset Init.
static bool classof(const RecTy *RT)
static AnonymousNameInit * get(RecordKeeper &RK, unsigned)
HasReferenceResolver(Init *VarNameToTrack)
const GlobalMap & getGlobals() const
Get the map of global variables.
This is the common superclass of types that have a specific, explicit type, stored in ValueTy.
Init * getBit(unsigned Bit) const override
Get the Init value of the specified bit.
std::string getAsString() const override
Convert this value to a literal form.