Mercurial > hg > graal-compiler
comparison src/share/vm/adlc/main.cpp @ 6850:d336b3173277
8000592: Improve adlc usability
Summary: several changes to adlc to improve its usability
Reviewed-by: kvn
Contributed-by: goetz.lindenmaier@sap.com
author | kvn |
---|---|
date | Tue, 09 Oct 2012 16:09:31 -0700 |
parents | da91efe96a93 |
children | f0c2369fda5a |
comparison
equal
deleted
inserted
replaced
6849:f6badecb7ea7 | 6850:d336b3173277 |
---|---|
339 | 339 |
340 //------------------------------usage------------------------------------------ | 340 //------------------------------usage------------------------------------------ |
341 static void usage(ArchDesc& AD) | 341 static void usage(ArchDesc& AD) |
342 { | 342 { |
343 printf("Architecture Description Language Compiler\n\n"); | 343 printf("Architecture Description Language Compiler\n\n"); |
344 printf("Usage: adl [-doqw] [-Dflag[=def]] [-Uflag] [-cFILENAME] [-hFILENAME] [-aDFAFILE] ADLFILE\n"); | 344 printf("Usage: adlc [-doqwTs] [-#]* [-D<FLAG>[=<DEF>]] [-U<FLAG>] [-c<CPP_FILE_NAME>] [-h<HPP_FILE_NAME>] [-a<DFA_FILE_NAME>] [-v<GLOBALS_FILE_NAME>] <ADL_FILE_NAME>\n"); |
345 printf(" d produce DFA debugging info\n"); | 345 printf(" d produce DFA debugging info\n"); |
346 printf(" o no output produced, syntax and semantic checking only\n"); | 346 printf(" o no output produced, syntax and semantic checking only\n"); |
347 printf(" q quiet mode, supresses all non-essential messages\n"); | 347 printf(" q quiet mode, supresses all non-essential messages\n"); |
348 printf(" w suppress warning messages\n"); | 348 printf(" w suppress warning messages\n"); |
349 printf(" T make DFA as many subroutine calls\n"); | |
350 printf(" s output which instructions are cisc-spillable\n"); | |
351 printf(" D define preprocessor symbol\n"); | |
352 printf(" U undefine preprocessor symbol\n"); | |
349 printf(" c specify CPP file name (default: %s)\n", AD._CPP_file._name); | 353 printf(" c specify CPP file name (default: %s)\n", AD._CPP_file._name); |
350 printf(" h specify HPP file name (default: %s)\n", AD._HPP_file._name); | 354 printf(" h specify HPP file name (default: %s)\n", AD._HPP_file._name); |
351 printf(" a specify DFA output file name\n"); | 355 printf(" a specify DFA output file name\n"); |
356 printf(" v specify adGlobals output file name\n"); | |
357 printf(" # increment ADL debug level\n"); | |
352 printf("\n"); | 358 printf("\n"); |
353 } | 359 } |
354 | 360 |
355 //------------------------------open_file------------------------------------ | 361 //------------------------------open_file------------------------------------ |
356 int ArchDesc::open_file(bool required, ADLFILE & ADF, const char *action) | 362 int ArchDesc::open_file(bool required, ADLFILE & ADF, const char *action) |
448 if (*ep == '.') *ep = '\0'; // truncate string at '.' | 454 if (*ep == '.') *ep = '\0'; // truncate string at '.' |
449 } | 455 } |
450 return fname; | 456 return fname; |
451 } | 457 } |
452 | 458 |
453 //------------------------------strip_path_and_ext------------------------------ | |
454 static char *strip_path_and_ext(char *fname) | |
455 { | |
456 char *ep; | |
457 char *sp; | |
458 | |
459 if (fname) { | |
460 for (sp = fname; *sp; sp++) | |
461 if (*sp == '/') fname = sp+1; | |
462 ep = fname; // start at first character and look for '.' | |
463 while (ep <= (fname + strlen(fname) - 1) && *ep != '.') ep++; | |
464 if (*ep == '.') *ep = '\0'; // truncate string at '.' | |
465 } | |
466 return fname; | |
467 } | |
468 | |
469 //------------------------------base_plus_suffix------------------------------- | 459 //------------------------------base_plus_suffix------------------------------- |
470 // New concatenated string | 460 // New concatenated string |
471 static char *base_plus_suffix(const char* base, const char *suffix) | 461 static char *base_plus_suffix(const char* base, const char *suffix) |
472 { | 462 { |
473 int len = (int)strlen(base) + (int)strlen(suffix) + 1; | 463 int len = (int)strlen(base) + (int)strlen(suffix) + 1; |
474 | 464 |
475 char* fname = new char[len]; | 465 char* fname = new char[len]; |
476 sprintf(fname,"%s%s",base,suffix); | 466 sprintf(fname,"%s%s",base,suffix); |
477 return fname; | |
478 } | |
479 | |
480 | |
481 //------------------------------prefix_plus_base_plus_suffix------------------- | |
482 // New concatenated string | |
483 static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix) | |
484 { | |
485 int len = (int)strlen(prefix) + (int)strlen(base) + (int)strlen(suffix) + 1; | |
486 | |
487 char* fname = new char[len]; | |
488 sprintf(fname,"%s%s%s",prefix,base,suffix); | |
489 return fname; | 467 return fname; |
490 } | 468 } |
491 | 469 |
492 //------------------------------get_legal_text--------------------------------- | 470 //------------------------------get_legal_text--------------------------------- |
493 // Get pointer to legal text at the beginning of AD file. | 471 // Get pointer to legal text at the beginning of AD file. |