mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	various cleanups to tblgen, patch by Garrison Venn!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121837 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -493,7 +493,7 @@ struct SubtargetFeatureInfo { | |||||||
| class AsmMatcherInfo { | class AsmMatcherInfo { | ||||||
| public: | public: | ||||||
|   /// Tracked Records |   /// Tracked Records | ||||||
|   RecordKeeper& Records; |   RecordKeeper &Records; | ||||||
|  |  | ||||||
|   /// The tablegen AsmParser record. |   /// The tablegen AsmParser record. | ||||||
|   Record *AsmParser; |   Record *AsmParser; | ||||||
| @@ -551,7 +551,7 @@ private: | |||||||
| public: | public: | ||||||
|   AsmMatcherInfo(Record *AsmParser,  |   AsmMatcherInfo(Record *AsmParser,  | ||||||
|                  CodeGenTarget &Target,  |                  CodeGenTarget &Target,  | ||||||
|                  RecordKeeper& Records); |                  RecordKeeper &Records); | ||||||
|  |  | ||||||
|   /// BuildInfo - Construct the various tables used during matching. |   /// BuildInfo - Construct the various tables used during matching. | ||||||
|   void BuildInfo(); |   void BuildInfo(); | ||||||
| @@ -565,12 +565,8 @@ public: | |||||||
|     return I == SubtargetFeatures.end() ? 0 : I->second; |     return I == SubtargetFeatures.end() ? 0 : I->second; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   RecordKeeper& getRecords() { |   RecordKeeper &getRecords() const { | ||||||
|     return(Records); |     return Records; | ||||||
|   } |  | ||||||
|  |  | ||||||
|   RecordKeeper& getRecords() const { |  | ||||||
|     return(Records); |  | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -1004,7 +1000,7 @@ void AsmMatcherInfo::BuildOperandClasses() { | |||||||
|  |  | ||||||
| AsmMatcherInfo::AsmMatcherInfo(Record *asmParser,  | AsmMatcherInfo::AsmMatcherInfo(Record *asmParser,  | ||||||
|                                CodeGenTarget &target,  |                                CodeGenTarget &target,  | ||||||
|                                RecordKeeper& records) |                                RecordKeeper &records) | ||||||
|   : Records(records), AsmParser(asmParser), Target(target), |   : Records(records), AsmParser(asmParser), Target(target), | ||||||
|     RegisterPrefix(AsmParser->getValueAsString("RegisterPrefix")) { |     RegisterPrefix(AsmParser->getValueAsString("RegisterPrefix")) { | ||||||
| } | } | ||||||
|   | |||||||
| @@ -108,7 +108,7 @@ std::string llvm::getQualifiedName(const Record *R) { | |||||||
|  |  | ||||||
| /// getTarget - Return the current instance of the Target class. | /// getTarget - Return the current instance of the Target class. | ||||||
| /// | /// | ||||||
| CodeGenTarget::CodeGenTarget(RecordKeeper& records) : Records(records) { | CodeGenTarget::CodeGenTarget(RecordKeeper &records) : Records(records) { | ||||||
|   std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target"); |   std::vector<Record*> Targets = Records.getAllDerivedDefinitions("Target"); | ||||||
|   if (Targets.size() == 0) |   if (Targets.size() == 0) | ||||||
|     throw std::string("ERROR: No 'Target' subclasses defined!"); |     throw std::string("ERROR: No 'Target' subclasses defined!"); | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ namespace llvm { | |||||||
|   class LLVMCConfigurationEmitter : public TableGenBackend { |   class LLVMCConfigurationEmitter : public TableGenBackend { | ||||||
|     RecordKeeper &Records; |     RecordKeeper &Records; | ||||||
|   public: |   public: | ||||||
|     explicit LLVMCConfigurationEmitter(RecordKeeper& records) :  |     explicit LLVMCConfigurationEmitter(RecordKeeper &records) :  | ||||||
|       Records(records) {} |       Records(records) {} | ||||||
|  |  | ||||||
|     // run - Output the asmwriter, returning true on failure. |     // run - Output the asmwriter, returning true on failure. | ||||||
|   | |||||||
| @@ -1236,8 +1236,8 @@ class Record { | |||||||
|  |  | ||||||
| public: | public: | ||||||
|  |  | ||||||
|   // Constructs a record. See also RecordKeeper::createRecord. |   // Constructs a record. | ||||||
|   explicit Record(const std::string &N, SMLoc loc, RecordKeeper& records) : |   explicit Record(const std::string &N, SMLoc loc, RecordKeeper &records) : | ||||||
|     ID(LastID++), Name(N), Loc(loc), TrackedRecords(records) {} |     ID(LastID++), Name(N), Loc(loc), TrackedRecords(records) {} | ||||||
|   ~Record() {} |   ~Record() {} | ||||||
|  |  | ||||||
| @@ -1324,7 +1324,7 @@ public: | |||||||
|   void resolveReferencesTo(const RecordVal *RV); |   void resolveReferencesTo(const RecordVal *RV); | ||||||
|  |  | ||||||
|   RecordKeeper &getRecords() const { |   RecordKeeper &getRecords() const { | ||||||
|     return(TrackedRecords); |     return TrackedRecords; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   void dump() const; |   void dump() const; | ||||||
| @@ -1466,12 +1466,6 @@ public: | |||||||
|   std::vector<Record*> |   std::vector<Record*> | ||||||
|   getAllDerivedDefinitions(const std::string &ClassName) const; |   getAllDerivedDefinitions(const std::string &ClassName) const; | ||||||
|  |  | ||||||
|   // allocates and returns a record.  |  | ||||||
|   Record *createRecord(const std::string &N, SMLoc loc) { |  | ||||||
|     return(new Record(N, loc, *this)); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   void dump() const; |   void dump() const; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1096,8 +1096,9 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) { | |||||||
|  |  | ||||||
|     // Create the new record, set it as CurRec temporarily. |     // Create the new record, set it as CurRec temporarily. | ||||||
|     static unsigned AnonCounter = 0; |     static unsigned AnonCounter = 0; | ||||||
|     Record *NewRec = Records.createRecord( |     Record *NewRec = new Record("anonymous.val."+utostr(AnonCounter++), | ||||||
|                         "anonymous.val."+utostr(AnonCounter++),NameLoc); |                                 NameLoc, | ||||||
|  |                                 Records); | ||||||
|     SubClassReference SCRef; |     SubClassReference SCRef; | ||||||
|     SCRef.RefLoc = NameLoc; |     SCRef.RefLoc = NameLoc; | ||||||
|     SCRef.Rec = Class; |     SCRef.Rec = Class; | ||||||
| @@ -1661,7 +1662,7 @@ bool TGParser::ParseDef(MultiClass *CurMultiClass) { | |||||||
|   Lex.Lex();  // Eat the 'def' token. |   Lex.Lex();  // Eat the 'def' token. | ||||||
|  |  | ||||||
|   // Parse ObjectName and make a record for it. |   // Parse ObjectName and make a record for it. | ||||||
|   Record *CurRec = Records.createRecord(ParseObjectName(), DefLoc); |   Record *CurRec = new Record(ParseObjectName(), DefLoc, Records); | ||||||
|  |  | ||||||
|   if (!CurMultiClass) { |   if (!CurMultiClass) { | ||||||
|     // Top-level def definition. |     // Top-level def definition. | ||||||
| @@ -1728,7 +1729,7 @@ bool TGParser::ParseClass() { | |||||||
|       return TokError("Class '" + CurRec->getName() + "' already defined"); |       return TokError("Class '" + CurRec->getName() + "' already defined"); | ||||||
|   } else { |   } else { | ||||||
|     // If this is the first reference to this class, create and add it. |     // If this is the first reference to this class, create and add it. | ||||||
|     CurRec = Records.createRecord(Lex.getCurStrVal(), Lex.getLoc()); |     CurRec = new Record(Lex.getCurStrVal(), Lex.getLoc(), Records); | ||||||
|     Records.addClass(CurRec); |     Records.addClass(CurRec); | ||||||
|   } |   } | ||||||
|   Lex.Lex(); // eat the name. |   Lex.Lex(); // eat the name. | ||||||
| @@ -1975,7 +1976,7 @@ bool TGParser::ParseDefm(MultiClass *CurMultiClass) { | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       Record *CurRec = Records.createRecord(DefName, DefmPrefixLoc); |       Record *CurRec = new Record(DefName, DefmPrefixLoc, Records); | ||||||
|  |  | ||||||
|       SubClassReference Ref; |       SubClassReference Ref; | ||||||
|       Ref.RefLoc = DefmPrefixLoc; |       Ref.RefLoc = DefmPrefixLoc; | ||||||
|   | |||||||
| @@ -50,9 +50,9 @@ class TGParser { | |||||||
|   MultiClass *CurMultiClass; |   MultiClass *CurMultiClass; | ||||||
|  |  | ||||||
|   // Record tracker |   // Record tracker | ||||||
|   RecordKeeper& Records; |   RecordKeeper &Records; | ||||||
| public: | public: | ||||||
|   TGParser(SourceMgr &SrcMgr, RecordKeeper& records) :  |   TGParser(SourceMgr &SrcMgr, RecordKeeper &records) :  | ||||||
|     Lex(SrcMgr), CurMultiClass(0), Records(records) {} |     Lex(SrcMgr), CurMultiClass(0), Records(records) {} | ||||||
|    |    | ||||||
|   /// ParseFile - Main entrypoint for parsing a tblgen file.  These parser |   /// ParseFile - Main entrypoint for parsing a tblgen file.  These parser | ||||||
|   | |||||||
| @@ -186,7 +186,7 @@ void llvm::PrintError(SMLoc ErrorLoc, const Twine &Msg) { | |||||||
| static bool ParseFile(const std::string &Filename, | static bool ParseFile(const std::string &Filename, | ||||||
|                       const std::vector<std::string> &IncludeDirs, |                       const std::vector<std::string> &IncludeDirs, | ||||||
|                       SourceMgr &SrcMgr, |                       SourceMgr &SrcMgr, | ||||||
|                       RecordKeeper& Records) { |                       RecordKeeper &Records) { | ||||||
|   error_code ec; |   error_code ec; | ||||||
|   MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), ec); |   MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), ec); | ||||||
|   if (F == 0) { |   if (F == 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user