@@ -210,24 +210,36 @@ static void verifyTables() {
210
210
#endif
211
211
}
212
212
213
- void llvm::riscvExtensionsHelp () {
213
+ static void PrintExtension (const std::string Name, const std::string Version,
214
+ const std::string Description) {
215
+ outs () << " "
216
+ << format (Description.empty () ? " %-20s%s\n " : " %-20s%-10s%s\n " ,
217
+ Name.c_str (), Version.c_str (), Description.c_str ());
218
+ }
219
+
220
+ void llvm::riscvExtensionsHelp (StringMap<StringRef> DescMap) {
221
+
214
222
outs () << " All available -march extensions for RISC-V\n\n " ;
215
- outs () << ' \t ' << left_justify ( " Name" , 20 ) << " Version \n " ;
223
+ PrintExtension ( " Name" , " Version " , (DescMap. empty () ? " " : " Description " )) ;
216
224
217
225
RISCVISAInfo::OrderedExtensionMap ExtMap;
218
226
for (const auto &E : SupportedExtensions)
219
227
ExtMap[E.Name ] = {E.Version .Major , E.Version .Minor };
220
- for (const auto &E : ExtMap)
221
- outs () << format (" \t %-20s%d.%d\n " , E.first .c_str (), E.second .MajorVersion ,
222
- E.second .MinorVersion );
228
+ for (const auto &E : ExtMap) {
229
+ std::string Version = std::to_string (E.second .MajorVersion ) + " ." +
230
+ std::to_string (E.second .MinorVersion );
231
+ PrintExtension (E.first , Version, DescMap[E.first ].str ());
232
+ }
223
233
224
234
outs () << " \n Experimental extensions\n " ;
225
235
ExtMap.clear ();
226
236
for (const auto &E : SupportedExperimentalExtensions)
227
237
ExtMap[E.Name ] = {E.Version .Major , E.Version .Minor };
228
- for (const auto &E : ExtMap)
229
- outs () << format (" \t %-20s%d.%d\n " , E.first .c_str (), E.second .MajorVersion ,
230
- E.second .MinorVersion );
238
+ for (const auto &E : ExtMap) {
239
+ std::string Version = std::to_string (E.second .MajorVersion ) + " ." +
240
+ std::to_string (E.second .MinorVersion );
241
+ PrintExtension (E.first , Version, DescMap[" experimental-" + E.first ].str ());
242
+ }
231
243
232
244
outs () << " \n Use -march to specify the target's extension.\n "
233
245
" For example, clang -march=rv32i_v1p0\n " ;
0 commit comments