mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Rename Record::getValueAsListDef to getValueAsListOfDefs, to more accurately
reflect what it is. Convert some more code over to use it. llvm-svn: 24072
This commit is contained in:
parent
dea00d4a37
commit
06c5e018ef
@ -84,15 +84,8 @@ CodeGenTarget::CodeGenTarget() : PointerType(MVT::Other) {
|
||||
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 @@ Record *CodeGenTarget::getInstructionSet() const {
|
||||
/// 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 @@ CodeGenRegisterClass::CodeGenRegisterClass(Record *R) : TheDef(R) {
|
||||
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!";
|
||||
|
@ -228,7 +228,7 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
|
||||
|
||||
// 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 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
|
||||
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -709,12 +709,12 @@ ListInit *Record::getValueAsListInit(const std::string &FieldName) const {
|
||||
"' 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++) {
|
||||
|
@ -1000,11 +1000,11 @@ public:
|
||||
///
|
||||
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
|
||||
|
@ -137,7 +137,8 @@ void SubtargetEmitter::CPUKeyValues(std::ostream &OS) {
|
||||
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 @@ void SubtargetEmitter::FormItineraryString(Record *ItinData,
|
||||
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 @@ void SubtargetEmitter::FormItineraryString(Record *ItinData,
|
||||
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 @@ void SubtargetEmitter::EmitStageData(std::ostream &OS,
|
||||
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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user