From e8405ad5d090e24a85a719fcabaa26c4955e1f79 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Thu, 14 Jul 2016 14:53:11 +0000 Subject: [PATCH] [TableGen] Cleanup Record comments. NFC. LLVM doesn't use exceptions anymore. Also remove the implementation comments. Some of them diverged. llvm-svn: 275424 --- llvm/include/llvm/TableGen/Record.h | 6 ++-- llvm/lib/TableGen/Record.cpp | 66 +------------------------------------ 2 files changed, 4 insertions(+), 68 deletions(-) diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 019e2177..b0183b9 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -1543,9 +1543,9 @@ public: // High-level helper methods, useful for tablegen backends... /// getAllDerivedDefinitions - This method returns all concrete definitions - /// that derive from the specified class name. If a class with the specified - /// name does not exist, an exception is thrown. - std::vector + /// that derive from the specified class name. A class with the specified + /// name must exist. + std::vector getAllDerivedDefinitions(const std::string &ClassName) const; void dump() const; diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index 9ee7781..61a1668 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -175,9 +175,6 @@ bool RecordRecTy::typeIsConvertibleTo(const RecTy *RHS) const { return false; } -/// resolveTypes - Find a common type that T1 and T2 convert to. -/// Return null if no such type exists. -/// RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) { if (T1->typeIsConvertibleTo(T2)) return T2; @@ -407,8 +404,6 @@ std::string IntInit::getAsString() const { return itostr(Value); } -/// canFitInBitfield - Return true if the number of bits is large enough to hold -/// the integer value. static bool canFitInBitfield(int64_t Value, unsigned NumBits) { // For example, with NumBits == 4, we permit Values from [-7 .. 15]. return (NumBits >= sizeof(Value) * 8) || @@ -1348,11 +1343,6 @@ Init *VarInit::getFieldInit(Record &R, const RecordVal *RV, return nullptr; } -/// resolveReferences - This method is used by classes that refer to other -/// variables which may not be defined at the time the expression is formed. -/// If a value is set for the variable later, this method will be called on -/// users of the value to allow the value to propagate out. -/// Init *VarInit::resolveReferences(Record &R, const RecordVal *RV) const { if (RecordVal *Val = R.getValue(VarName)) if (RV == Val || (!RV && !isa(Val->getValue()))) @@ -1679,9 +1669,6 @@ void Record::setName(const std::string &Name) { setName(StringInit::get(Name)); } -/// resolveReferencesTo - If anything in this record refers to RV, replace the -/// reference to RV with the RHS of RV. If RV is null, we resolve all possible -/// references. void Record::resolveReferencesTo(const RecordVal *RV) { for (unsigned i = 0, e = Values.size(); i != e; ++i) { if (RV == &Values[i]) // Skip resolve the same field as the given one @@ -1742,9 +1729,6 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const Record &R) { return OS << "}\n"; } -/// getValueInit - Return the initializer for a value with the specified name, -/// or abort if the field does not exist. -/// Init *Record::getValueInit(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1754,10 +1738,6 @@ Init *Record::getValueInit(StringRef FieldName) const { } -/// getValueAsString - This method looks up the specified field and returns its -/// value as a string, aborts if the field does not exist or if -/// the value is not a string. -/// std::string Record::getValueAsString(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1773,10 +1753,6 @@ std::string Record::getValueAsString(StringRef FieldName) const { FieldName + "' does not have a string initializer!"); } -/// getValueAsBitsInit - This method looks up the specified field and returns -/// its value as a BitsInit, aborts if the field does not exist or if -/// the value is not the right type. -/// BitsInit *Record::getValueAsBitsInit(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1789,10 +1765,6 @@ BitsInit *Record::getValueAsBitsInit(StringRef FieldName) const { FieldName + "' does not have a BitsInit initializer!"); } -/// getValueAsListInit - This method looks up the specified field and returns -/// its value as a ListInit, aborting if the field does not exist or if -/// the value is not the right type. -/// ListInit *Record::getValueAsListInit(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1805,10 +1777,6 @@ ListInit *Record::getValueAsListInit(StringRef FieldName) const { FieldName + "' does not have a list initializer!"); } -/// getValueAsListOfDefs - This method looks up the specified field and returns -/// its value as a vector of records, aborting if the field does not exist -/// or if the value is not the right type. -/// std::vector Record::getValueAsListOfDefs(StringRef FieldName) const { ListInit *List = getValueAsListInit(FieldName); @@ -1823,10 +1791,6 @@ Record::getValueAsListOfDefs(StringRef FieldName) const { return Defs; } -/// getValueAsInt - This method looks up the specified field and returns its -/// value as an int64_t, aborting if the field does not exist or if the value -/// is not the right type. -/// int64_t Record::getValueAsInt(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1839,10 +1803,6 @@ int64_t Record::getValueAsInt(StringRef FieldName) const { FieldName + "' does not have an int initializer!"); } -/// getValueAsListOfInts - This method looks up the specified field and returns -/// its value as a vector of integers, aborting if the field does not exist or -/// if the value is not the right type. -/// std::vector Record::getValueAsListOfInts(StringRef FieldName) const { ListInit *List = getValueAsListInit(FieldName); @@ -1857,10 +1817,6 @@ Record::getValueAsListOfInts(StringRef FieldName) const { return Ints; } -/// getValueAsListOfStrings - This method looks up the specified field and -/// returns its value as a vector of strings, aborting if the field does not -/// exist or if the value is not the right type. -/// std::vector Record::getValueAsListOfStrings(StringRef FieldName) const { ListInit *List = getValueAsListInit(FieldName); @@ -1875,10 +1831,6 @@ Record::getValueAsListOfStrings(StringRef FieldName) const { return Strings; } -/// getValueAsDef - This method looks up the specified field and returns its -/// value as a Record, aborting if the field does not exist or if the value -/// is not the right type. -/// Record *Record::getValueAsDef(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1891,10 +1843,6 @@ Record *Record::getValueAsDef(StringRef FieldName) const { FieldName + "' does not have a def initializer!"); } -/// getValueAsBit - This method looks up the specified field and returns its -/// value as a bit, aborting if the field does not exist or if the value is -/// not the right type. -/// bool Record::getValueAsBit(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1924,10 +1872,6 @@ bool Record::getValueAsBitOrUnset(StringRef FieldName, bool &Unset) const { FieldName + "' does not have a bit initializer!"); } -/// getValueAsDag - This method looks up the specified field and returns its -/// value as an Dag, aborting if the field does not exist or if the value is -/// not the right type. -/// DagInit *Record::getValueAsDag(StringRef FieldName) const { const RecordVal *R = getValue(FieldName); if (!R || !R->getValue()) @@ -1964,11 +1908,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const RecordKeeper &RK) { return OS; } - -/// getAllDerivedDefinitions - This method returns all concrete definitions -/// that derive from the specified class name. If a class with the specified -/// name does not exist, an error is printed and true is returned. -std::vector +std::vector RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const { Record *Class = getClass(ClassName); if (!Class) @@ -1982,8 +1922,6 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const { return Defs; } -/// QualifyName - Return an Init with a qualifier prefix referring -/// to CurRec's name. Init *llvm::QualifyName(Record &CurRec, MultiClass *CurMultiClass, Init *Name, const std::string &Scoper) { RecTy *Type = cast(Name)->getType(); @@ -2011,8 +1949,6 @@ Init *llvm::QualifyName(Record &CurRec, MultiClass *CurMultiClass, return NewName->Fold(&CurRec, CurMultiClass); } -/// QualifyName - Return an Init with a qualifier prefix referring -/// to CurRec's name. Init *llvm::QualifyName(Record &CurRec, MultiClass *CurMultiClass, const std::string &Name, const std::string &Scoper) { -- 2.7.4