Go to the documentation of this file.
14 #ifndef LLVM_TABLEGEN_RECORD_H
15 #define LLVM_TABLEGEN_RECORD_H
42 struct RecordKeeperImpl;
79 virtual ~RecTy() =
default;
244 void operator delete(
void *
p) { ::operator
delete(
p); }
257 return makeArrayRef(getTrailingObjects<Record *>(), NumClasses);
332 virtual void anchor();
347 virtual ~Init() =
default;
408 return const_cast<Init *
>(
this);
416 I.print(OS);
return OS;
517 assert(
Bit < 1 &&
"Bit index out of range!");
518 return const_cast<BitInit*
>(
this);
539 void operator delete(
void *
p) { ::operator
delete(
p); }
572 assert(
Bit < NumBits &&
"Bit index out of range!");
573 return getTrailingObjects<Init *>()[
Bit];
653 StringInit(
const StringInit &) =
delete;
654 StringInit &
operator=(
const StringInit &) =
delete;
677 return "\"" +
Value.str() +
"\"";
679 return "[{" +
Value.str() +
"}]";
683 return std::string(
Value);
709 void operator delete(
void *
p) { ::operator
delete(
p); }
719 assert(
i < NumValues &&
"List element index out of range!");
720 return getTrailingObjects<Init *>()[
i];
723 return cast<ListRecTy>(
getType())->getElementType();
744 return makeArrayRef(getTrailingObjects<Init *>(), NumValues);
750 size_t size ()
const {
return NumValues; }
751 bool empty()
const {
return NumValues == 0; }
796 UnOpInit(
const UnOpInit &) =
delete;
797 UnOpInit &
operator=(
const UnOpInit &) =
delete;
810 "Wrong number of operands for unary operation");
817 assert(
i == 0 &&
"Invalid operand id for unary operator");
836 enum BinaryOp : uint8_t {
ADD,
SUB,
MUL,
AND,
OR,
XOR,
SHL,
SRA,
SRL,
LISTCONCAT,
847 BinOpInit(
const BinOpInit &) =
delete;
848 BinOpInit &
operator=(
const BinOpInit &) =
delete;
864 "Wrong number of operands for binary operation");
896 Init *LHS, *MHS, *RHS;
903 TernOpInit(
const TernOpInit &) =
delete;
904 TernOpInit &
operator=(
const TernOpInit &) =
delete;
919 "Wrong number of operands for ternary operation");
962 NumConds(
NC), ValType(
Type) {}
964 size_t numTrailingObjects(OverloadToken<Init *>)
const {
986 assert(Num < NumConds &&
"Condition number out of range!");
987 return getTrailingObjects<Init *>()[Num];
991 assert(Num < NumConds &&
"Val number out of range!");
992 return getTrailingObjects<Init *>()[Num+NumConds];
996 return makeArrayRef(getTrailingObjects<Init *>(), NumConds);
1000 return makeArrayRef(getTrailingObjects<Init *>()+NumConds, NumConds);
1074 CheckType(CheckType), Expr(Expr) {}
1108 CheckType(CheckType), Expr(Expr) {}
1179 (isa<IntRecTy>(
T->getType()) ||
1180 (isa<BitsRecTy>(
T->getType()) &&
1181 cast<BitsRecTy>(
T->getType())->getNumBits() >
B)) &&
1182 "Illegal VarBitInit expression!");
1202 assert(
B < 1 &&
"Bit index out of range!");
1215 cast<ListRecTy>(
T->getType())->getElementType()),
1217 assert(
T->getType() && isa<ListRecTy>(
T->getType()) &&
1218 "Illegal VarBitInit expression!");
1291 void operator delete(
void *
p) { ::operator
delete(
p); }
1306 assert(
i < NumArgs &&
"Argument index out of range!");
1307 return getTrailingObjects<Init *>()[
i];
1335 <<
", got FieldName = " << *FieldName
1336 <<
" with non-record type!\n";
1376 unsigned NumArgNames;
1380 ValName(VN), NumArgs(NumArgs), NumArgNames(NumArgNames) {}
1382 size_t numTrailingObjects(OverloadToken<Init *>)
const {
return NumArgs; }
1411 assert(Num < NumArgs &&
"Arg number out of range!");
1412 return getTrailingObjects<Init *>()[Num];
1416 assert(Num < NumArgNames &&
"Arg number out of range!");
1417 return getTrailingObjects<StringInit *>()[Num];
1426 return makeArrayRef(getTrailingObjects<Init *>(), NumArgs);
1430 return makeArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
1479 bool IsUsed =
false;
1539 RV.
print(OS <<
" ");
1573 DefInit *CorrespondingDefInit =
nullptr;
1586 bool Anonymous =
false,
bool Class =
false)
1587 : Name(
N), Locs(locs.
begin(), locs.
end()), TrackedRecords(records),
1588 ID(
getNewUID(
N->getRecordKeeper())), IsAnonymous(Anonymous),
1602 Values(
O.Values), Assertions(
O.Assertions),
1603 SuperClasses(
O.SuperClasses), TrackedRecords(
O.TrackedRecords),
1605 IsClass(
O.IsClass) {}
1643 return SuperClasses;
1658 if (Val.Name == Name)
return &Val;
1681 Values.push_back(RV);
1685 for (
unsigned i = 0,
e = Values.size();
i !=
e; ++
i)
1687 Values.
erase(Values.begin()+
i);
1698 Assertions.push_back(
AssertionInfo(Loc, Condition, Message));
1702 Assertions.
append(Rec->Assertions);
1709 for (
const auto &SCPair : SuperClasses)
1710 if (SCPair.first == R)
1716 for (
const auto &SCPair : SuperClasses) {
1717 if (
const auto *
SI = dyn_cast<StringInit>(SCPair.first->getNameInit())) {
1718 if (
SI->getValue() == Name)
1720 }
else if (SCPair.first->getNameInitAsString() == Name) {
1728 assert(!CorrespondingDefInit &&
1729 "changing type of record after it has been referenced");
1731 SuperClasses.push_back(std::make_pair(R, Range));
1749 return TrackedRecords;
1840 raw_ostream &
operator<<(raw_ostream &OS,
const Record &R);
1843 using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
1844 using GlobalMap = std::map<std::string, Init *, std::less<>>;
1867 auto I = Classes.find(
Name);
1868 return I == Classes.end() ? nullptr :
I->second.get();
1873 auto I = Defs.find(
Name);
1874 return I == Defs.end() ? nullptr :
I->second.get();
1880 return R->getDefInit();
1881 auto It = ExtraGlobals.find(
Name);
1882 return It == ExtraGlobals.end() ? nullptr : It->second;
1886 InputFilename = Filename;
1890 bool Ins = Classes.insert(std::make_pair(std::string(R->getName()),
1897 bool Ins = Defs.insert(std::make_pair(std::string(R->getName()),
1904 bool Ins = ExtraGlobals.insert(std::make_pair(std::string(
Name),
I)).second;
1914 TimingGroup =
new TimerGroup(
"TableGen",
"TableGen Phase Timing");
1950 std::vector<Record *>
1961 std::string InputFilename;
1962 RecordMap Classes, Defs;
1964 GlobalMap ExtraGlobals;
1970 Timer *LastTimer =
nullptr;
1971 bool BackendTimer =
false;
1974 std::unique_ptr<detail::RecordKeeperImpl> Impl;
1990 return LHS->getID() <
RHS->getID();
2011 const char *Start = Rec.
data();
2012 const char *Curr = Start;
2013 bool IsDigitPart =
isDigit(Curr[0]);
2014 for (
size_t I = 0,
E = Rec.
size();
I !=
E; ++
I, ++Len) {
2016 if (IsDigit != IsDigitPart) {
2017 Parts.push_back(std::make_pair(IsDigitPart,
StringRef(Start, Len)));
2024 Parts.push_back(std::make_pair(IsDigitPart,
StringRef(Start, Len)));
2039 size_t LHSNumParts = LHSParts.
size();
2040 size_t RHSNumParts = RHSParts.
size();
2041 assert (LHSNumParts && RHSNumParts &&
"Expected at least one part!");
2043 if (LHSNumParts != RHSNumParts)
2044 return LHSNumParts < RHSNumParts;
2047 for (
size_t I = 0,
E = LHSNumParts;
I <
E;
I+=2) {
2048 std::pair<bool, StringRef> LHSPart = LHSParts.
getPart(
I);
2049 std::pair<bool, StringRef> RHSPart = RHSParts.
getPart(
I);
2051 assert (LHSPart.first ==
false && RHSPart.first ==
false &&
2052 "Expected both parts to be alpha.");
2053 if (
int Res = LHSPart.second.compare(RHSPart.second))
2056 for (
size_t I = 1,
E = LHSNumParts;
I <
E;
I+=2) {
2057 std::pair<bool, StringRef> LHSPart = LHSParts.
getPart(
I);
2058 std::pair<bool, StringRef> RHSPart = RHSParts.
getPart(
I);
2060 assert (LHSPart.first ==
true && RHSPart.first ==
true &&
2061 "Expected both parts to be numeric.");
2062 if (LHSPart.second.size() != RHSPart.second.size())
2063 return LHSPart.second.size() < RHSPart.second.size();
2065 unsigned LHSVal, RHSVal;
2067 bool LHSFailed = LHSPart.second.getAsInteger(10, LHSVal); (void)LHSFailed;
2068 assert(!LHSFailed &&
"Unable to convert LHS to integer.");
2069 bool RHSFailed = RHSPart.second.getAsInteger(10, RHSVal); (void)RHSFailed;
2070 assert(!RHSFailed &&
"Unable to convert RHS to integer.");
2072 if (LHSVal != RHSVal)
2073 return LHSVal < RHSVal;
2075 return LHSNumParts < RHSNumParts;
2079 raw_ostream &
operator<<(raw_ostream &OS,
const RecordKeeper &RK);
2089 bool IsFinal =
false;
2116 struct MappedValue {
2120 MappedValue() : V(
nullptr), Resolved(
false) {}
2121 MappedValue(
Init *V,
bool Resolved) : V(V), Resolved(Resolved) {}
2133 assert(It != Map.end() &&
"key must be present in map");
2134 return It->second.V->isComplete();
2144 Init *Name =
nullptr;
2180 bool FoundUnresolved =
false;
2194 Init *VarNameToTrack;
2199 :
Resolver(nullptr), VarNameToTrack(VarNameToTrack) {}
2207 void EmitJSON(RecordKeeper &RK, raw_ostream &OS);
2211 #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.
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.
static bool classof(const RecTy *RT)
std::string getAsString() const override
const_iterator begin() const
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.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
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 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)
bool isConcrete() const override
Is this a concrete and fully resolved value without any references or stuck operations?...
StringInit * getName() const
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.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
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",...
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)
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)
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
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)
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?...
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
const std::string getNameInitAsString() const
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.
StandardInstrumentations SI(Debug, VerifyEach)
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)
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.
LLVM_NODISCARD 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
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
std::string getAsString() const override
Convert this value to a literal form.
VarBitInit & operator=(const VarBitInit &)=delete
RecTy * getValType() const
constexpr LLVM_NODISCARD size_t size() const
size - Get the string size.
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.
Should compile to something r4 addze r3 instead we get
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)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
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 LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
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)
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
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 ...
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.