mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Revertin 50867 since it was breaking the build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -15,7 +15,7 @@ class Tool<list<dag> l> { | |||||||
|       list<dag> properties = l; |       list<dag> properties = l; | ||||||
| } | } | ||||||
|  |  | ||||||
| // Special Tool instance - the root node of the compilation graph. | // Special Tool instance - graph root. | ||||||
|  |  | ||||||
| def root : Tool<[]>; | def root : Tool<[]>; | ||||||
|  |  | ||||||
| @@ -47,7 +47,6 @@ def required; | |||||||
|  |  | ||||||
| // Possible edge properties | // Possible edge properties | ||||||
|  |  | ||||||
| // 'Atomic' properties. |  | ||||||
| def switch_on; | def switch_on; | ||||||
| def parameter_equals; | def parameter_equals; | ||||||
| def element_in_list; | def element_in_list; | ||||||
|   | |||||||
| @@ -163,8 +163,8 @@ struct GlobalOptionDescription : public OptionDescription { | |||||||
|   std::string Help; |   std::string Help; | ||||||
|   unsigned Flags; |   unsigned Flags; | ||||||
|  |  | ||||||
|   // We need to provide a default constructor because |   // We need t provide a default constructor since | ||||||
|   // StringMap can only store DefaultConstructible objects. |   // StringMap can only store DefaultConstructible objects | ||||||
|   GlobalOptionDescription() : OptionDescription(), Flags(0) |   GlobalOptionDescription() : OptionDescription(), Flags(0) | ||||||
|   {} |   {} | ||||||
|  |  | ||||||
| @@ -222,9 +222,9 @@ struct GlobalOptionDescriptions { | |||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| // Tool-local option description. | // Tool-local option description | ||||||
|  |  | ||||||
| // Properties without arguments are implemented as flags. | // Properties without arguments are implemented as flags | ||||||
| namespace ToolOptionDescriptionFlags { | namespace ToolOptionDescriptionFlags { | ||||||
|   enum ToolOptionDescriptionFlags { StopCompilation = 0x1, |   enum ToolOptionDescriptionFlags { StopCompilation = 0x1, | ||||||
|                                     Forward = 0x2, UnpackValues = 0x4}; |                                     Forward = 0x2, UnpackValues = 0x4}; | ||||||
| @@ -314,7 +314,7 @@ typedef std::vector<IntrusiveRefCntPtr<ToolProperties> > ToolPropertiesList; | |||||||
|  |  | ||||||
|  |  | ||||||
| /// CollectProperties - Function object for iterating over a list of | /// CollectProperties - Function object for iterating over a list of | ||||||
| /// tool property records. | /// tool property records | ||||||
| class CollectProperties { | class CollectProperties { | ||||||
| private: | private: | ||||||
|  |  | ||||||
| @@ -569,8 +569,7 @@ bool CollectProperties::staticMembersInitialized_ = false; | |||||||
|  |  | ||||||
|  |  | ||||||
| /// CollectToolProperties - Gather information from the parsed | /// CollectToolProperties - Gather information from the parsed | ||||||
| /// TableGen data (basically a wrapper for the CollectProperties | /// TableGen data (basically a wrapper for CollectProperties). | ||||||
| /// function object). |  | ||||||
| void CollectToolProperties (RecordVector::const_iterator B, | void CollectToolProperties (RecordVector::const_iterator B, | ||||||
|                             RecordVector::const_iterator E, |                             RecordVector::const_iterator E, | ||||||
|                             ToolPropertiesList& TPList, |                             ToolPropertiesList& TPList, | ||||||
| @@ -590,50 +589,12 @@ void CollectToolProperties (RecordVector::const_iterator B, | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /// EmitForwardOptionPropertyHandlingCode - Helper function used to | /// EmitOptionPropertyHandlingCode - Used by EmitGenerateActionMethod. | ||||||
| /// implement EmitOptionPropertyHandlingCode(). Emits code for |  | ||||||
| /// handling the (forward) option property. |  | ||||||
| void EmitForwardOptionPropertyHandlingCode (const ToolOptionDescription& D, |  | ||||||
|                                             std::ostream& O) { |  | ||||||
|   switch (D.Type) { |  | ||||||
|   case OptionType::Switch: |  | ||||||
|     O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n"; |  | ||||||
|     break; |  | ||||||
|   case OptionType::Parameter: |  | ||||||
|     O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n"; |  | ||||||
|     O << Indent3 << "vec.push_back(" << D.GenVariableName() << ");\n"; |  | ||||||
|     break; |  | ||||||
|   case OptionType::Prefix: |  | ||||||
|     O << Indent3 << "vec.push_back(\"-" << D.Name << "\" + " |  | ||||||
|       << D.GenVariableName() << ");\n"; |  | ||||||
|     break; |  | ||||||
|   case OptionType::PrefixList: |  | ||||||
|     O << Indent3 << "for (" << D.GenTypeDeclaration() |  | ||||||
|       << "::iterator B = " << D.GenVariableName() << ".begin(),\n" |  | ||||||
|       << Indent3 << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n" |  | ||||||
|       << Indent4 << "vec.push_back(\"-" << D.Name << "\" + " |  | ||||||
|       << "*B);\n"; |  | ||||||
|     break; |  | ||||||
|   case OptionType::ParameterList: |  | ||||||
|     O << Indent3 << "for (" << D.GenTypeDeclaration() |  | ||||||
|       << "::iterator B = " << D.GenVariableName() << ".begin(),\n" |  | ||||||
|       << Indent3 << "E = " << D.GenVariableName() |  | ||||||
|       << ".end() ; B != E; ++B) {\n" |  | ||||||
|       << Indent4 << "vec.push_back(\"-" << D.Name << "\");\n" |  | ||||||
|       << Indent4 << "vec.push_back(*B);\n" |  | ||||||
|       << Indent3 << "}\n"; |  | ||||||
|     break; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /// EmitOptionPropertyHandlingCode - Helper function used by |  | ||||||
| /// EmitGenerateActionMethod(). Emits code that handles option |  | ||||||
| /// properties. |  | ||||||
| void EmitOptionPropertyHandlingCode (const ToolProperties& P, | void EmitOptionPropertyHandlingCode (const ToolProperties& P, | ||||||
|                                      const ToolOptionDescription& D, |                                      const ToolOptionDescription& D, | ||||||
|                                      std::ostream& O) |                                      std::ostream& O) | ||||||
| { | { | ||||||
|   // Start of the if-clause. |   // if clause | ||||||
|   O << Indent2 << "if ("; |   O << Indent2 << "if ("; | ||||||
|   if (D.Type == OptionType::Switch) |   if (D.Type == OptionType::Switch) | ||||||
|     O << D.GenVariableName(); |     O << D.GenVariableName(); | ||||||
| @@ -642,7 +603,7 @@ void EmitOptionPropertyHandlingCode (const ToolProperties& P, | |||||||
|  |  | ||||||
|   O <<") {\n"; |   O <<") {\n"; | ||||||
|  |  | ||||||
|   // Handle option properties that take an argument. |   // Handle option properties that take an argument | ||||||
|   for (OptionPropertyList::const_iterator B = D.Props.begin(), |   for (OptionPropertyList::const_iterator B = D.Props.begin(), | ||||||
|         E = D.Props.end(); B!=E; ++B) { |         E = D.Props.end(); B!=E; ++B) { | ||||||
|     const OptionProperty& val = *B; |     const OptionProperty& val = *B; | ||||||
| @@ -661,8 +622,37 @@ void EmitOptionPropertyHandlingCode (const ToolProperties& P, | |||||||
|   // Handle flags |   // Handle flags | ||||||
|  |  | ||||||
|   // (forward) property |   // (forward) property | ||||||
|   if (D.isForward()) |   if (D.isForward()) { | ||||||
|     HandleForwardPropertyy(O); |     switch (D.Type) { | ||||||
|  |     case OptionType::Switch: | ||||||
|  |       O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n"; | ||||||
|  |       break; | ||||||
|  |     case OptionType::Parameter: | ||||||
|  |       O << Indent3 << "vec.push_back(\"-" << D.Name << "\");\n"; | ||||||
|  |       O << Indent3 << "vec.push_back(" << D.GenVariableName() << ");\n"; | ||||||
|  |       break; | ||||||
|  |     case OptionType::Prefix: | ||||||
|  |       O << Indent3 << "vec.push_back(\"-" << D.Name << "\" + " | ||||||
|  |         << D.GenVariableName() << ");\n"; | ||||||
|  |       break; | ||||||
|  |     case OptionType::PrefixList: | ||||||
|  |       O << Indent3 << "for (" << D.GenTypeDeclaration() | ||||||
|  |         << "::iterator B = " << D.GenVariableName() << ".begin(),\n" | ||||||
|  |         << Indent3 << "E = " << D.GenVariableName() << ".end(); B != E; ++B)\n" | ||||||
|  |         << Indent4 << "vec.push_back(\"-" << D.Name << "\" + " | ||||||
|  |         << "*B);\n"; | ||||||
|  |       break; | ||||||
|  |     case OptionType::ParameterList: | ||||||
|  |       O << Indent3 << "for (" << D.GenTypeDeclaration() | ||||||
|  |         << "::iterator B = " << D.GenVariableName() << ".begin(),\n" | ||||||
|  |         << Indent3 << "E = " << D.GenVariableName() | ||||||
|  |         << ".end() ; B != E; ++B) {\n" | ||||||
|  |         << Indent4 << "vec.push_back(\"-" << D.Name << "\");\n" | ||||||
|  |         << Indent4 << "vec.push_back(*B);\n" | ||||||
|  |         << Indent3 << "}\n"; | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   // (unpack_values) property |   // (unpack_values) property | ||||||
|   if (D.isUnpackValues()) { |   if (D.isUnpackValues()) { | ||||||
| @@ -683,15 +673,16 @@ void EmitOptionPropertyHandlingCode (const ToolProperties& P, | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // End of the if-clause. |   // close if clause | ||||||
|   O << Indent2 << "}\n"; |   O << Indent2 << "}\n"; | ||||||
| } | } | ||||||
|  |  | ||||||
| // EmitGenerateActionMethod - Emit one of two versions of the | // EmitGenerateActionMethod - Emit one of two versions of | ||||||
| // Tool::GenerateAction() method. | // GenerateAction method. | ||||||
| void EmitGenerateActionMethod (const ToolProperties& P, bool V, std::ostream& O) | void EmitGenerateActionMethod (const ToolProperties& P, int V, std::ostream& O) | ||||||
| { | { | ||||||
|   if (V) |   assert(V==1 || V==2); | ||||||
|  |   if (V==1) | ||||||
|     O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"; |     O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"; | ||||||
|   else |   else | ||||||
|     O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n"; |     O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n"; | ||||||
| @@ -710,7 +701,7 @@ void EmitGenerateActionMethod (const ToolProperties& P, bool V, std::ostream& O) | |||||||
|     const std::string& cmd = *I; |     const std::string& cmd = *I; | ||||||
|     O << Indent2; |     O << Indent2; | ||||||
|     if (cmd == "$INFILE") { |     if (cmd == "$INFILE") { | ||||||
|       if (V) |       if (V==1) | ||||||
|         O << "for (PathVector::const_iterator B = inFiles.begin()" |         O << "for (PathVector::const_iterator B = inFiles.begin()" | ||||||
|           << ", E = inFiles.end();\n" |           << ", E = inFiles.end();\n" | ||||||
|           << Indent2 << "B != E; ++B)\n" |           << Indent2 << "B != E; ++B)\n" | ||||||
| @@ -726,14 +717,14 @@ void EmitGenerateActionMethod (const ToolProperties& P, bool V, std::ostream& O) | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // For every understood option, emit handling code. |   // For every understood option, emit handling code | ||||||
|   for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(), |   for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(), | ||||||
|         E = P.OptDescs.end(); B != E; ++B) { |         E = P.OptDescs.end(); B != E; ++B) { | ||||||
|     const ToolOptionDescription& val = B->second; |     const ToolOptionDescription& val = B->second; | ||||||
|     EmitOptionPropertyHandlingCode(P, val, O); |     EmitOptionPropertyHandlingCode(P, val, O); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Handle the Sink property. |   // Handle Sink property | ||||||
|   if (P.isSink()) { |   if (P.isSink()) { | ||||||
|     O << Indent2 << "if (!" << SinkOptionName << ".empty()) {\n" |     O << Indent2 << "if (!" << SinkOptionName << ".empty()) {\n" | ||||||
|       << Indent3 << "vec.insert(vec.end(), " |       << Indent3 << "vec.insert(vec.end(), " | ||||||
| @@ -745,8 +736,8 @@ void EmitGenerateActionMethod (const ToolProperties& P, bool V, std::ostream& O) | |||||||
|     << Indent1 << "}\n\n"; |     << Indent1 << "}\n\n"; | ||||||
| } | } | ||||||
|  |  | ||||||
| /// EmitGenerateActionMethods - Emit two GenerateAction() methods for | /// EmitGenerateActionMethods - Emit two GenerateAction methods for a given | ||||||
| /// a given Tool class. | /// Tool class. | ||||||
| void EmitGenerateActionMethods (const ToolProperties& P, std::ostream& O) { | void EmitGenerateActionMethods (const ToolProperties& P, std::ostream& O) { | ||||||
|  |  | ||||||
|   if (!P.isJoin()) |   if (!P.isJoin()) | ||||||
| @@ -762,8 +753,7 @@ void EmitGenerateActionMethods (const ToolProperties& P, std::ostream& O) { | |||||||
|   EmitGenerateActionMethod(P, 2, O); |   EmitGenerateActionMethod(P, 2, O); | ||||||
| } | } | ||||||
|  |  | ||||||
| /// EmitIsLastMethod - Emit the IsLast() method for a given Tool | /// EmitIsLastMethod - Emit IsLast() method for a given Tool class | ||||||
| /// class. |  | ||||||
| void EmitIsLastMethod (const ToolProperties& P, std::ostream& O) { | void EmitIsLastMethod (const ToolProperties& P, std::ostream& O) { | ||||||
|   O << Indent1 << "bool IsLast() const {\n" |   O << Indent1 << "bool IsLast() const {\n" | ||||||
|     << Indent2 << "bool last = false;\n"; |     << Indent2 << "bool last = false;\n"; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user