[llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp DAGISelEmitter.cpp Record.cpp Record.h SubtargetEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Oct 28 15:49:14 PDT 2005
Changes in directory llvm/utils/TableGen:
CodeGenTarget.cpp updated: 1.40 -> 1.41
DAGISelEmitter.cpp updated: 1.69 -> 1.70
Record.cpp updated: 1.46 -> 1.47
Record.h updated: 1.53 -> 1.54
SubtargetEmitter.cpp updated: 1.10 -> 1.11
---
Log message:
Rename Record::getValueAsListDef to getValueAsListOfDefs, to more accurately
reflect what it is.
Convert some more code over to use it.
---
Diffs of the changes: (+24 -34)
CodeGenTarget.cpp | 28 ++++++++--------------------
DAGISelEmitter.cpp | 7 ++++---
Record.cpp | 6 +++---
Record.h | 8 ++++----
SubtargetEmitter.cpp | 9 +++++----
5 files changed, 24 insertions(+), 34 deletions(-)
Index: llvm/utils/TableGen/CodeGenTarget.cpp
diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.40 llvm/utils/TableGen/CodeGenTarget.cpp:1.41
--- llvm/utils/TableGen/CodeGenTarget.cpp:1.40 Thu Oct 13 22:54:49 2005
+++ llvm/utils/TableGen/CodeGenTarget.cpp Fri Oct 28 17:49:02 2005
@@ -84,15 +84,8 @@
throw std::string("ERROR: Multiple subclasses of Target defined!");
TargetRec = Targets[0];
- // Read in all of the CalleeSavedRegisters...
- ListInit *LI = TargetRec->getValueAsListInit("CalleeSavedRegisters");
- for (unsigned i = 0, e = LI->getSize(); i != e; ++i)
- if (DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i)))
- CalleeSavedRegisters.push_back(DI->getDef());
- else
- throw "Target: " + TargetRec->getName() +
- " expected register definition in CalleeSavedRegisters list!";
-
+ // Read in all of the CalleeSavedRegisters.
+ CalleeSavedRegisters =TargetRec->getValueAsListOfDefs("CalleeSavedRegisters");
PointerType = getValueType(TargetRec->getValueAsDef("PointerType"));
}
@@ -108,12 +101,10 @@
/// getAsmWriter - Return the AssemblyWriter definition for this target.
///
Record *CodeGenTarget::getAsmWriter() const {
- ListInit *LI = TargetRec->getValueAsListInit("AssemblyWriters");
- if (AsmWriterNum >= LI->getSize())
+ std::vector<Record*> LI = TargetRec->getValueAsListOfDefs("AssemblyWriters");
+ if (AsmWriterNum >= LI.size())
throw "Target does not have an AsmWriter #" + utostr(AsmWriterNum) + "!";
- DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(AsmWriterNum));
- if (!DI) throw std::string("AssemblyWriter list should be a list of defs!");
- return DI->getDef();
+ return LI[AsmWriterNum];
}
void CodeGenTarget::ReadRegisters() const {
@@ -159,12 +150,9 @@
MethodBodies = R->getValueAsCode("MethodBodies");
MethodProtos = R->getValueAsCode("MethodProtos");
- ListInit *RegList = R->getValueAsListInit("MemberList");
- for (unsigned i = 0, e = RegList->getSize(); i != e; ++i) {
- DefInit *RegDef = dynamic_cast<DefInit*>(RegList->getElement(i));
- if (!RegDef) throw "Register class member is not a record!";
- Record *Reg = RegDef->getDef();
-
+ std::vector<Record*> RegList = R->getValueAsListOfDefs("MemberList");
+ for (unsigned i = 0, e = RegList.size(); i != e; ++i) {
+ Record *Reg = RegList[i];
if (!Reg->isSubClassOf("Register"))
throw "Register Class member '" + Reg->getName() +
"' does not derive from the Register class!";
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.69 llvm/utils/TableGen/DAGISelEmitter.cpp:1.70
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.69 Fri Oct 28 17:43:25 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Oct 28 17:49:02 2005
@@ -228,7 +228,7 @@
// Parse the properties.
Properties = 0;
- std::vector<Record*> PropList = R->getValueAsListDef("Properties");
+ std::vector<Record*> PropList = R->getValueAsListOfDefs("Properties");
for (unsigned i = 0, e = PropList.size(); i != e; ++i) {
if (PropList[i]->getName() == "SDNPCommutative") {
Properties |= 1 << SDNPCommutative;
@@ -243,8 +243,9 @@
// Parse the type constraints.
- std::vector<Record*> ConstList =TypeProfile->getValueAsListDef("Constraints");
- TypeConstraints.assign(ConstList.begin(), ConstList.end());
+ std::vector<Record*> ConstraintList =
+ TypeProfile->getValueAsListOfDefs("Constraints");
+ TypeConstraints.assign(ConstraintList.begin(), ConstraintList.end());
}
//===----------------------------------------------------------------------===//
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.46 llvm/utils/TableGen/Record.cpp:1.47
--- llvm/utils/TableGen/Record.cpp:1.46 Fri Oct 28 16:46:31 2005
+++ llvm/utils/TableGen/Record.cpp Fri Oct 28 17:49:02 2005
@@ -709,12 +709,12 @@
"' does not have a list initializer!";
}
-/// getValueAsListDef - This method looks up the specified field and returns
+/// getValueAsListOfDefs - This method looks up the specified field and returns
/// its value as a vector of records, throwing an exception if the field does
/// not exist or if the value is not the right type.
///
-std::vector<Record*> Record::getValueAsListDef(const std::string &FieldName)
- const {
+std::vector<Record*>
+Record::getValueAsListOfDefs(const std::string &FieldName) const {
ListInit *List = getValueAsListInit(FieldName);
std::vector<Record*> Defs;
for (unsigned i = 0; i < List->getSize(); i++) {
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.53 llvm/utils/TableGen/Record.h:1.54
--- llvm/utils/TableGen/Record.h:1.53 Fri Oct 28 16:46:31 2005
+++ llvm/utils/TableGen/Record.h Fri Oct 28 17:49:02 2005
@@ -1000,11 +1000,11 @@
///
ListInit *getValueAsListInit(const std::string &FieldName) const;
- /// getValueAsListDef - This method looks up the specified field and returns
- /// its value as a vector of records, throwing an exception if the field does
- /// not exist or if the value is not the right type.
+ /// getValueAsListOfDefs - This method looks up the specified field and
+ /// returnsits value as a vector of records, throwing an exception if the
+ /// field does not exist or if the value is not the right type.
///
- std::vector<Record*> getValueAsListDef(const std::string &FieldName) const;
+ std::vector<Record*> getValueAsListOfDefs(const std::string &FieldName) const;
/// getValueAsDef - This method looks up the specified field and returns its
/// value as a Record, throwing an exception if the field does not exist or if
Index: llvm/utils/TableGen/SubtargetEmitter.cpp
diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.10 llvm/utils/TableGen/SubtargetEmitter.cpp:1.11
--- llvm/utils/TableGen/SubtargetEmitter.cpp:1.10 Fri Oct 28 16:47:29 2005
+++ llvm/utils/TableGen/SubtargetEmitter.cpp Fri Oct 28 17:49:02 2005
@@ -137,7 +137,8 @@
Record *Processor = ProcessorList[i];
std::string Name = Processor->getValueAsString("Name");
- std::vector<Record*> FeatureList = Processor->getValueAsListDef("Features");
+ std::vector<Record*> FeatureList =
+ Processor->getValueAsListOfDefs("Features");
// Emit as { "cpu", "description", f1 | f2 | ... fn },
OS << " { "
@@ -206,7 +207,7 @@
std::string &ItinString,
unsigned &NStages) {
// Get states list
- std::vector<Record*> StageList = ItinData->getValueAsListDef("Stages");
+ std::vector<Record*> StageList = ItinData->getValueAsListOfDefs("Stages");
// For each stage
unsigned N = NStages = StageList.size();
@@ -219,7 +220,7 @@
ItinString += " ,{ " + itostr(Cycles) + ", ";
// Get unit list
- std::vector<Record*> UnitList = Stage->getValueAsListDef("Units");
+ std::vector<Record*> UnitList = Stage->getValueAsListOfDefs("Units");
// For each unit
for (unsigned j = 0, M = UnitList.size(); j < M;) {
@@ -272,7 +273,7 @@
ItinList.resize(NItinClasses);
// Get itinerary data list
- std::vector<Record*> ItinDataList = Proc->getValueAsListDef("IID");
+ std::vector<Record*> ItinDataList = Proc->getValueAsListOfDefs("IID");
// For each itinerary data
for (unsigned j = 0, M = ItinDataList.size(); j < M; j++) {
More information about the llvm-commits
mailing list