- ClassInfo *&Entry = OperandClasses[ClassName];
-
- if (!Entry) {
- Entry = new ClassInfo();
- if (ClassName == "Reg") {
- Entry->Kind = ClassInfo::Register;
- Entry->SuperClassKind = SuperClass;
+ return CI;
+}
+
+void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) {
+ // Build the assembly match class information.
+
+ // Construct the "Reg" class.
+ //
+ // FIXME: This needs to dice up the RegisterClass instances.
+ ClassInfo *RegClass = TheRegisterClass = new ClassInfo();
+ RegClass->Kind = ClassInfo::Register;
+ RegClass->SuperClassKind = ClassInfo::Invalid;
+ RegClass->ClassName = "Reg";
+ RegClass->Name = "MCK_Reg";
+ RegClass->ValueName = "<register class>";
+ RegClass->PredicateMethod = "isReg";
+ RegClass->RenderMethod = "addRegOperands";
+ Classes.push_back(RegClass);
+
+ // Build info for the user defined assembly operand classes.
+ std::vector<Record*> AsmOperands;
+ AsmOperands = Records.getAllDerivedDefinitions("AsmOperandClass");
+ unsigned Index = 0;
+ for (std::vector<Record*>::iterator it = AsmOperands.begin(),
+ ie = AsmOperands.end(); it != ie; ++it, ++Index) {
+ ClassInfo *CI = new ClassInfo();
+ CI->Kind = ClassInfo::UserClass0 + Index;
+
+ Init *Super = (*it)->getValueInit("SuperClass");
+ if (DefInit *DI = dynamic_cast<DefInit*>(Super)) {
+ CI->SuperClass = AsmOperandClasses[DI->getDef()];
+ if (!CI->SuperClass)
+ PrintError((*it)->getLoc(), "Invalid super class reference!");