Skip to content

Commit c4a2a13

Browse files
Move all fields of '-cc1' option related classes into def file databases
Once the new option parsing system is committed, this will allow to generate a check to ensure that correct command line generation happens Differential Revision: https://reviews.llvm.org/D86290
1 parent 8a3907c commit c4a2a13

31 files changed

+1324
-975
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 228 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616
#ifndef CODEGENOPT
17-
# error Define the CODEGENOPT macro to handle language options
17+
#error Define the CODEGENOPT macro to handle language options
1818
#endif
1919

2020
#ifndef VALUE_CODEGENOPT
21-
# define VALUE_CODEGENOPT(Name, Bits, Default) \
22-
CODEGENOPT(Name, Bits, Default)
21+
#define VALUE_CODEGENOPT(Name, Bits, Default) CODEGENOPT(Name, Bits, Default)
2322
#endif
2423

2524
#ifndef ENUM_CODEGENOPT
26-
# define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
27-
CODEGENOPT(Name, Bits, Default)
25+
#define ENUM_CODEGENOPT(Name, Type, Bits, Default) \
26+
CODEGENOPT(Name, Bits, Default)
27+
#endif
28+
29+
#ifndef TYPED_CODEGENOPT
30+
#define TYPED_CODEGENOPT(Type, Name, Description)
2831
#endif
2932

3033
CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
@@ -395,6 +398,226 @@ CODEGENOPT(KeepStaticConsts, 1, 0)
395398
/// Whether to not follow the AAPCS that enforce at least one read before storing to a volatile bitfield
396399
CODEGENOPT(ForceAAPCSBitfieldLoad, 1, 0)
397400

401+
TYPED_CODEGENOPT(
402+
std::string, BBSections,
403+
"This field stores one of the allowed values for the option "
404+
"-fbasic-block-sections=. The allowed values with this option are: "
405+
"{\"labels\", \"all\", \"list=<file>\", \"none\"}. \"labels\": Only "
406+
"generate basic block symbols (labels) for all basic blocks, do not "
407+
"generate unique sections for basic blocks. Use the machine basic block id "
408+
"in the symbol name to associate profile info from virtual address to "
409+
"machine basic block. \"all\" : Generate basic block sections for "
410+
"all basic blocks. \"list=<file>\": Generate basic block sections for a "
411+
"subset of basic blocks. The functions and the machine basic block ids are "
412+
"specified in the file. \"none\": Disable sections/labels for basic "
413+
"blocks.")
414+
415+
TYPED_CODEGENOPT(std::string, CodeModel, "The code model to use (-mcmodel).")
416+
417+
TYPED_CODEGENOPT(std::string, CoverageDataFile,
418+
"The filename with path we use for coverage data files. The "
419+
"runtime allows further manipulation with the GCOV_PREFIX and "
420+
"GCOV_PREFIX_STRIP environment variables. The filename with "
421+
"path we use for coverage notes files.")
422+
TYPED_CODEGENOPT(std::string, CoverageNotesFile, "")
423+
424+
TYPED_CODEGENOPT(
425+
std::string, ProfileFilterFiles,
426+
"Regexes separated by a semi-colon to filter the files to instrument.")
427+
428+
TYPED_CODEGENOPT(
429+
std::string, ProfileExcludeFiles,
430+
"Regexes separated by a semi-colon to filter the files to not instrument.")
431+
432+
TYPED_CODEGENOPT(CoverageVersionTy, CoverageVersion,
433+
"The version string to put into coverage files.")
434+
435+
TYPED_CODEGENOPT(std::string, DebugPass,
436+
"Enable additional debugging information.")
437+
438+
TYPED_CODEGENOPT(std::string, DebugCompilationDir,
439+
"The string to embed in debug information as the current "
440+
"working directory.")
441+
442+
TYPED_CODEGENOPT(std::string, DwarfDebugFlags,
443+
"The string to embed in the debug information for the compile "
444+
"unit, if non-empty.")
445+
446+
TYPED_CODEGENOPT(std::string, RecordCommandLine,
447+
"The string containing the commandline for the "
448+
"llvm.commandline metadata, if non-empty.")
449+
450+
TYPED_CODEGENOPT(DebugPrefixMapTy, DebugPrefixMap, "")
451+
452+
TYPED_CODEGENOPT(std::string, FloatABI,
453+
"The ABI to use for passing floating point arguments.")
454+
455+
TYPED_CODEGENOPT(llvm::DenormalMode, FPDenormalMode,
456+
"The floating-point denormal mode to use.")
457+
458+
TYPED_CODEGENOPT(llvm::DenormalMode, FP32DenormalMode,
459+
"The floating-point denormal mode to use, for float.")
460+
461+
TYPED_CODEGENOPT(std::string, LimitFloatPrecision,
462+
"The float precision limit to use, if non-empty.")
463+
464+
TYPED_CODEGENOPT(std::vector<BitcodeFileToLink>, LinkBitcodeFiles,
465+
"The files specified here are linked in to the module before "
466+
"optimizations.")
467+
468+
TYPED_CODEGENOPT(
469+
std::string, MainFileName,
470+
"The user provided name for the \"main file\", if non-empty. This is "
471+
"useful in situations where the input file name does not match the "
472+
"original input file, for example with -save-temps.")
473+
474+
TYPED_CODEGENOPT(std::string, SplitDwarfFile,
475+
"The name for the split debug info file used for the "
476+
"DW_AT_[GNU_]dwo_name attribute in the skeleton CU.")
477+
478+
TYPED_CODEGENOPT(
479+
std::string, SplitDwarfOutput,
480+
"Output filename for the split debug info, not used in the skeleton CU.")
481+
482+
TYPED_CODEGENOPT(llvm::Reloc::Model, RelocationModel,
483+
"The name of the relocation model to use.")
484+
485+
TYPED_CODEGENOPT(std::string, ThreadModel, "The thread model to use")
486+
487+
TYPED_CODEGENOPT(std::string, TrapFuncName,
488+
"If not an empty string, trap intrinsics are lowered to calls "
489+
"to this function instead of to trap instructions.")
490+
491+
TYPED_CODEGENOPT(std::vector<std::string>, DependentLibraries,
492+
"A list of dependent libraries.")
493+
494+
TYPED_CODEGENOPT(std::vector<std::string>, LinkerOptions,
495+
"A list of linker options to embed in the object file.")
496+
497+
TYPED_CODEGENOPT(
498+
std::string, InstrProfileOutput,
499+
"Name of the profile file to use as output for -fprofile-instr-generate, "
500+
"-fprofile-generate, and -fcs-profile-generate.")
501+
502+
TYPED_CODEGENOPT(std::string, SampleProfileFile,
503+
"Name of the profile file to use with -fprofile-sample-use.")
504+
505+
TYPED_CODEGENOPT(
506+
std::string, ProfileInstrumentUsePath,
507+
"Name of the profile file to use as input for -fprofile-instr-use")
508+
509+
TYPED_CODEGENOPT(
510+
std::string, ProfileRemappingFile,
511+
"Name of the profile remapping file to apply to the profile data supplied "
512+
"by -fprofile-sample-use or -fprofile-instr-use.")
513+
514+
TYPED_CODEGENOPT(std::string, ThinLTOIndexFile,
515+
"Name of the function summary index file to use for ThinLTO "
516+
"function importing.")
517+
518+
TYPED_CODEGENOPT(
519+
std::string, ThinLinkBitcodeFile,
520+
"Name of a file that can optionally be written with minimized bitcode to "
521+
"be used as input for the ThinLTO thin link step, which only needs the "
522+
"summary and module symbol table (and not, e.g. any debug metadata).")
523+
524+
TYPED_CODEGENOPT(std::string, SaveTempsFilePrefix,
525+
"Prefix to use for -save-temps output.")
526+
527+
TYPED_CODEGENOPT(
528+
std::string, CudaGpuBinaryFileName,
529+
"Name of file passed with -fcuda-include-gpubinary option to forward to "
530+
"CUDA runtime back-end for incorporating them into host-side object file.")
531+
532+
TYPED_CODEGENOPT(std::string, OptRecordFile,
533+
"The name of the file to which the backend should save YAML "
534+
"optimization records.")
535+
536+
TYPED_CODEGENOPT(std::string, OptRecordPasses,
537+
"The regex that filters the passes that should be saved to "
538+
"the optimization records.")
539+
540+
TYPED_CODEGENOPT(std::string, OptRecordFormat,
541+
"The format used for serializing remarks (default: YAML)")
542+
543+
TYPED_CODEGENOPT(
544+
std::string, SymbolPartition,
545+
"The name of the partition that symbols are assigned to, specified with "
546+
"-fsymbol-partition (see https://lld.llvm.org/Partitions.html).")
547+
548+
TYPED_CODEGENOPT(
549+
std::shared_ptr<llvm::Regex>, OptimizationRemarkPattern,
550+
"Regular expression to select optimizations for which we should enable "
551+
"optimization remarks. Transformation passes whose name matches this "
552+
"expression (and support this feature), will emit a diagnostic whenever "
553+
"they perform a transformation. This is enabled by the -Rpass=regexp flag.")
554+
555+
TYPED_CODEGENOPT(
556+
std::shared_ptr<llvm::Regex>, OptimizationRemarkMissedPattern,
557+
"Regular expression to select optimizations for which we should enable "
558+
"missed optimization remarks. Transformation passes whose name matches "
559+
"this expression (and support this feature), will emit a diagnostic "
560+
"whenever they tried but failed to perform a transformation. This is "
561+
"enabled by the -Rpass-missed=regexp flag.")
562+
563+
TYPED_CODEGENOPT(
564+
std::shared_ptr<llvm::Regex>, OptimizationRemarkAnalysisPattern,
565+
"Regular expression to select optimizations for which we should enable "
566+
"optimization analyses. Transformation passes whose name matches this "
567+
"expression (and support this feature), will emit a diagnostic whenever "
568+
"they want to explain why they decided to apply or not apply a given "
569+
"transformation. This is enabled by the -Rpass-analysis=regexp flag.")
570+
571+
TYPED_CODEGENOPT(std::vector<std::string>, RewriteMapFiles,
572+
"Set of files defining the rules for the symbol rewriting.")
573+
574+
TYPED_CODEGENOPT(SanitizerSet, SanitizeRecover,
575+
"Set of sanitizer checks that are non-fatal (i.e. execution "
576+
"should be continued when possible).")
577+
578+
TYPED_CODEGENOPT(SanitizerSet, SanitizeTrap,
579+
"Set of sanitizer checks that trap rather than diagnose.")
580+
581+
TYPED_CODEGENOPT(std::vector<uint8_t>, CmdArgs,
582+
"List of backend command-line options for -fembed-bitcode.")
583+
584+
TYPED_CODEGENOPT(std::vector<std::string>, NoBuiltinFuncs,
585+
"A list of all -fno-builtin-* function names (e.g., memset).")
586+
587+
TYPED_CODEGENOPT(std::vector<std::string>, Reciprocals, "")
588+
589+
TYPED_CODEGENOPT(std::string, PreferVectorWidth,
590+
"The preferred width for auto-vectorization transforms. This "
591+
"is intended to override default transforms based on the "
592+
"width of the architected vector registers.")
593+
594+
TYPED_CODEGENOPT(XRayInstrSet, XRayInstrumentationBundle,
595+
"Set of XRay instrumentation kinds to emit.")
596+
597+
TYPED_CODEGENOPT(std::vector<std::string>, DefaultFunctionAttrs, "")
598+
599+
TYPED_CODEGENOPT(
600+
std::vector<std::string>, PassPlugins,
601+
"List of dynamic shared object files to be loaded as pass plugins.")
602+
603+
TYPED_CODEGENOPT(
604+
std::vector<std::string>, SanitizeCoverageAllowlistFiles,
605+
"Path to allowlist file specifying which objects (files, functions) should "
606+
"exclusively be instrumented by sanitizer coverage pass.")
607+
608+
TYPED_CODEGENOPT(std::vector<std::string>, SanitizeCoverageBlocklistFiles,
609+
"Path to blocklist file specifying which objects (files, "
610+
"functions) listed for instrumentation by sanitizer coverage "
611+
"pass should actually not be instrumented.")
612+
613+
TYPED_CODEGENOPT(
614+
const char *, Argv0,
615+
"Executable and command-line used to create a given CompilerInvocation. "
616+
"Most of the time this will be the full -cc1 command.")
617+
618+
TYPED_CODEGENOPT(ArrayRef<const char *>, CommandLineArgs, "")
619+
398620
#undef CODEGENOPT
399621
#undef ENUM_CODEGENOPT
400622
#undef VALUE_CODEGENOPT
623+
#undef TYPED_CODEGENOPT

0 commit comments

Comments
 (0)