From 6368818fd572b49ecb062906ed4a379bca4447df Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Tue, 11 Dec 2018 03:18:39 +0000 Subject: Move CodeGenOptions from Frontend to Basic Basic uses CodeGenOptions and should not depend on Frontend. llvm-svn: 348827 --- clang/include/clang/Basic/CodeGenOptions.def | 366 +++++++++++++++++++++ clang/include/clang/Basic/CodeGenOptions.h | 327 ++++++++++++++++++ clang/include/clang/Frontend/CodeGenOptions.def | 366 --------------------- clang/include/clang/Frontend/CodeGenOptions.h | 327 ------------------ clang/include/clang/Frontend/CompilerInvocation.h | 2 +- clang/include/clang/module.modulemap | 9 +- clang/lib/Basic/CMakeLists.txt | 1 + clang/lib/Basic/CodeGenOptions.cpp | 32 ++ clang/lib/Basic/Targets/AMDGPU.cpp | 2 +- clang/lib/CodeGen/BackendUtil.cpp | 2 +- clang/lib/CodeGen/CGCXX.cpp | 2 +- clang/lib/CodeGen/CGCall.cpp | 2 +- clang/lib/CodeGen/CGClass.cpp | 2 +- clang/lib/CodeGen/CGDebugInfo.cpp | 2 +- clang/lib/CodeGen/CGDebugInfo.h | 2 +- clang/lib/CodeGen/CGDecl.cpp | 2 +- clang/lib/CodeGen/CGDeclCXX.cpp | 2 +- clang/lib/CodeGen/CGExpr.cpp | 2 +- clang/lib/CodeGen/CGExprCXX.cpp | 2 +- clang/lib/CodeGen/CGExprScalar.cpp | 2 +- clang/lib/CodeGen/CGObjCMac.cpp | 2 +- clang/lib/CodeGen/CGRecordLayoutBuilder.cpp | 2 +- clang/lib/CodeGen/CGVTables.cpp | 2 +- clang/lib/CodeGen/CodeGenABITypes.cpp | 1 - clang/lib/CodeGen/CodeGenFunction.cpp | 2 +- clang/lib/CodeGen/CodeGenFunction.h | 2 +- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- clang/lib/CodeGen/CodeGenPGO.h | 1 - clang/lib/CodeGen/CodeGenTBAA.cpp | 2 +- clang/lib/CodeGen/CoverageMappingGen.h | 1 - clang/lib/CodeGen/ModuleBuilder.cpp | 2 +- .../CodeGen/ObjectFilePCHContainerOperations.cpp | 2 +- clang/lib/CodeGen/TargetInfo.cpp | 2 +- clang/lib/Frontend/CMakeLists.txt | 1 - clang/lib/Frontend/CodeGenOptions.cpp | 32 -- clang/lib/Frontend/CompilerInvocation.cpp | 2 +- 36 files changed, 751 insertions(+), 761 deletions(-) create mode 100644 clang/include/clang/Basic/CodeGenOptions.def create mode 100644 clang/include/clang/Basic/CodeGenOptions.h delete mode 100644 clang/include/clang/Frontend/CodeGenOptions.def delete mode 100644 clang/include/clang/Frontend/CodeGenOptions.h create mode 100644 clang/lib/Basic/CodeGenOptions.cpp delete mode 100644 clang/lib/Frontend/CodeGenOptions.cpp (limited to 'clang') diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def new file mode 100644 index 00000000000..952aa588b60 --- /dev/null +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -0,0 +1,366 @@ +//===--- CodeGenOptions.def - Code generation option database ----- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the code generation options. Users of this file +// must define the CODEGENOPT macro to make use of this information. +// Optionally, the user may also define ENUM_CODEGENOPT (for options +// that have enumeration type and VALUE_CODEGENOPT is a code +// generation option that describes a value rather than a flag. +// +//===----------------------------------------------------------------------===// +#ifndef CODEGENOPT +# error Define the CODEGENOPT macro to handle language options +#endif + +#ifndef VALUE_CODEGENOPT +# define VALUE_CODEGENOPT(Name, Bits, Default) \ +CODEGENOPT(Name, Bits, Default) +#endif + +#ifndef ENUM_CODEGENOPT +# define ENUM_CODEGENOPT(Name, Type, Bits, Default) \ +CODEGENOPT(Name, Bits, Default) +#endif + +CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as +ENUM_CODEGENOPT(CompressDebugSections, llvm::DebugCompressionType, 2, + llvm::DebugCompressionType::None) +CODEGENOPT(RelaxELFRelocations, 1, 0) ///< -Wa,--mrelax-relocations +CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm. +CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments. +CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new +CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink +CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe. +CODEGENOPT(Backchain , 1, 0) ///< -mbackchain +CODEGENOPT(ControlFlowGuard , 1, 0) ///< -cfguard +CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files. +CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files. +CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit block before the body blocks in GCNO files. +CODEGENOPT(CXAAtExit , 1, 1) ///< Use __cxa_atexit for calling destructors. +CODEGENOPT(RegisterGlobalDtorsWithAtExit, 1, 1) ///< Use atexit or __cxa_atexit to register global destructors. +CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker + ///< aliases to base ctors when possible. +CODEGENOPT(DataSections , 1, 0) ///< Set when -fdata-sections is enabled. +CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names. +CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is enabled. +CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory. +CODEGENOPT(DiscardValueNames , 1, 0) ///< Discard Value Names from the IR (LLVMContext flag) +CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing. +CODEGENOPT(DisableLLVMPasses , 1, 0) ///< Don't run any LLVM IR passes to get + ///< the pristine IR generated by the + ///< frontend. +CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any lifetime markers +CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with optnone at O0 +CODEGENOPT(ExperimentalNewPassManager, 1, 0) ///< Enables the new, experimental + ///< pass manager. +CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new + ///< pass manager. +CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled. +CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs + ///< is specified. +CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls. +CODEGENOPT(NoEscapingBlockTailCalls, 1, 0) ///< Do not emit tail calls from + ///< escaping blocks. +CODEGENOPT(EmitDeclMetadata , 1, 0) ///< Emit special metadata indicating what + ///< Decl* various IR entities came from. + ///< Only useful when running CodeGen as a + ///< subroutine. +CODEGENOPT(EmitVersionIdentMetadata , 1, 1) ///< Emit compiler version metadata. +CODEGENOPT(EmitGcovArcs , 1, 0) ///< Emit coverage data files, aka. GCDA. +CODEGENOPT(EmitGcovNotes , 1, 0) ///< Emit coverage "notes" files, aka GCNO. +CODEGENOPT(EmitOpenCLArgMetadata , 1, 0) ///< Emit OpenCL kernel arg metadata. +CODEGENOPT(EmulatedTLS , 1, 0) ///< Set by default or -f[no-]emulated-tls. +CODEGENOPT(ExplicitEmulatedTLS , 1, 0) ///< Set if -f[no-]emulated-tls is used. +/// Embed Bitcode mode (off/all/bitcode/marker). +ENUM_CODEGENOPT(EmbedBitcode, EmbedBitcodeKind, 2, Embed_Off) +CODEGENOPT(ForbidGuardVariables , 1, 0) ///< Issue errors if C++ guard variables + ///< are required. +CODEGENOPT(FunctionSections , 1, 0) ///< Set when -ffunction-sections is enabled. +CODEGENOPT(InstrumentFunctions , 1, 0) ///< Set when -finstrument-functions is + ///< enabled. +CODEGENOPT(InstrumentFunctionsAfterInlining , 1, 0) ///< Set when + ///< -finstrument-functions-after-inlining is enabled. +CODEGENOPT(InstrumentFunctionEntryBare , 1, 0) ///< Set when + ///< -finstrument-function-entry-bare is enabled. +CODEGENOPT(CFProtectionReturn , 1, 0) ///< if -fcf-protection is + ///< set to full or return. +CODEGENOPT(CFProtectionBranch , 1, 0) ///< if -fcf-protection is + ///< set to full or branch. +CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is + ///< enabled. +CODEGENOPT(StackSizeSection , 1, 0) ///< Set when -fstack-size-section is enabled. + +///< Set when -fxray-always-emit-customevents is enabled. +CODEGENOPT(XRayAlwaysEmitCustomEvents , 1, 0) + +///< Set when -fxray-always-emit-typedevents is enabled. +CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0) + +///< Set the minimum number of instructions in a function to determine selective +///< XRay instrumentation. +VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200) + +CODEGENOPT(InstrumentForProfiling , 1, 0) ///< Set when -pg is enabled. +CODEGENOPT(CallFEntry , 1, 0) ///< Set when -mfentry is enabled. +CODEGENOPT(LessPreciseFPMAD , 1, 0) ///< Enable less precise MAD instructions to + ///< be generated. +CODEGENOPT(PrepareForLTO , 1, 0) ///< Set when -flto is enabled on the + ///< compile step. +CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the + ///< compile step. +CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole + ///< program vtable opt). +CODEGENOPT(IncrementalLinkerCompatible, 1, 0) ///< Emit an object file which can + ///< be used with an incremental + ///< linker. +CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants. +CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled. +CODEGENOPT(MSVolatile , 1, 0) ///< Set when /volatile:ms is enabled. +CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled. +CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is + ///< enabled. +CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled. +CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is + ///< enabled. +CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled. +CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled. +CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf. +CODEGENOPT(NoSignedZeros , 1, 0) ///< Allow ignoring the signedness of FP zero +CODEGENOPT(NullPointerIsValid , 1, 0) ///< Assume Null pointer deference is defined. +CODEGENOPT(Reassociate , 1, 0) ///< Allow reassociation of FP math ops +CODEGENOPT(ReciprocalMath , 1, 0) ///< Allow FP divisions to be reassociated. +CODEGENOPT(NoTrappingMath , 1, 0) ///< Set when -fno-trapping-math is enabled. +CODEGENOPT(NoNaNsFPMath , 1, 0) ///< Assume FP arguments, results not NaN. +CODEGENOPT(FlushDenorm , 1, 0) ///< Allow FP denorm numbers to be flushed to zero +CODEGENOPT(CorrectlyRoundedDivSqrt, 1, 0) ///< -cl-fp32-correctly-rounded-divide-sqrt + +/// When false, this attempts to generate code as if the result of an +/// overflowing conversion matches the overflowing behavior of a target's native +/// float-to-int conversion instructions. +CODEGENOPT(StrictFloatCastOverflow, 1, 1) + +CODEGENOPT(UniformWGSize , 1, 0) ///< -cl-uniform-work-group-size +CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss. +/// Method of Objective-C dispatch to use. +ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy) +/// Replace certain message sends with calls to ObjC runtime entrypoints +CODEGENOPT(ObjCConvertMessagesToRuntimeCalls , 1, 1) +CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is + ///< enabled. + +VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified. +VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified. + +/// Choose profile instrumenation kind or no instrumentation. +ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 2, ProfileNone) +/// Choose profile kind for PGO use compilation. +ENUM_CODEGENOPT(ProfileUse, ProfileInstrKind, 2, ProfileNone) +CODEGENOPT(CoverageMapping , 1, 0) ///< Generate coverage mapping regions to + ///< enable code coverage analysis. +CODEGENOPT(DumpCoverageMapping , 1, 0) ///< Dump the generated coverage mapping + ///< regions. + + /// If -fpcc-struct-return or -freg-struct-return is specified. +ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Default) + +CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions. +CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled. +CODEGENOPT(StructPathTBAA , 1, 0) ///< Whether or not to use struct-path TBAA. +CODEGENOPT(NewStructPathTBAA , 1, 0) ///< Whether or not to use enhanced struct-path TBAA. +CODEGENOPT(SaveTempLabels , 1, 0) ///< Save temporary labels. +CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0) ///< Enable use-after-scope detection + ///< in AddressSanitizer +CODEGENOPT(SanitizeAddressPoisonCustomArrayCookie, 1, + 0) ///< Enable poisoning operator new[] which is not a replaceable + ///< global allocation function in AddressSanitizer +CODEGENOPT(SanitizeAddressGlobalsDeadStripping, 1, 0) ///< Enable linker dead stripping + ///< of globals in AddressSanitizer +CODEGENOPT(SanitizeAddressUseOdrIndicator, 1, 0) ///< Enable ODR indicator globals +CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in + ///< MemorySanitizer +CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete detection + ///< in MemorySanitizer +CODEGENOPT(SanitizeCfiCrossDso, 1, 0) ///< Enable cross-dso support in CFI. +CODEGENOPT(SanitizeMinimalRuntime, 1, 0) ///< Use "_minimal" sanitizer runtime for + ///< diagnostics. +CODEGENOPT(SanitizeCfiICallGeneralizePointers, 1, 0) ///< Generalize pointer types in + ///< CFI icall function signatures +CODEGENOPT(SanitizeCoverageType, 2, 0) ///< Type of sanitizer coverage + ///< instrumentation. +CODEGENOPT(SanitizeCoverageIndirectCalls, 1, 0) ///< Enable sanitizer coverage + ///< for indirect calls. +CODEGENOPT(SanitizeCoverageTraceBB, 1, 0) ///< Enable basic block tracing in + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageTraceCmp, 1, 0) ///< Enable cmp instruction tracing + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageTraceDiv, 1, 0) ///< Enable div instruction tracing + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageTraceGep, 1, 0) ///< Enable GEP instruction tracing + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverage8bitCounters, 1, 0) ///< Use 8-bit frequency counters + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageTracePC, 1, 0) ///< Enable PC tracing + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageTracePCGuard, 1, 0) ///< Enable PC tracing with guard + ///< in sanitizer coverage. +CODEGENOPT(SanitizeCoverageInline8bitCounters, 1, 0) ///< Use inline 8bit counters. +CODEGENOPT(SanitizeCoveragePCTable, 1, 0) ///< Create a PC Table. +CODEGENOPT(SanitizeCoverageNoPrune, 1, 0) ///< Disable coverage pruning. +CODEGENOPT(SanitizeCoverageStackDepth, 1, 0) ///< Enable max stack depth tracing +CODEGENOPT(SanitizeStats , 1, 0) ///< Collect statistics for sanitizers. +CODEGENOPT(SimplifyLibCalls , 1, 1) ///< Set when -fbuiltin is enabled. +CODEGENOPT(SoftFloat , 1, 0) ///< -soft-float. +CODEGENOPT(SpeculativeLoadHardening, 1, 0) ///< Enable speculative load hardening. +CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable fine-grained bitfield accesses. +CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition. +CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers +CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report is enabled. +CODEGENOPT(UnrollLoops , 1, 0) ///< Control whether loops are unrolled. +CODEGENOPT(RerollLoops , 1, 0) ///< Control whether loops are rerolled. +CODEGENOPT(NoUseJumpTables , 1, 0) ///< Set when -fno-jump-tables is enabled. +CODEGENOPT(UnsafeFPMath , 1, 0) ///< Allow unsafe floating point optzns. +CODEGENOPT(UnwindTables , 1, 0) ///< Emit unwind tables. +CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer. +CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer. +CODEGENOPT(ProfileSampleAccurate, 1, 0) ///< Sample profile is accurate. + + /// Attempt to use register sized accesses to bit-fields in structures, when + /// possible. +CODEGENOPT(UseRegisterSizedBitfieldAccess , 1, 0) + +CODEGENOPT(VerifyModule , 1, 1) ///< Control whether the module should be run + ///< through the LLVM Verifier. + +CODEGENOPT(StackRealignment , 1, 0) ///< Control whether to force stack + ///< realignment. +CODEGENOPT(UseInitArray , 1, 0) ///< Control whether to use .init_array or + ///< .ctors. +VALUE_CODEGENOPT(StackAlignment , 32, 0) ///< Overrides default stack + ///< alignment, if not 0. +VALUE_CODEGENOPT(StackProbeSize , 32, 4096) ///< Overrides default stack + ///< probe size, even if 0. +CODEGENOPT(NoStackArgProbe, 1, 0) ///< Set when -mno-stack-arg-probe is used +CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information + ///< in debug info. + +CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain + ///< external references to a PCH or module. + +CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should + ///< contain explicit imports for + ///< anonymous namespaces + +ENUM_CODEGENOPT(SplitDwarfMode, DwarfFissionKind, 2, NoFission) ///< DWARF fission mode to use. + +CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the + ///< skeleton CU to allow for symbolication + ///< of inline stack frames without .dwo files. +CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete + ///< template parameter descriptions in + ///< forward declarations (versus just + ///< including them in the name). + +CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. + +CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program + /// vtable optimization. + +/// Whether to use public LTO visibility for entities in std and stdext +/// namespaces. This is enabled by clang-cl's /MT and /MTd flags. +CODEGENOPT(LTOVisibilityPublicStd, 1, 0) + +/// The user specified number of registers to be used for integral arguments, +/// or 0 if unspecified. +VALUE_CODEGENOPT(NumRegisterParameters, 32, 0) + +/// The lower bound for a buffer to be considered for stack protection. +VALUE_CODEGENOPT(SSPBufferSize, 32, 0) + +/// The kind of generated debug info. +ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 3, codegenoptions::NoDebugInfo) + +/// Whether to generate macro debug info. +CODEGENOPT(MacroDebugInfo, 1, 0) + +/// Tune the debug info for this debugger. +ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 2, + llvm::DebuggerKind::Default) + +/// Dwarf version. Version zero indicates to LLVM that no DWARF should be +/// emitted. +VALUE_CODEGENOPT(DwarfVersion, 3, 0) + +/// Whether we should emit CodeView debug information. It's possible to emit +/// CodeView and DWARF into the same object. +CODEGENOPT(EmitCodeView, 1, 0) + +/// Whether to emit the .debug$H section containing hashes of CodeView types. +CODEGENOPT(CodeViewGHash, 1, 0) + +/// The kind of inlining to perform. +ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining) + +// Vector functions library to use. +ENUM_CODEGENOPT(VecLib, VectorLibrary, 2, NoLibrary) + +/// The default TLS model to use. +ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel) + +/// Number of path components to strip when emitting checks. (0 == full +/// filename) +VALUE_CODEGENOPT(EmitCheckPathComponentsToStrip, 32, 0) + +/// Whether to report the hotness of the code region for optimization remarks. +CODEGENOPT(DiagnosticsWithHotness, 1, 0) + +/// The minimum hotness value a diagnostic needs in order to be included in +/// optimization diagnostics. +VALUE_CODEGENOPT(DiagnosticsHotnessThreshold, 32, 0) + +/// Whether copy relocations support is available when building as PIE. +CODEGENOPT(PIECopyRelocations, 1, 0) + +/// Whether we should use the undefined behaviour optimization for control flow +/// paths that reach the end of a function without executing a required return. +CODEGENOPT(StrictReturn, 1, 1) + +/// Whether emit extra debug info for sample pgo profile collection. +CODEGENOPT(DebugInfoForProfiling, 1, 0) + +/// Whether 3-component vector type is preserved. +CODEGENOPT(PreserveVec3Type, 1, 0) + +/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames. +CODEGENOPT(DebugNameTable, 2, 0) + +/// Whether to use DWARF base address specifiers in .debug_ranges. +CODEGENOPT(DebugRangesBaseAddress, 1, 0) + +CODEGENOPT(NoPLT, 1, 0) + +/// Whether to embed source in DWARF debug line section. +CODEGENOPT(EmbedSource, 1, 0) + +/// Whether to emit all vtables +CODEGENOPT(ForceEmitVTables, 1, 0) + +/// Whether to emit an address-significance table into the object file. +CODEGENOPT(Addrsig, 1, 0) + +ENUM_CODEGENOPT(SignReturnAddress, SignReturnAddressScope, 2, None) +ENUM_CODEGENOPT(SignReturnAddressKey, SignReturnAddressKeyValue, 1, AKey) +CODEGENOPT(BranchTargetEnforcement, 1, 0) + +/// Whether to emit unused static constants. +CODEGENOPT(KeepStaticConsts, 1, 0) + +#undef CODEGENOPT +#undef ENUM_CODEGENOPT +#undef VALUE_CODEGENOPT + diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h new file mode 100644 index 00000000000..5f83915225f --- /dev/null +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -0,0 +1,327 @@ +//===--- CodeGenOptions.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the CodeGenOptions interface. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_BASIC_CODEGENOPTIONS_H +#define LLVM_CLANG_BASIC_CODEGENOPTIONS_H + +#include "clang/Basic/DebugInfoOptions.h" +#include "clang/Basic/Sanitizers.h" +#include "clang/Basic/XRayInstr.h" +#include "llvm/Support/CodeGen.h" +#include "llvm/Support/Regex.h" +#include "llvm/Target/TargetOptions.h" +#include +#include +#include +#include + +namespace clang { + +/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure +/// that this large collection of bitfields is a trivial class type. +class CodeGenOptionsBase { +public: +#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits; +#define ENUM_CODEGENOPT(Name, Type, Bits, Default) +#include "clang/Basic/CodeGenOptions.def" + +protected: +#define CODEGENOPT(Name, Bits, Default) +#define ENUM_CODEGENOPT(Name, Type, Bits, Default) unsigned Name : Bits; +#include "clang/Basic/CodeGenOptions.def" +}; + +/// CodeGenOptions - Track various options which control how the code +/// is optimized and passed to the backend. +class CodeGenOptions : public CodeGenOptionsBase { +public: + enum InliningMethod { + NormalInlining, // Use the standard function inlining pass. + OnlyHintInlining, // Inline only (implicitly) hinted functions. + OnlyAlwaysInlining // Only run the always inlining pass. + }; + + enum VectorLibrary { + NoLibrary, // Don't use any vector library. + Accelerate, // Use the Accelerate framework. + SVML // Intel short vector math library. + }; + + + enum ObjCDispatchMethodKind { + Legacy = 0, + NonLegacy = 1, + Mixed = 2 + }; + + enum TLSModel { + GeneralDynamicTLSModel, + LocalDynamicTLSModel, + InitialExecTLSModel, + LocalExecTLSModel + }; + + enum DwarfFissionKind { NoFission, SplitFileFission, SingleFileFission }; + + /// Clang versions with different platform ABI conformance. + enum class ClangABI { + /// Attempt to be ABI-compatible with code generated by Clang 3.8.x + /// (SVN r257626). This causes <1 x long long> to be passed in an + /// integer register instead of an SSE register on x64_64. + Ver3_8, + + /// Attempt to be ABI-compatible with code generated by Clang 4.0.x + /// (SVN r291814). This causes move operations to be ignored when + /// determining whether a class type can be passed or returned directly. + Ver4, + + /// Conform to the underlying platform's C and C++ ABIs as closely + /// as we can. + Latest + }; + + enum StructReturnConventionKind { + SRCK_Default, // No special option was passed. + SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return). + SRCK_InRegs // Small structs in registers (-freg-struct-return). + }; + + enum ProfileInstrKind { + ProfileNone, // Profile instrumentation is turned off. + ProfileClangInstr, // Clang instrumentation to generate execution counts + // to use with PGO. + ProfileIRInstr, // IR level PGO instrumentation in LLVM. + }; + + enum EmbedBitcodeKind { + Embed_Off, // No embedded bitcode. + Embed_All, // Embed both bitcode and commandline in the output. + Embed_Bitcode, // Embed just the bitcode in the output. + Embed_Marker // Embed a marker as a placeholder for bitcode. + }; + + enum SignReturnAddressScope { + None, // No signing for any function + NonLeaf, // Sign the return address of functions that spill LR + All // Sign the return address of all functions + }; + + enum SignReturnAddressKeyValue { AKey, BKey }; + + /// The code model to use (-mcmodel). + std::string CodeModel; + + /// The filename with path we use for coverage data files. The runtime + /// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP + /// environment variables. + std::string CoverageDataFile; + + /// The filename with path we use for coverage notes files. + std::string CoverageNotesFile; + + /// Regexes separated by a semi-colon to filter the files to instrument. + std::string ProfileFilterFiles; + + /// Regexes separated by a semi-colon to filter the files to not instrument. + std::string ProfileExcludeFiles; + + /// The version string to put into coverage files. + char CoverageVersion[4]; + + /// Enable additional debugging information. + std::string DebugPass; + + /// The string to embed in debug information as the current working directory. + std::string DebugCompilationDir; + + /// The string to embed in the debug information for the compile unit, if + /// non-empty. + std::string DwarfDebugFlags; + + std::map DebugPrefixMap; + + /// The ABI to use for passing floating point arguments. + std::string FloatABI; + + /// The floating-point denormal mode to use. + std::string FPDenormalMode; + + /// The float precision limit to use, if non-empty. + std::string LimitFloatPrecision; + + struct BitcodeFileToLink { + /// The filename of the bitcode file to link in. + std::string Filename; + /// If true, we set attributes functions in the bitcode library according to + /// our CodeGenOptions, much as we set attrs on functions that we generate + /// ourselves. + bool PropagateAttrs = false; + /// If true, we use LLVM module internalizer. + bool Internalize = false; + /// Bitwise combination of llvm::Linker::Flags, passed to the LLVM linker. + unsigned LinkFlags = 0; + }; + + /// The files specified here are linked in to the module before optimizations. + std::vector LinkBitcodeFiles; + + /// The user provided name for the "main file", if non-empty. This is useful + /// in situations where the input file name does not match the original input + /// file, for example with -save-temps. + std::string MainFileName; + + /// The name for the split debug info file that we'll break out. This is used + /// in the backend for setting the name in the skeleton cu. + std::string SplitDwarfFile; + + /// The name of the relocation model to use. + llvm::Reloc::Model RelocationModel; + + /// The thread model to use + std::string ThreadModel; + + /// If not an empty string, trap intrinsics are lowered to calls to this + /// function instead of to trap instructions. + std::string TrapFuncName; + + /// A list of dependent libraries. + std::vector DependentLibraries; + + /// A list of linker options to embed in the object file. + std::vector LinkerOptions; + + /// Name of the profile file to use as output for -fprofile-instr-generate + /// and -fprofile-generate. + std::string InstrProfileOutput; + + /// Name of the profile file to use with -fprofile-sample-use. + std::string SampleProfileFile; + + /// Name of the profile file to use as input for -fprofile-instr-use + std::string ProfileInstrumentUsePath; + + /// Name of the profile remapping file to apply to the profile data supplied + /// by -fprofile-sample-use or -fprofile-instr-use. + std::string ProfileRemappingFile; + + /// Name of the function summary index file to use for ThinLTO function + /// importing. + std::string ThinLTOIndexFile; + + /// Name of a file that can optionally be written with minimized bitcode + /// to be used as input for the ThinLTO thin link step, which only needs + /// the summary and module symbol table (and not, e.g. any debug metadata). + std::string ThinLinkBitcodeFile; + + /// Prefix to use for -save-temps output. + std::string SaveTempsFilePrefix; + + /// Name of file passed with -fcuda-include-gpubinary option to forward to + /// CUDA runtime back-end for incorporating them into host-side object file. + std::string CudaGpuBinaryFileName; + + /// The name of the file to which the backend should save YAML optimization + /// records. + std::string OptRecordFile; + + /// Regular expression to select optimizations for which we should enable + /// optimization remarks. Transformation passes whose name matches this + /// expression (and support this feature), will emit a diagnostic + /// whenever they perform a transformation. This is enabled by the + /// -Rpass=regexp flag. + std::shared_ptr OptimizationRemarkPattern; + + /// Regular expression to select optimizations for which we should enable + /// missed optimization remarks. Transformation passes whose name matches this + /// expression (and support this feature), will emit a diagnostic + /// whenever they tried but failed to perform a transformation. This is + /// enabled by the -Rpass-missed=regexp flag. + std::shared_ptr OptimizationRemarkMissedPattern; + + /// Regular expression to select optimizations for which we should enable + /// optimization analyses. Transformation passes whose name matches this + /// expression (and support this feature), will emit a diagnostic + /// whenever they want to explain why they decided to apply or not apply + /// a given transformation. This is enabled by the -Rpass-analysis=regexp + /// flag. + std::shared_ptr OptimizationRemarkAnalysisPattern; + + /// Set of files defining the rules for the symbol rewriting. + std::vector RewriteMapFiles; + + /// Set of sanitizer checks that are non-fatal (i.e. execution should be + /// continued when possible). + SanitizerSet SanitizeRecover; + + /// Set of sanitizer checks that trap rather than diagnose. + SanitizerSet SanitizeTrap; + + /// List of backend command-line options for -fembed-bitcode. + std::vector CmdArgs; + + /// A list of all -fno-builtin-* function names (e.g., memset). + std::vector NoBuiltinFuncs; + + std::vector Reciprocals; + + /// The preferred width for auto-vectorization transforms. This is intended to + /// override default transforms based on the width of the architected vector + /// registers. + std::string PreferVectorWidth; + + /// Set of XRay instrumentation kinds to emit. + XRayInstrSet XRayInstrumentationBundle; + +public: + // Define accessors/mutators for code generation options of enumeration type. +#define CODEGENOPT(Name, Bits, Default) +#define ENUM_CODEGENOPT(Name, Type, Bits, Default) \ + Type get##Name() const { return static_cast(Name); } \ + void set##Name(Type Value) { Name = static_cast(Value); } +#include "clang/Basic/CodeGenOptions.def" + + CodeGenOptions(); + + /// Is this a libc/libm function that is no longer recognized as a + /// builtin because a -fno-builtin-* option has been specified? + bool isNoBuiltinFunc(const char *Name) const; + + const std::vector &getNoBuiltinFuncs() const { + return NoBuiltinFuncs; + } + + /// Check if Clang profile instrumenation is on. + bool hasProfileClangInstr() const { + return getProfileInstr() == ProfileClangInstr; + } + + /// Check if IR level profile instrumentation is on. + bool hasProfileIRInstr() const { + return getProfileInstr() == ProfileIRInstr; + } + + /// Check if Clang profile use is on. + bool hasProfileClangUse() const { + return getProfileUse() == ProfileClangInstr; + } + + /// Check if IR level profile use is on. + bool hasProfileIRUse() const { + return getProfileUse() == ProfileIRInstr; + } + +}; + +} // end namespace clang + +#endif diff --git a/clang/include/clang/Frontend/CodeGenOptions.def b/clang/include/clang/Frontend/CodeGenOptions.def deleted file mode 100644 index 952aa588b60..00000000000 --- a/clang/include/clang/Frontend/CodeGenOptions.def +++ /dev/null @@ -1,366 +0,0 @@ -//===--- CodeGenOptions.def - Code generation option database ----- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the code generation options. Users of this file -// must define the CODEGENOPT macro to make use of this information. -// Optionally, the user may also define ENUM_CODEGENOPT (for options -// that have enumeration type and VALUE_CODEGENOPT is a code -// generation option that describes a value rather than a flag. -// -//===----------------------------------------------------------------------===// -#ifndef CODEGENOPT -# error Define the CODEGENOPT macro to handle language options -#endif - -#ifndef VALUE_CODEGENOPT -# define VALUE_CODEGENOPT(Name, Bits, Default) \ -CODEGENOPT(Name, Bits, Default) -#endif - -#ifndef ENUM_CODEGENOPT -# define ENUM_CODEGENOPT(Name, Type, Bits, Default) \ -CODEGENOPT(Name, Bits, Default) -#endif - -CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as -ENUM_CODEGENOPT(CompressDebugSections, llvm::DebugCompressionType, 2, - llvm::DebugCompressionType::None) -CODEGENOPT(RelaxELFRelocations, 1, 0) ///< -Wa,--mrelax-relocations -CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm. -CODEGENOPT(PreserveAsmComments, 1, 1) ///< -dA, -fno-preserve-as-comments. -CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new -CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink -CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe. -CODEGENOPT(Backchain , 1, 0) ///< -mbackchain -CODEGENOPT(ControlFlowGuard , 1, 0) ///< -cfguard -CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files. -CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files. -CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit block before the body blocks in GCNO files. -CODEGENOPT(CXAAtExit , 1, 1) ///< Use __cxa_atexit for calling destructors. -CODEGENOPT(RegisterGlobalDtorsWithAtExit, 1, 1) ///< Use atexit or __cxa_atexit to register global destructors. -CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///< Emit complete ctors/dtors as linker - ///< aliases to base ctors when possible. -CODEGENOPT(DataSections , 1, 0) ///< Set when -fdata-sections is enabled. -CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names. -CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is enabled. -CODEGENOPT(DisableFree , 1, 0) ///< Don't free memory. -CODEGENOPT(DiscardValueNames , 1, 0) ///< Discard Value Names from the IR (LLVMContext flag) -CODEGENOPT(DisableGCov , 1, 0) ///< Don't run the GCov pass, for testing. -CODEGENOPT(DisableLLVMPasses , 1, 0) ///< Don't run any LLVM IR passes to get - ///< the pristine IR generated by the - ///< frontend. -CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any lifetime markers -CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with optnone at O0 -CODEGENOPT(ExperimentalNewPassManager, 1, 0) ///< Enables the new, experimental - ///< pass manager. -CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new - ///< pass manager. -CODEGENOPT(DisableRedZone , 1, 0) ///< Set when -mno-red-zone is enabled. -CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs - ///< is specified. -CODEGENOPT(DisableTailCalls , 1, 0) ///< Do not emit tail calls. -CODEGENOPT(NoEscapingBlockTailCalls, 1, 0) ///< Do not emit tail calls from - ///< escaping blocks. -CODEGENOPT(EmitDeclMetadata , 1, 0) ///< Emit special metadata indicating what - ///< Decl* various IR entities came from. - ///< Only useful when running CodeGen as a - ///< subroutine. -CODEGENOPT(EmitVersionIdentMetadata , 1, 1) ///< Emit compiler version metadata. -CODEGENOPT(EmitGcovArcs , 1, 0) ///< Emit coverage data files, aka. GCDA. -CODEGENOPT(EmitGcovNotes , 1, 0) ///< Emit coverage "notes" files, aka GCNO. -CODEGENOPT(EmitOpenCLArgMetadata , 1, 0) ///< Emit OpenCL kernel arg metadata. -CODEGENOPT(EmulatedTLS , 1, 0) ///< Set by default or -f[no-]emulated-tls. -CODEGENOPT(ExplicitEmulatedTLS , 1, 0) ///< Set if -f[no-]emulated-tls is used. -/// Embed Bitcode mode (off/all/bitcode/marker). -ENUM_CODEGENOPT(EmbedBitcode, EmbedBitcodeKind, 2, Embed_Off) -CODEGENOPT(ForbidGuardVariables , 1, 0) ///< Issue errors if C++ guard variables - ///< are required. -CODEGENOPT(FunctionSections , 1, 0) ///< Set when -ffunction-sections is enabled. -CODEGENOPT(InstrumentFunctions , 1, 0) ///< Set when -finstrument-functions is - ///< enabled. -CODEGENOPT(InstrumentFunctionsAfterInlining , 1, 0) ///< Set when - ///< -finstrument-functions-after-inlining is enabled. -CODEGENOPT(InstrumentFunctionEntryBare , 1, 0) ///< Set when - ///< -finstrument-function-entry-bare is enabled. -CODEGENOPT(CFProtectionReturn , 1, 0) ///< if -fcf-protection is - ///< set to full or return. -CODEGENOPT(CFProtectionBranch , 1, 0) ///< if -fcf-protection is - ///< set to full or branch. -CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is - ///< enabled. -CODEGENOPT(StackSizeSection , 1, 0) ///< Set when -fstack-size-section is enabled. - -///< Set when -fxray-always-emit-customevents is enabled. -CODEGENOPT(XRayAlwaysEmitCustomEvents , 1, 0) - -///< Set when -fxray-always-emit-typedevents is enabled. -CODEGENOPT(XRayAlwaysEmitTypedEvents , 1, 0) - -///< Set the minimum number of instructions in a function to determine selective -///< XRay instrumentation. -VALUE_CODEGENOPT(XRayInstructionThreshold , 32, 200) - -CODEGENOPT(InstrumentForProfiling , 1, 0) ///< Set when -pg is enabled. -CODEGENOPT(CallFEntry , 1, 0) ///< Set when -mfentry is enabled. -CODEGENOPT(LessPreciseFPMAD , 1, 0) ///< Enable less precise MAD instructions to - ///< be generated. -CODEGENOPT(PrepareForLTO , 1, 0) ///< Set when -flto is enabled on the - ///< compile step. -CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the - ///< compile step. -CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole - ///< program vtable opt). -CODEGENOPT(IncrementalLinkerCompatible, 1, 0) ///< Emit an object file which can - ///< be used with an incremental - ///< linker. -CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants. -CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled. -CODEGENOPT(MSVolatile , 1, 0) ///< Set when /volatile:ms is enabled. -CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled. -CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is - ///< enabled. -CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled. -CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is - ///< enabled. -CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled. -CODEGENOPT(NoImplicitFloat , 1, 0) ///< Set when -mno-implicit-float is enabled. -CODEGENOPT(NoInfsFPMath , 1, 0) ///< Assume FP arguments, results not +-Inf. -CODEGENOPT(NoSignedZeros , 1, 0) ///< Allow ignoring the signedness of FP zero -CODEGENOPT(NullPointerIsValid , 1, 0) ///< Assume Null pointer deference is defined. -CODEGENOPT(Reassociate , 1, 0) ///< Allow reassociation of FP math ops -CODEGENOPT(ReciprocalMath , 1, 0) ///< Allow FP divisions to be reassociated. -CODEGENOPT(NoTrappingMath , 1, 0) ///< Set when -fno-trapping-math is enabled. -CODEGENOPT(NoNaNsFPMath , 1, 0) ///< Assume FP arguments, results not NaN. -CODEGENOPT(FlushDenorm , 1, 0) ///< Allow FP denorm numbers to be flushed to zero -CODEGENOPT(CorrectlyRoundedDivSqrt, 1, 0) ///< -cl-fp32-correctly-rounded-divide-sqrt - -/// When false, this attempts to generate code as if the result of an -/// overflowing conversion matches the overflowing behavior of a target's native -/// float-to-int conversion instructions. -CODEGENOPT(StrictFloatCastOverflow, 1, 1) - -CODEGENOPT(UniformWGSize , 1, 0) ///< -cl-uniform-work-group-size -CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-zero-initialized-in-bss. -/// Method of Objective-C dispatch to use. -ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy) -/// Replace certain message sends with calls to ObjC runtime entrypoints -CODEGENOPT(ObjCConvertMessagesToRuntimeCalls , 1, 1) -CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is - ///< enabled. - -VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified. -VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified. - -/// Choose profile instrumenation kind or no instrumentation. -ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 2, ProfileNone) -/// Choose profile kind for PGO use compilation. -ENUM_CODEGENOPT(ProfileUse, ProfileInstrKind, 2, ProfileNone) -CODEGENOPT(CoverageMapping , 1, 0) ///< Generate coverage mapping regions to - ///< enable code coverage analysis. -CODEGENOPT(DumpCoverageMapping , 1, 0) ///< Dump the generated coverage mapping - ///< regions. - - /// If -fpcc-struct-return or -freg-struct-return is specified. -ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Default) - -CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions. -CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled. -CODEGENOPT(StructPathTBAA , 1, 0) ///< Whether or not to use struct-path TBAA. -CODEGENOPT(NewStructPathTBAA , 1, 0) ///< Whether or not to use enhanced struct-path TBAA. -CODEGENOPT(SaveTempLabels , 1, 0) ///< Save temporary labels. -CODEGENOPT(SanitizeAddressUseAfterScope , 1, 0) ///< Enable use-after-scope detection - ///< in AddressSanitizer -CODEGENOPT(SanitizeAddressPoisonCustomArrayCookie, 1, - 0) ///< Enable poisoning operator new[] which is not a replaceable - ///< global allocation function in AddressSanitizer -CODEGENOPT(SanitizeAddressGlobalsDeadStripping, 1, 0) ///< Enable linker dead stripping - ///< of globals in AddressSanitizer -CODEGENOPT(SanitizeAddressUseOdrIndicator, 1, 0) ///< Enable ODR indicator globals -CODEGENOPT(SanitizeMemoryTrackOrigins, 2, 0) ///< Enable tracking origins in - ///< MemorySanitizer -CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete detection - ///< in MemorySanitizer -CODEGENOPT(SanitizeCfiCrossDso, 1, 0) ///< Enable cross-dso support in CFI. -CODEGENOPT(SanitizeMinimalRuntime, 1, 0) ///< Use "_minimal" sanitizer runtime for - ///< diagnostics. -CODEGENOPT(SanitizeCfiICallGeneralizePointers, 1, 0) ///< Generalize pointer types in - ///< CFI icall function signatures -CODEGENOPT(SanitizeCoverageType, 2, 0) ///< Type of sanitizer coverage - ///< instrumentation. -CODEGENOPT(SanitizeCoverageIndirectCalls, 1, 0) ///< Enable sanitizer coverage - ///< for indirect calls. -CODEGENOPT(SanitizeCoverageTraceBB, 1, 0) ///< Enable basic block tracing in - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageTraceCmp, 1, 0) ///< Enable cmp instruction tracing - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageTraceDiv, 1, 0) ///< Enable div instruction tracing - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageTraceGep, 1, 0) ///< Enable GEP instruction tracing - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverage8bitCounters, 1, 0) ///< Use 8-bit frequency counters - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageTracePC, 1, 0) ///< Enable PC tracing - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageTracePCGuard, 1, 0) ///< Enable PC tracing with guard - ///< in sanitizer coverage. -CODEGENOPT(SanitizeCoverageInline8bitCounters, 1, 0) ///< Use inline 8bit counters. -CODEGENOPT(SanitizeCoveragePCTable, 1, 0) ///< Create a PC Table. -CODEGENOPT(SanitizeCoverageNoPrune, 1, 0) ///< Disable coverage pruning. -CODEGENOPT(SanitizeCoverageStackDepth, 1, 0) ///< Enable max stack depth tracing -CODEGENOPT(SanitizeStats , 1, 0) ///< Collect statistics for sanitizers. -CODEGENOPT(SimplifyLibCalls , 1, 1) ///< Set when -fbuiltin is enabled. -CODEGENOPT(SoftFloat , 1, 0) ///< -soft-float. -CODEGENOPT(SpeculativeLoadHardening, 1, 0) ///< Enable speculative load hardening. -CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable fine-grained bitfield accesses. -CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition. -CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers -CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report is enabled. -CODEGENOPT(UnrollLoops , 1, 0) ///< Control whether loops are unrolled. -CODEGENOPT(RerollLoops , 1, 0) ///< Control whether loops are rerolled. -CODEGENOPT(NoUseJumpTables , 1, 0) ///< Set when -fno-jump-tables is enabled. -CODEGENOPT(UnsafeFPMath , 1, 0) ///< Allow unsafe floating point optzns. -CODEGENOPT(UnwindTables , 1, 0) ///< Emit unwind tables. -CODEGENOPT(VectorizeLoop , 1, 0) ///< Run loop vectorizer. -CODEGENOPT(VectorizeSLP , 1, 0) ///< Run SLP vectorizer. -CODEGENOPT(ProfileSampleAccurate, 1, 0) ///< Sample profile is accurate. - - /// Attempt to use register sized accesses to bit-fields in structures, when - /// possible. -CODEGENOPT(UseRegisterSizedBitfieldAccess , 1, 0) - -CODEGENOPT(VerifyModule , 1, 1) ///< Control whether the module should be run - ///< through the LLVM Verifier. - -CODEGENOPT(StackRealignment , 1, 0) ///< Control whether to force stack - ///< realignment. -CODEGENOPT(UseInitArray , 1, 0) ///< Control whether to use .init_array or - ///< .ctors. -VALUE_CODEGENOPT(StackAlignment , 32, 0) ///< Overrides default stack - ///< alignment, if not 0. -VALUE_CODEGENOPT(StackProbeSize , 32, 4096) ///< Overrides default stack - ///< probe size, even if 0. -CODEGENOPT(NoStackArgProbe, 1, 0) ///< Set when -mno-stack-arg-probe is used -CODEGENOPT(DebugColumnInfo, 1, 0) ///< Whether or not to use column information - ///< in debug info. - -CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain - ///< external references to a PCH or module. - -CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should - ///< contain explicit imports for - ///< anonymous namespaces - -ENUM_CODEGENOPT(SplitDwarfMode, DwarfFissionKind, 2, NoFission) ///< DWARF fission mode to use. - -CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the - ///< skeleton CU to allow for symbolication - ///< of inline stack frames without .dwo files. -CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///< Whether to emit complete - ///< template parameter descriptions in - ///< forward declarations (versus just - ///< including them in the name). - -CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. - -CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program - /// vtable optimization. - -/// Whether to use public LTO visibility for entities in std and stdext -/// namespaces. This is enabled by clang-cl's /MT and /MTd flags. -CODEGENOPT(LTOVisibilityPublicStd, 1, 0) - -/// The user specified number of registers to be used for integral arguments, -/// or 0 if unspecified. -VALUE_CODEGENOPT(NumRegisterParameters, 32, 0) - -/// The lower bound for a buffer to be considered for stack protection. -VALUE_CODEGENOPT(SSPBufferSize, 32, 0) - -/// The kind of generated debug info. -ENUM_CODEGENOPT(DebugInfo, codegenoptions::DebugInfoKind, 3, codegenoptions::NoDebugInfo) - -/// Whether to generate macro debug info. -CODEGENOPT(MacroDebugInfo, 1, 0) - -/// Tune the debug info for this debugger. -ENUM_CODEGENOPT(DebuggerTuning, llvm::DebuggerKind, 2, - llvm::DebuggerKind::Default) - -/// Dwarf version. Version zero indicates to LLVM that no DWARF should be -/// emitted. -VALUE_CODEGENOPT(DwarfVersion, 3, 0) - -/// Whether we should emit CodeView debug information. It's possible to emit -/// CodeView and DWARF into the same object. -CODEGENOPT(EmitCodeView, 1, 0) - -/// Whether to emit the .debug$H section containing hashes of CodeView types. -CODEGENOPT(CodeViewGHash, 1, 0) - -/// The kind of inlining to perform. -ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining) - -// Vector functions library to use. -ENUM_CODEGENOPT(VecLib, VectorLibrary, 2, NoLibrary) - -/// The default TLS model to use. -ENUM_CODEGENOPT(DefaultTLSModel, TLSModel, 2, GeneralDynamicTLSModel) - -/// Number of path components to strip when emitting checks. (0 == full -/// filename) -VALUE_CODEGENOPT(EmitCheckPathComponentsToStrip, 32, 0) - -/// Whether to report the hotness of the code region for optimization remarks. -CODEGENOPT(DiagnosticsWithHotness, 1, 0) - -/// The minimum hotness value a diagnostic needs in order to be included in -/// optimization diagnostics. -VALUE_CODEGENOPT(DiagnosticsHotnessThreshold, 32, 0) - -/// Whether copy relocations support is available when building as PIE. -CODEGENOPT(PIECopyRelocations, 1, 0) - -/// Whether we should use the undefined behaviour optimization for control flow -/// paths that reach the end of a function without executing a required return. -CODEGENOPT(StrictReturn, 1, 1) - -/// Whether emit extra debug info for sample pgo profile collection. -CODEGENOPT(DebugInfoForProfiling, 1, 0) - -/// Whether 3-component vector type is preserved. -CODEGENOPT(PreserveVec3Type, 1, 0) - -/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames. -CODEGENOPT(DebugNameTable, 2, 0) - -/// Whether to use DWARF base address specifiers in .debug_ranges. -CODEGENOPT(DebugRangesBaseAddress, 1, 0) - -CODEGENOPT(NoPLT, 1, 0) - -/// Whether to embed source in DWARF debug line section. -CODEGENOPT(EmbedSource, 1, 0) - -/// Whether to emit all vtables -CODEGENOPT(ForceEmitVTables, 1, 0) - -/// Whether to emit an address-significance table into the object file. -CODEGENOPT(Addrsig, 1, 0) - -ENUM_CODEGENOPT(SignReturnAddress, SignReturnAddressScope, 2, None) -ENUM_CODEGENOPT(SignReturnAddressKey, SignReturnAddressKeyValue, 1, AKey) -CODEGENOPT(BranchTargetEnforcement, 1, 0) - -/// Whether to emit unused static constants. -CODEGENOPT(KeepStaticConsts, 1, 0) - -#undef CODEGENOPT -#undef ENUM_CODEGENOPT -#undef VALUE_CODEGENOPT - diff --git a/clang/include/clang/Frontend/CodeGenOptions.h b/clang/include/clang/Frontend/CodeGenOptions.h deleted file mode 100644 index caa7626614a..00000000000 --- a/clang/include/clang/Frontend/CodeGenOptions.h +++ /dev/null @@ -1,327 +0,0 @@ -//===--- CodeGenOptions.h ---------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the CodeGenOptions interface. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H -#define LLVM_CLANG_FRONTEND_CODEGENOPTIONS_H - -#include "clang/Basic/DebugInfoOptions.h" -#include "clang/Basic/Sanitizers.h" -#include "clang/Basic/XRayInstr.h" -#include "llvm/Support/CodeGen.h" -#include "llvm/Support/Regex.h" -#include "llvm/Target/TargetOptions.h" -#include -#include -#include -#include - -namespace clang { - -/// Bitfields of CodeGenOptions, split out from CodeGenOptions to ensure -/// that this large collection of bitfields is a trivial class type. -class CodeGenOptionsBase { -public: -#define CODEGENOPT(Name, Bits, Default) unsigned Name : Bits; -#define ENUM_CODEGENOPT(Name, Type, Bits, Default) -#include "clang/Frontend/CodeGenOptions.def" - -protected: -#define CODEGENOPT(Name, Bits, Default) -#define ENUM_CODEGENOPT(Name, Type, Bits, Default) unsigned Name : Bits; -#include "clang/Frontend/CodeGenOptions.def" -}; - -/// CodeGenOptions - Track various options which control how the code -/// is optimized and passed to the backend. -class CodeGenOptions : public CodeGenOptionsBase { -public: - enum InliningMethod { - NormalInlining, // Use the standard function inlining pass. - OnlyHintInlining, // Inline only (implicitly) hinted functions. - OnlyAlwaysInlining // Only run the always inlining pass. - }; - - enum VectorLibrary { - NoLibrary, // Don't use any vector library. - Accelerate, // Use the Accelerate framework. - SVML // Intel short vector math library. - }; - - - enum ObjCDispatchMethodKind { - Legacy = 0, - NonLegacy = 1, - Mixed = 2 - }; - - enum TLSModel { - GeneralDynamicTLSModel, - LocalDynamicTLSModel, - InitialExecTLSModel, - LocalExecTLSModel - }; - - enum DwarfFissionKind { NoFission, SplitFileFission, SingleFileFission }; - - /// Clang versions with different platform ABI conformance. - enum class ClangABI { - /// Attempt to be ABI-compatible with code generated by Clang 3.8.x - /// (SVN r257626). This causes <1 x long long> to be passed in an - /// integer register instead of an SSE register on x64_64. - Ver3_8, - - /// Attempt to be ABI-compatible with code generated by Clang 4.0.x - /// (SVN r291814). This causes move operations to be ignored when - /// determining whether a class type can be passed or returned directly. - Ver4, - - /// Conform to the underlying platform's C and C++ ABIs as closely - /// as we can. - Latest - }; - - enum StructReturnConventionKind { - SRCK_Default, // No special option was passed. - SRCK_OnStack, // Small structs on the stack (-fpcc-struct-return). - SRCK_InRegs // Small structs in registers (-freg-struct-return). - }; - - enum ProfileInstrKind { - ProfileNone, // Profile instrumentation is turned off. - ProfileClangInstr, // Clang instrumentation to generate execution counts - // to use with PGO. - ProfileIRInstr, // IR level PGO instrumentation in LLVM. - }; - - enum EmbedBitcodeKind { - Embed_Off, // No embedded bitcode. - Embed_All, // Embed both bitcode and commandline in the output. - Embed_Bitcode, // Embed just the bitcode in the output. - Embed_Marker // Embed a marker as a placeholder for bitcode. - }; - - enum SignReturnAddressScope { - None, // No signing for any function - NonLeaf, // Sign the return address of functions that spill LR - All // Sign the return address of all functions - }; - - enum SignReturnAddressKeyValue { AKey, BKey }; - - /// The code model to use (-mcmodel). - std::string CodeModel; - - /// The filename with path we use for coverage data files. The runtime - /// allows further manipulation with the GCOV_PREFIX and GCOV_PREFIX_STRIP - /// environment variables. - std::string CoverageDataFile; - - /// The filename with path we use for coverage notes files. - std::string CoverageNotesFile; - - /// Regexes separated by a semi-colon to filter the files to instrument. - std::string ProfileFilterFiles; - - /// Regexes separated by a semi-colon to filter the files to not instrument. - std::string ProfileExcludeFiles; - - /// The version string to put into coverage files. - char CoverageVersion[4]; - - /// Enable additional debugging information. - std::string DebugPass; - - /// The string to embed in debug information as the current working directory. - std::string DebugCompilationDir; - - /// The string to embed in the debug information for the compile unit, if - /// non-empty. - std::string DwarfDebugFlags; - - std::map DebugPrefixMap; - - /// The ABI to use for passing floating point arguments. - std::string FloatABI; - - /// The floating-point denormal mode to use. - std::string FPDenormalMode; - - /// The float precision limit to use, if non-empty. - std::string LimitFloatPrecision; - - struct BitcodeFileToLink { - /// The filename of the bitcode file to link in. - std::string Filename; - /// If true, we set attributes functions in the bitcode library according to - /// our CodeGenOptions, much as we set attrs on functions that we generate - /// ourselves. - bool PropagateAttrs = false; - /// If true, we use LLVM module internalizer. - bool Internalize = false; - /// Bitwise combination of llvm::Linker::Flags, passed to the LLVM linker. - unsigned LinkFlags = 0; - }; - - /// The files specified here are linked in to the module before optimizations. - std::vector LinkBitcodeFiles; - - /// The user provided name for the "main file", if non-empty. This is useful - /// in situations where the input file name does not match the original input - /// file, for example with -save-temps. - std::string MainFileName; - - /// The name for the split debug info file that we'll break out. This is used - /// in the backend for setting the name in the skeleton cu. - std::string SplitDwarfFile; - - /// The name of the relocation model to use. - llvm::Reloc::Model RelocationModel; - - /// The thread model to use - std::string ThreadModel; - - /// If not an empty string, trap intrinsics are lowered to calls to this - /// function instead of to trap instructions. - std::string TrapFuncName; - - /// A list of dependent libraries. - std::vector DependentLibraries; - - /// A list of linker options to embed in the object file. - std::vector LinkerOptions; - - /// Name of the profile file to use as output for -fprofile-instr-generate - /// and -fprofile-generate. - std::string InstrProfileOutput; - - /// Name of the profile file to use with -fprofile-sample-use. - std::string SampleProfileFile; - - /// Name of the profile file to use as input for -fprofile-instr-use - std::string ProfileInstrumentUsePath; - - /// Name of the profile remapping file to apply to the profile data supplied - /// by -fprofile-sample-use or -fprofile-instr-use. - std::string ProfileRemappingFile; - - /// Name of the function summary index file to use for ThinLTO function - /// importing. - std::string ThinLTOIndexFile; - - /// Name of a file that can optionally be written with minimized bitcode - /// to be used as input for the ThinLTO thin link step, which only needs - /// the summary and module symbol table (and not, e.g. any debug metadata). - std::string ThinLinkBitcodeFile; - - /// Prefix to use for -save-temps output. - std::string SaveTempsFilePrefix; - - /// Name of file passed with -fcuda-include-gpubinary option to forward to - /// CUDA runtime back-end for incorporating them into host-side object file. - std::string CudaGpuBinaryFileName; - - /// The name of the file to which the backend should save YAML optimization - /// records. - std::string OptRecordFile; - - /// Regular expression to select optimizations for which we should enable - /// optimization remarks. Transformation passes whose name matches this - /// expression (and support this feature), will emit a diagnostic - /// whenever they perform a transformation. This is enabled by the - /// -Rpass=regexp flag. - std::shared_ptr OptimizationRemarkPattern; - - /// Regular expression to select optimizations for which we should enable - /// missed optimization remarks. Transformation passes whose name matches this - /// expression (and support this feature), will emit a diagnostic - /// whenever they tried but failed to perform a transformation. This is - /// enabled by the -Rpass-missed=regexp flag. - std::shared_ptr OptimizationRemarkMissedPattern; - - /// Regular expression to select optimizations for which we should enable - /// optimization analyses. Transformation passes whose name matches this - /// expression (and support this feature), will emit a diagnostic - /// whenever they want to explain why they decided to apply or not apply - /// a given transformation. This is enabled by the -Rpass-analysis=regexp - /// flag. - std::shared_ptr OptimizationRemarkAnalysisPattern; - - /// Set of files defining the rules for the symbol rewriting. - std::vector RewriteMapFiles; - - /// Set of sanitizer checks that are non-fatal (i.e. execution should be - /// continued when possible). - SanitizerSet SanitizeRecover; - - /// Set of sanitizer checks that trap rather than diagnose. - SanitizerSet SanitizeTrap; - - /// List of backend command-line options for -fembed-bitcode. - std::vector CmdArgs; - - /// A list of all -fno-builtin-* function names (e.g., memset). - std::vector NoBuiltinFuncs; - - std::vector Reciprocals; - - /// The preferred width for auto-vectorization transforms. This is intended to - /// override default transforms based on the width of the architected vector - /// registers. - std::string PreferVectorWidth; - - /// Set of XRay instrumentation kinds to emit. - XRayInstrSet XRayInstrumentationBundle; - -public: - // Define accessors/mutators for code generation options of enumeration type. -#define CODEGENOPT(Name, Bits, Default) -#define ENUM_CODEGENOPT(Name, Type, Bits, Default) \ - Type get##Name() const { return static_cast(Name); } \ - void set##Name(Type Value) { Name = static_cast(Value); } -#include "clang/Frontend/CodeGenOptions.def" - - CodeGenOptions(); - - /// Is this a libc/libm function that is no longer recognized as a - /// builtin because a -fno-builtin-* option has been specified? - bool isNoBuiltinFunc(const char *Name) const; - - const std::vector &getNoBuiltinFuncs() const { - return NoBuiltinFuncs; - } - - /// Check if Clang profile instrumenation is on. - bool hasProfileClangInstr() const { - return getProfileInstr() == ProfileClangInstr; - } - - /// Check if IR level profile instrumentation is on. - bool hasProfileIRInstr() const { - return getProfileInstr() == ProfileIRInstr; - } - - /// Check if Clang profile use is on. - bool hasProfileClangUse() const { - return getProfileUse() == ProfileClangInstr; - } - - /// Check if IR level profile use is on. - bool hasProfileIRUse() const { - return getProfileUse() == ProfileIRInstr; - } - -}; - -} // end namespace clang - -#endif diff --git a/clang/include/clang/Frontend/CompilerInvocation.h b/clang/include/clang/Frontend/CompilerInvocation.h index c2f3a43e15f..a1874655b04 100644 --- a/clang/include/clang/Frontend/CompilerInvocation.h +++ b/clang/include/clang/Frontend/CompilerInvocation.h @@ -10,11 +10,11 @@ #ifndef LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/DiagnosticOptions.h" #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/LangOptions.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/DependencyOutputOptions.h" #include "clang/Frontend/FrontendOptions.h" #include "clang/Frontend/LangStandard.h" diff --git a/clang/include/clang/module.modulemap b/clang/include/clang/module.modulemap index b9ffb46ba1c..1f6eacca1fe 100644 --- a/clang/include/clang/module.modulemap +++ b/clang/include/clang/module.modulemap @@ -47,6 +47,7 @@ module Clang_Basic { textual header "Basic/BuiltinsX86.def" textual header "Basic/BuiltinsX86_64.def" textual header "Basic/BuiltinsXCore.def" + textual header "Basic/CodeGenOptions.def" textual header "Basic/DiagnosticOptions.def" textual header "Basic/Features.def" textual header "Basic/LangOptions.def" @@ -107,14 +108,6 @@ module Clang_Frontend { exclude header "Frontend/PCHContainerOperations.h" } -// Used in clangBasic -module Clang_Frontend_CodeGenOptions { - requires cplusplus - header "Frontend/CodeGenOptions.h" - textual header "Frontend/CodeGenOptions.def" - export * -} - module Clang_FrontendTool { requires cplusplus umbrella "FrontendTool" module * { export * } } module Clang_Index { requires cplusplus umbrella "Index" module * { export * } } module Clang_Lex { requires cplusplus umbrella "Lex" module * { export * } } diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt index fe843569a41..0015ede7420 100644 --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -48,6 +48,7 @@ add_clang_library(clangBasic Attributes.cpp Builtins.cpp CharInfo.cpp + CodeGenOptions.cpp Cuda.cpp Diagnostic.cpp DiagnosticIDs.cpp diff --git a/clang/lib/Basic/CodeGenOptions.cpp b/clang/lib/Basic/CodeGenOptions.cpp new file mode 100644 index 00000000000..aface1cd4bf --- /dev/null +++ b/clang/lib/Basic/CodeGenOptions.cpp @@ -0,0 +1,32 @@ +//===--- CodeGenOptions.cpp -----------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "clang/Basic/CodeGenOptions.h" +#include + +namespace clang { + +CodeGenOptions::CodeGenOptions() { +#define CODEGENOPT(Name, Bits, Default) Name = Default; +#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default); +#include "clang/Basic/CodeGenOptions.def" + + RelocationModel = llvm::Reloc::PIC_; + memcpy(CoverageVersion, "402*", 4); +} + +bool CodeGenOptions::isNoBuiltinFunc(const char *Name) const { + StringRef FuncName(Name); + for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i) + if (FuncName.equals(NoBuiltinFuncs[i])) + return true; + return false; +} + +} // end namespace clang diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp index 3851cdacfdd..4f17b17ff40 100644 --- a/clang/lib/Basic/Targets/AMDGPU.cpp +++ b/clang/lib/Basic/Targets/AMDGPU.cpp @@ -13,10 +13,10 @@ #include "AMDGPU.h" #include "clang/Basic/Builtins.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/MacroBuilder.h" #include "clang/Basic/TargetBuiltins.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringSwitch.h" using namespace clang; diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 38d9a529869..52fc08de9b6 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -8,10 +8,10 @@ //===----------------------------------------------------------------------===// #include "clang/CodeGen/BackendUtil.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/TargetOptions.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/Utils.h" #include "clang/Lex/HeaderSearchOptions.h" diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 4e524b047a8..8b0733fbec3 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -23,7 +23,7 @@ #include "clang/AST/Mangle.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtCXX.h" -#include "clang/Frontend/CodeGenOptions.h" +#include "clang/Basic/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" using namespace clang; using namespace CodeGen; diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 2fddc4bd99d..4757cd2ffae 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -23,11 +23,11 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/TargetBuiltins.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/CGFunctionInfo.h" #include "clang/CodeGen/SwiftCallingConv.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Analysis/ValueTracking.h" diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index ade03686665..28ae5559b2d 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -21,9 +21,9 @@ #include "clang/AST/EvaluatedExprVisitor.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtCXX.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/TargetBuiltins.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Metadata.h" #include "llvm/Transforms/Utils/SanitizerStats.h" diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c556996be09..9a6204b5bda 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -25,10 +25,10 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/RecordLayout.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/Version.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/FrontendOptions.h" #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/ModuleMap.h" diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index adb8977c214..8f29e27e605 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -20,8 +20,8 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Type.h" #include "clang/AST/TypeOrdering.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/SourceLocation.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index b36b328ad47..f4fef45a124 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -26,10 +26,10 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclOpenMP.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/GlobalVariable.h" diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 2884f138719..08ceaa99002 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -15,7 +15,7 @@ #include "CGCXXABI.h" #include "CGObjCRuntime.h" #include "CGOpenMPRuntime.h" -#include "clang/Frontend/CodeGenOptions.h" +#include "clang/Basic/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/MDBuilder.h" diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 17a75c0bb1e..3c5eea49d1a 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -26,7 +26,7 @@ #include "clang/AST/Attr.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/NSAPI.h" -#include "clang/Frontend/CodeGenOptions.h" +#include "clang/Basic/CodeGenOptions.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringExtras.h" #include "llvm/IR/DataLayout.h" diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 842ca24bc3a..2e0d4ca7679 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -17,8 +17,8 @@ #include "CGDebugInfo.h" #include "CGObjCRuntime.h" #include "ConstantEmitter.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/Intrinsics.h" diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 4980f53cc4d..f53bb33e463 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -23,9 +23,9 @@ #include "clang/AST/Expr.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtVisitor.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/FixedPoint.h" #include "clang/Basic/TargetInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/Optional.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index fffa62d7d23..d91eb43ca32 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -23,9 +23,9 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/RecordLayout.h" #include "clang/AST/StmtObjC.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/LangOptions.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index 58aaae69255..c754541ac12 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -20,7 +20,7 @@ #include "clang/AST/DeclCXX.h" #include "clang/AST/Expr.h" #include "clang/AST/RecordLayout.h" -#include "clang/Frontend/CodeGenOptions.h" +#include "clang/Basic/CodeGenOptions.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Type.h" diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 83466f7f0f0..09535900b54 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -16,9 +16,9 @@ #include "CodeGenModule.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/RecordLayout.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/CodeGen/CGFunctionInfo.h" #include "clang/CodeGen/ConstantInitBuilder.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/Support/Format.h" #include "llvm/Transforms/Utils/Cloning.h" diff --git a/clang/lib/CodeGen/CodeGenABITypes.cpp b/clang/lib/CodeGen/CodeGenABITypes.cpp index c152291b15b..27f5d53ffe1 100644 --- a/clang/lib/CodeGen/CodeGenABITypes.cpp +++ b/clang/lib/CodeGen/CodeGenABITypes.cpp @@ -20,7 +20,6 @@ #include "CGRecordLayout.h" #include "CodeGenModule.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Lex/HeaderSearchOptions.h" #include "clang/Lex/PreprocessorOptions.h" diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index da8f327efa7..905e7501e01 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -28,9 +28,9 @@ #include "clang/AST/StmtCXX.h" #include "clang/AST/StmtObjC.h" #include "clang/Basic/Builtins.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/CGFunctionInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Dominators.h" diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 9b802991e70..5303f3ccea7 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -29,9 +29,9 @@ #include "clang/AST/Type.h" #include "clang/Basic/ABI.h" #include "clang/Basic/CapturedStmt.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/OpenMPKinds.h" #include "clang/Basic/TargetInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/MapVector.h" diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b80a43b7eb2..ce4558fac4b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -36,13 +36,13 @@ #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/Module.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/Version.h" #include "clang/CodeGen/ConstantInitBuilder.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" diff --git a/clang/lib/CodeGen/CodeGenPGO.h b/clang/lib/CodeGen/CodeGenPGO.h index 0759e65388b..120ab651a4a 100644 --- a/clang/lib/CodeGen/CodeGenPGO.h +++ b/clang/lib/CodeGen/CodeGenPGO.h @@ -17,7 +17,6 @@ #include "CGBuilder.h" #include "CodeGenModule.h" #include "CodeGenTypes.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ProfileData/InstrProfReader.h" #include #include diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp index ec48231e524..27d39716d22 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -20,7 +20,7 @@ #include "clang/AST/Attr.h" #include "clang/AST/Mangle.h" #include "clang/AST/RecordLayout.h" -#include "clang/Frontend/CodeGenOptions.h" +#include "clang/Basic/CodeGenOptions.h" #include "llvm/ADT/SmallSet.h" #include "llvm/IR/Constants.h" #include "llvm/IR/LLVMContext.h" diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h index b08ad896d7a..c62db096952 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.h +++ b/clang/lib/CodeGen/CoverageMappingGen.h @@ -16,7 +16,6 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Lex/PPCallbacks.h" #include "llvm/ADT/DenseMap.h" #include "llvm/IR/GlobalValue.h" diff --git a/clang/lib/CodeGen/ModuleBuilder.cpp b/clang/lib/CodeGen/ModuleBuilder.cpp index 511cf75d6aa..1264893ec13 100644 --- a/clang/lib/CodeGen/ModuleBuilder.cpp +++ b/clang/lib/CodeGen/ModuleBuilder.cpp @@ -17,9 +17,9 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/TargetInfo.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringRef.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/LLVMContext.h" diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index f707e1ea9e9..6f00c836f93 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -14,10 +14,10 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" #include "clang/AST/RecursiveASTVisitor.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/CodeGen/BackendUtil.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/Preprocessor.h" diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 0c3b81fabdf..ae080f5bbd1 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -19,9 +19,9 @@ #include "CGValue.h" #include "CodeGenFunction.h" #include "clang/AST/RecordLayout.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/CodeGen/CGFunctionInfo.h" #include "clang/CodeGen/SwiftCallingConv.h" -#include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" diff --git a/clang/lib/Frontend/CMakeLists.txt b/clang/lib/Frontend/CMakeLists.txt index 76ac0929b53..a207ccc5c9f 100644 --- a/clang/lib/Frontend/CMakeLists.txt +++ b/clang/lib/Frontend/CMakeLists.txt @@ -18,7 +18,6 @@ add_clang_library(clangFrontend ASTUnit.cpp ChainedDiagnosticConsumer.cpp ChainedIncludesSource.cpp - CodeGenOptions.cpp CompilerInstance.cpp CompilerInvocation.cpp CreateInvocationFromCommandLine.cpp diff --git a/clang/lib/Frontend/CodeGenOptions.cpp b/clang/lib/Frontend/CodeGenOptions.cpp deleted file mode 100644 index 84a39f2d570..00000000000 --- a/clang/lib/Frontend/CodeGenOptions.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===--- CodeGenOptions.cpp -----------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "clang/Frontend/CodeGenOptions.h" -#include - -namespace clang { - -CodeGenOptions::CodeGenOptions() { -#define CODEGENOPT(Name, Bits, Default) Name = Default; -#define ENUM_CODEGENOPT(Name, Type, Bits, Default) set##Name(Default); -#include "clang/Frontend/CodeGenOptions.def" - - RelocationModel = llvm::Reloc::PIC_; - memcpy(CoverageVersion, "402*", 4); -} - -bool CodeGenOptions::isNoBuiltinFunc(const char *Name) const { - StringRef FuncName(Name); - for (unsigned i = 0, e = NoBuiltinFuncs.size(); i != e; ++i) - if (FuncName.equals(NoBuiltinFuncs[i])) - return true; - return false; -} - -} // end namespace clang diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 827e9297a84..f87da5a59e6 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -11,6 +11,7 @@ #include "TestModuleFileExtension.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/CharInfo.h" +#include "clang/Basic/CodeGenOptions.h" #include "clang/Basic/CommentOptions.h" #include "clang/Basic/DebugInfoOptions.h" #include "clang/Basic/Diagnostic.h" @@ -28,7 +29,6 @@ #include "clang/Config/config.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" -#include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/CommandLineSourceLoc.h" #include "clang/Frontend/DependencyOutputOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" -- cgit v1.2.1