xref: /freebsd-src/contrib/llvm-project/llvm/include/llvm/Target/TargetOptions.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric //===-- llvm/Target/TargetOptions.h - Target Options ------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file defines command line option flags that are shared across various
100b57cec5SDimitry Andric // targets.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_TARGET_TARGETOPTIONS_H
150b57cec5SDimitry Andric #define LLVM_TARGET_TARGETOPTIONS_H
160b57cec5SDimitry Andric 
175ffd83dbSDimitry Andric #include "llvm/ADT/FloatingPointMode.h"
180b57cec5SDimitry Andric #include "llvm/MC/MCTargetOptions.h"
190b57cec5SDimitry Andric 
205ffd83dbSDimitry Andric #include <memory>
215ffd83dbSDimitry Andric 
220b57cec5SDimitry Andric namespace llvm {
235ffd83dbSDimitry Andric   struct fltSemantics;
240b57cec5SDimitry Andric   class MachineFunction;
255ffd83dbSDimitry Andric   class MemoryBuffer;
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric   namespace FloatABI {
280b57cec5SDimitry Andric     enum ABIType {
290b57cec5SDimitry Andric       Default, // Target-specific (either soft or hard depending on triple, etc).
300b57cec5SDimitry Andric       Soft,    // Soft float.
310b57cec5SDimitry Andric       Hard     // Hard float.
320b57cec5SDimitry Andric     };
330b57cec5SDimitry Andric   }
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   namespace FPOpFusion {
360b57cec5SDimitry Andric     enum FPOpFusionMode {
370b57cec5SDimitry Andric       Fast,     // Enable fusion of FP ops wherever it's profitable.
380b57cec5SDimitry Andric       Standard, // Only allow fusion of 'blessed' ops (currently just fmuladd).
390b57cec5SDimitry Andric       Strict    // Never fuse FP-ops.
400b57cec5SDimitry Andric     };
410b57cec5SDimitry Andric   }
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric   namespace JumpTable {
440b57cec5SDimitry Andric     enum JumpTableType {
450b57cec5SDimitry Andric       Single,          // Use a single table for all indirect jumptable calls.
460b57cec5SDimitry Andric       Arity,           // Use one table per number of function parameters.
470b57cec5SDimitry Andric       Simplified,      // Use one table per function type, with types projected
480b57cec5SDimitry Andric                        // into 4 types: pointer to non-function, struct,
490b57cec5SDimitry Andric                        // primitive, and function pointer.
500b57cec5SDimitry Andric       Full             // Use one table per unique function type
510b57cec5SDimitry Andric     };
520b57cec5SDimitry Andric   }
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric   namespace ThreadModel {
550b57cec5SDimitry Andric     enum Model {
560b57cec5SDimitry Andric       POSIX,  // POSIX Threads
570b57cec5SDimitry Andric       Single  // Single Threaded Environment
580b57cec5SDimitry Andric     };
590b57cec5SDimitry Andric   }
600b57cec5SDimitry Andric 
615ffd83dbSDimitry Andric   enum class BasicBlockSection {
625ffd83dbSDimitry Andric     All,    // Use Basic Block Sections for all basic blocks.  A section
635ffd83dbSDimitry Andric             // for every basic block can significantly bloat object file sizes.
645ffd83dbSDimitry Andric     List,   // Get list of functions & BBs from a file. Selectively enables
655ffd83dbSDimitry Andric             // basic block sections for a subset of basic blocks which can be
665ffd83dbSDimitry Andric             // used to control object size bloats from creating sections.
675ffd83dbSDimitry Andric     Labels, // Do not use Basic Block Sections but label basic blocks.  This
685ffd83dbSDimitry Andric             // is useful when associating profile counts from virtual addresses
695ffd83dbSDimitry Andric             // to basic blocks.
70e8d8bef9SDimitry Andric     Preset, // Similar to list but the blocks are identified by passes which
71e8d8bef9SDimitry Andric             // seek to use Basic Block Sections, e.g. MachineFunctionSplitter.
72e8d8bef9SDimitry Andric             // This option cannot be set via the command line.
735ffd83dbSDimitry Andric     None    // Do not use Basic Block Sections.
740b57cec5SDimitry Andric   };
750b57cec5SDimitry Andric 
760b57cec5SDimitry Andric   enum class EABI {
770b57cec5SDimitry Andric     Unknown,
780b57cec5SDimitry Andric     Default, // Default means not specified
790b57cec5SDimitry Andric     EABI4,   // Target-specific (either 4, 5 or gnu depending on triple).
800b57cec5SDimitry Andric     EABI5,
810b57cec5SDimitry Andric     GNU
820b57cec5SDimitry Andric   };
830b57cec5SDimitry Andric 
840b57cec5SDimitry Andric   /// Identify a debugger for "tuning" the debug info.
850b57cec5SDimitry Andric   ///
860b57cec5SDimitry Andric   /// The "debugger tuning" concept allows us to present a more intuitive
870b57cec5SDimitry Andric   /// interface that unpacks into different sets of defaults for the various
880b57cec5SDimitry Andric   /// individual feature-flag settings, that suit the preferences of the
890b57cec5SDimitry Andric   /// various debuggers.  However, it's worth remembering that debuggers are
900b57cec5SDimitry Andric   /// not the only consumers of debug info, and some variations in DWARF might
910b57cec5SDimitry Andric   /// better be treated as target/platform issues. Fundamentally,
920b57cec5SDimitry Andric   /// o if the feature is useful (or not) to a particular debugger, regardless
930b57cec5SDimitry Andric   ///   of the target, that's a tuning decision;
940b57cec5SDimitry Andric   /// o if the feature is useful (or not) on a particular platform, regardless
950b57cec5SDimitry Andric   ///   of the debugger, that's a target decision.
960b57cec5SDimitry Andric   /// It's not impossible to see both factors in some specific case.
970b57cec5SDimitry Andric   enum class DebuggerKind {
98fe6060f1SDimitry Andric     Default, ///< No specific tuning requested.
99fe6060f1SDimitry Andric     GDB,     ///< Tune debug info for gdb.
100fe6060f1SDimitry Andric     LLDB,    ///< Tune debug info for lldb.
101fe6060f1SDimitry Andric     SCE,     ///< Tune debug info for SCE targets (e.g. PS4).
102fe6060f1SDimitry Andric     DBX      ///< Tune debug info for dbx.
1030b57cec5SDimitry Andric   };
1040b57cec5SDimitry Andric 
1050b57cec5SDimitry Andric   /// Enable abort calls when global instruction selection fails to lower/select
1060b57cec5SDimitry Andric   /// an instruction.
1070b57cec5SDimitry Andric   enum class GlobalISelAbortMode {
1080b57cec5SDimitry Andric     Disable,        // Disable the abort.
1090b57cec5SDimitry Andric     Enable,         // Enable the abort.
1100b57cec5SDimitry Andric     DisableWithDiag // Disable the abort but emit a diagnostic on failure.
1110b57cec5SDimitry Andric   };
1120b57cec5SDimitry Andric 
113349cc55cSDimitry Andric   /// Indicates when and how the Swift async frame pointer bit should be set.
114349cc55cSDimitry Andric   enum class SwiftAsyncFramePointerMode {
115349cc55cSDimitry Andric     /// Determine whether to set the bit statically or dynamically based
116349cc55cSDimitry Andric     /// on the deployment target.
117349cc55cSDimitry Andric     DeploymentBased,
118349cc55cSDimitry Andric     /// Always set the bit.
119349cc55cSDimitry Andric     Always,
120349cc55cSDimitry Andric     /// Never set the bit.
121349cc55cSDimitry Andric     Never,
122349cc55cSDimitry Andric   };
123349cc55cSDimitry Andric 
1245f757f3fSDimitry Andric   /// \brief Enumeration value for AMDGPU code object version, which is the
1255f757f3fSDimitry Andric   /// code object version times 100.
1265f757f3fSDimitry Andric   enum CodeObjectVersionKind {
1275f757f3fSDimitry Andric     COV_None,
1285f757f3fSDimitry Andric     COV_2 = 200, // Unsupported.
1295f757f3fSDimitry Andric     COV_3 = 300, // Unsupported.
1305f757f3fSDimitry Andric     COV_4 = 400,
1315f757f3fSDimitry Andric     COV_5 = 500,
132*0fca6ea1SDimitry Andric     COV_6 = 600,
1335f757f3fSDimitry Andric   };
1345f757f3fSDimitry Andric 
1350b57cec5SDimitry Andric   class TargetOptions {
1360b57cec5SDimitry Andric   public:
1370b57cec5SDimitry Andric     TargetOptions()
138e8d8bef9SDimitry Andric         : UnsafeFPMath(false), NoInfsFPMath(false), NoNaNsFPMath(false),
139e8d8bef9SDimitry Andric           NoTrappingFPMath(true), NoSignedZerosFPMath(false),
140349cc55cSDimitry Andric           ApproxFuncFPMath(false), EnableAIXExtendedAltivecABI(false),
1410b57cec5SDimitry Andric           HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false),
1420b57cec5SDimitry Andric           GuaranteedTailCallOpt(false), StackSymbolOrdering(true),
1430b57cec5SDimitry Andric           EnableFastISel(false), EnableGlobalISel(false), UseInitArray(false),
144*0fca6ea1SDimitry Andric           DisableIntegratedAS(false), FunctionSections(false),
145*0fca6ea1SDimitry Andric           DataSections(false), IgnoreXCOFFVisibility(false),
146*0fca6ea1SDimitry Andric           XCOFFTracebackTable(true), UniqueSectionNames(true),
147*0fca6ea1SDimitry Andric           UniqueBasicBlockSectionNames(false), SeparateNamedSections(false),
14806c3fb27SDimitry Andric           TrapUnreachable(false), NoTrapAfterNoreturn(false), TLSSize(0),
1497a6dacacSDimitry Andric           EmulatedTLS(false), EnableTLSDESC(false), EnableIPRA(false),
1507a6dacacSDimitry Andric           EmitStackSizeSection(false), EnableMachineOutliner(false),
1517a6dacacSDimitry Andric           EnableMachineFunctionSplitter(false), SupportsDefaultOutlining(false),
152*0fca6ea1SDimitry Andric           EmitAddrsig(false), BBAddrMap(false), EmitCallSiteInfo(false),
1537a6dacacSDimitry Andric           SupportsDebugEntryValues(false), EnableDebugEntryValues(false),
1547a6dacacSDimitry Andric           ValueTrackingVariableLocations(false), ForceDwarfFrameSection(false),
1557a6dacacSDimitry Andric           XRayFunctionIndex(true), DebugStrictDwarf(false), Hotpatch(false),
15606c3fb27SDimitry Andric           PPCGenScalarMASSEntries(false), JMCInstrument(false),
15706c3fb27SDimitry Andric           EnableCFIFixup(false), MisExpect(false), XCOFFReadOnlyPointers(false),
1585ffd83dbSDimitry Andric           FPDenormalMode(DenormalMode::IEEE, DenormalMode::IEEE) {}
1590b57cec5SDimitry Andric 
1600b57cec5SDimitry Andric     /// DisableFramePointerElim - This returns true if frame pointer elimination
1610b57cec5SDimitry Andric     /// optimization should be disabled for the given machine function.
1620b57cec5SDimitry Andric     bool DisableFramePointerElim(const MachineFunction &MF) const;
1630b57cec5SDimitry Andric 
164*0fca6ea1SDimitry Andric     /// FramePointerIsReserved - This returns true if the frame pointer must
165*0fca6ea1SDimitry Andric     /// always either point to a new frame record or be un-modified in the given
166*0fca6ea1SDimitry Andric     /// function.
167*0fca6ea1SDimitry Andric     bool FramePointerIsReserved(const MachineFunction &MF) const;
168*0fca6ea1SDimitry Andric 
169e8d8bef9SDimitry Andric     /// If greater than 0, override the default value of
170e8d8bef9SDimitry Andric     /// MCAsmInfo::BinutilsVersion.
171e8d8bef9SDimitry Andric     std::pair<int, int> BinutilsVersion{0, 0};
172e8d8bef9SDimitry Andric 
1730b57cec5SDimitry Andric     /// UnsafeFPMath - This flag is enabled when the
1740b57cec5SDimitry Andric     /// -enable-unsafe-fp-math flag is specified on the command line.  When
1750b57cec5SDimitry Andric     /// this flag is off (the default), the code generator is not allowed to
1760b57cec5SDimitry Andric     /// produce results that are "less precise" than IEEE allows.  This includes
1770b57cec5SDimitry Andric     /// use of X86 instructions like FSIN and FCOS instead of libcalls.
1780b57cec5SDimitry Andric     unsigned UnsafeFPMath : 1;
1790b57cec5SDimitry Andric 
1800b57cec5SDimitry Andric     /// NoInfsFPMath - This flag is enabled when the
1810b57cec5SDimitry Andric     /// -enable-no-infs-fp-math flag is specified on the command line. When
1820b57cec5SDimitry Andric     /// this flag is off (the default), the code generator is not allowed to
1830b57cec5SDimitry Andric     /// assume the FP arithmetic arguments and results are never +-Infs.
1840b57cec5SDimitry Andric     unsigned NoInfsFPMath : 1;
1850b57cec5SDimitry Andric 
1860b57cec5SDimitry Andric     /// NoNaNsFPMath - This flag is enabled when the
1870b57cec5SDimitry Andric     /// -enable-no-nans-fp-math flag is specified on the command line. When
1880b57cec5SDimitry Andric     /// this flag is off (the default), the code generator is not allowed to
1890b57cec5SDimitry Andric     /// assume the FP arithmetic arguments and results are never NaNs.
1900b57cec5SDimitry Andric     unsigned NoNaNsFPMath : 1;
1910b57cec5SDimitry Andric 
1920b57cec5SDimitry Andric     /// NoTrappingFPMath - This flag is enabled when the
1930b57cec5SDimitry Andric     /// -enable-no-trapping-fp-math is specified on the command line. This
1940b57cec5SDimitry Andric     /// specifies that there are no trap handlers to handle exceptions.
1950b57cec5SDimitry Andric     unsigned NoTrappingFPMath : 1;
1960b57cec5SDimitry Andric 
1970b57cec5SDimitry Andric     /// NoSignedZerosFPMath - This flag is enabled when the
1980b57cec5SDimitry Andric     /// -enable-no-signed-zeros-fp-math is specified on the command line. This
1990b57cec5SDimitry Andric     /// specifies that optimizations are allowed to treat the sign of a zero
2000b57cec5SDimitry Andric     /// argument or result as insignificant.
2010b57cec5SDimitry Andric     unsigned NoSignedZerosFPMath : 1;
2020b57cec5SDimitry Andric 
203349cc55cSDimitry Andric     /// ApproxFuncFPMath - This flag is enabled when the
204349cc55cSDimitry Andric     /// -enable-approx-func-fp-math is specified on the command line. This
205349cc55cSDimitry Andric     /// specifies that optimizations are allowed to substitute math functions
206349cc55cSDimitry Andric     /// with approximate calculations
207349cc55cSDimitry Andric     unsigned ApproxFuncFPMath : 1;
208349cc55cSDimitry Andric 
209e8d8bef9SDimitry Andric     /// EnableAIXExtendedAltivecABI - This flag returns true when -vec-extabi is
210e8d8bef9SDimitry Andric     /// specified. The code generator is then able to use both volatile and
211349cc55cSDimitry Andric     /// nonvolitle vector registers. When false, the code generator only uses
212e8d8bef9SDimitry Andric     /// volatile vector registers which is the default setting on AIX.
213e8d8bef9SDimitry Andric     unsigned EnableAIXExtendedAltivecABI : 1;
214e8d8bef9SDimitry Andric 
2150b57cec5SDimitry Andric     /// HonorSignDependentRoundingFPMath - This returns true when the
2160b57cec5SDimitry Andric     /// -enable-sign-dependent-rounding-fp-math is specified.  If this returns
2170b57cec5SDimitry Andric     /// false (the default), the code generator is allowed to assume that the
2180b57cec5SDimitry Andric     /// rounding behavior is the default (round-to-zero for all floating point
2190b57cec5SDimitry Andric     /// to integer conversions, and round-to-nearest for all other arithmetic
2200b57cec5SDimitry Andric     /// truncations).  If this is enabled (set to true), the code generator must
2210b57cec5SDimitry Andric     /// assume that the rounding mode may dynamically change.
2220b57cec5SDimitry Andric     unsigned HonorSignDependentRoundingFPMathOption : 1;
2230b57cec5SDimitry Andric     bool HonorSignDependentRoundingFPMath() const;
2240b57cec5SDimitry Andric 
2250b57cec5SDimitry Andric     /// NoZerosInBSS - By default some codegens place zero-initialized data to
2260b57cec5SDimitry Andric     /// .bss section. This flag disables such behaviour (necessary, e.g. for
2270b57cec5SDimitry Andric     /// crt*.o compiling).
2280b57cec5SDimitry Andric     unsigned NoZerosInBSS : 1;
2290b57cec5SDimitry Andric 
2300b57cec5SDimitry Andric     /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
2310b57cec5SDimitry Andric     /// specified on the commandline. When the flag is on, participating targets
2320b57cec5SDimitry Andric     /// will perform tail call optimization on all calls which use the fastcc
2330b57cec5SDimitry Andric     /// calling convention and which satisfy certain target-independent
2340b57cec5SDimitry Andric     /// criteria (being at the end of a function, having the same return type
2350b57cec5SDimitry Andric     /// as their parent function, etc.), using an alternate ABI if necessary.
2360b57cec5SDimitry Andric     unsigned GuaranteedTailCallOpt : 1;
2370b57cec5SDimitry Andric 
2380b57cec5SDimitry Andric     /// StackSymbolOrdering - When true, this will allow CodeGen to order
2390b57cec5SDimitry Andric     /// the local stack symbols (for code size, code locality, or any other
2400b57cec5SDimitry Andric     /// heuristics). When false, the local symbols are left in whatever order
2410b57cec5SDimitry Andric     /// they were generated. Default is true.
2420b57cec5SDimitry Andric     unsigned StackSymbolOrdering : 1;
2430b57cec5SDimitry Andric 
2440b57cec5SDimitry Andric     /// EnableFastISel - This flag enables fast-path instruction selection
2450b57cec5SDimitry Andric     /// which trades away generated code quality in favor of reducing
2460b57cec5SDimitry Andric     /// compile time.
2470b57cec5SDimitry Andric     unsigned EnableFastISel : 1;
2480b57cec5SDimitry Andric 
2490b57cec5SDimitry Andric     /// EnableGlobalISel - This flag enables global instruction selection.
2500b57cec5SDimitry Andric     unsigned EnableGlobalISel : 1;
2510b57cec5SDimitry Andric 
2520b57cec5SDimitry Andric     /// EnableGlobalISelAbort - Control abort behaviour when global instruction
2530b57cec5SDimitry Andric     /// selection fails to lower/select an instruction.
2540b57cec5SDimitry Andric     GlobalISelAbortMode GlobalISelAbort = GlobalISelAbortMode::Enable;
2550b57cec5SDimitry Andric 
256349cc55cSDimitry Andric     /// Control when and how the Swift async frame pointer bit should
257349cc55cSDimitry Andric     /// be set.
258349cc55cSDimitry Andric     SwiftAsyncFramePointerMode SwiftAsyncFramePointer =
259349cc55cSDimitry Andric         SwiftAsyncFramePointerMode::Always;
260349cc55cSDimitry Andric 
2610b57cec5SDimitry Andric     /// UseInitArray - Use .init_array instead of .ctors for static
2620b57cec5SDimitry Andric     /// constructors.
2630b57cec5SDimitry Andric     unsigned UseInitArray : 1;
2640b57cec5SDimitry Andric 
2650b57cec5SDimitry Andric     /// Disable the integrated assembler.
2660b57cec5SDimitry Andric     unsigned DisableIntegratedAS : 1;
2670b57cec5SDimitry Andric 
2680b57cec5SDimitry Andric     /// Emit functions into separate sections.
2690b57cec5SDimitry Andric     unsigned FunctionSections : 1;
2700b57cec5SDimitry Andric 
2710b57cec5SDimitry Andric     /// Emit data into separate sections.
2720b57cec5SDimitry Andric     unsigned DataSections : 1;
2730b57cec5SDimitry Andric 
274e8d8bef9SDimitry Andric     /// Do not emit visibility attribute for xcoff.
275e8d8bef9SDimitry Andric     unsigned IgnoreXCOFFVisibility : 1;
276e8d8bef9SDimitry Andric 
277e8d8bef9SDimitry Andric     /// Emit XCOFF traceback table.
278e8d8bef9SDimitry Andric     unsigned XCOFFTracebackTable : 1;
279e8d8bef9SDimitry Andric 
2800b57cec5SDimitry Andric     unsigned UniqueSectionNames : 1;
2810b57cec5SDimitry Andric 
2825ffd83dbSDimitry Andric     /// Use unique names for basic block sections.
2835ffd83dbSDimitry Andric     unsigned UniqueBasicBlockSectionNames : 1;
2845ffd83dbSDimitry Andric 
285*0fca6ea1SDimitry Andric     /// Emit named sections with the same name into different sections.
286*0fca6ea1SDimitry Andric     unsigned SeparateNamedSections : 1;
287*0fca6ea1SDimitry Andric 
2880b57cec5SDimitry Andric     /// Emit target-specific trap instruction for 'unreachable' IR instructions.
2890b57cec5SDimitry Andric     unsigned TrapUnreachable : 1;
2900b57cec5SDimitry Andric 
2910b57cec5SDimitry Andric     /// Do not emit a trap instruction for 'unreachable' IR instructions behind
2920b57cec5SDimitry Andric     /// noreturn calls, even if TrapUnreachable is true.
2930b57cec5SDimitry Andric     unsigned NoTrapAfterNoreturn : 1;
2940b57cec5SDimitry Andric 
295480093f4SDimitry Andric     /// Bit size of immediate TLS offsets (0 == use the default).
296480093f4SDimitry Andric     unsigned TLSSize : 8;
297480093f4SDimitry Andric 
2980b57cec5SDimitry Andric     /// EmulatedTLS - This flag enables emulated TLS model, using emutls
2990b57cec5SDimitry Andric     /// function in the runtime library..
3000b57cec5SDimitry Andric     unsigned EmulatedTLS : 1;
3010b57cec5SDimitry Andric 
3027a6dacacSDimitry Andric     /// EnableTLSDESC - This flag enables TLS Descriptors.
3037a6dacacSDimitry Andric     unsigned EnableTLSDESC : 1;
3047a6dacacSDimitry Andric 
3050b57cec5SDimitry Andric     /// This flag enables InterProcedural Register Allocation (IPRA).
3060b57cec5SDimitry Andric     unsigned EnableIPRA : 1;
3070b57cec5SDimitry Andric 
3080b57cec5SDimitry Andric     /// Emit section containing metadata on function stack sizes.
3090b57cec5SDimitry Andric     unsigned EmitStackSizeSection : 1;
3100b57cec5SDimitry Andric 
3110b57cec5SDimitry Andric     /// Enables the MachineOutliner pass.
3120b57cec5SDimitry Andric     unsigned EnableMachineOutliner : 1;
3130b57cec5SDimitry Andric 
314e8d8bef9SDimitry Andric     /// Enables the MachineFunctionSplitter pass.
315e8d8bef9SDimitry Andric     unsigned EnableMachineFunctionSplitter : 1;
316e8d8bef9SDimitry Andric 
3170b57cec5SDimitry Andric     /// Set if the target supports default outlining behaviour.
3180b57cec5SDimitry Andric     unsigned SupportsDefaultOutlining : 1;
3190b57cec5SDimitry Andric 
3200b57cec5SDimitry Andric     /// Emit address-significance table.
3210b57cec5SDimitry Andric     unsigned EmitAddrsig : 1;
3220b57cec5SDimitry Andric 
323*0fca6ea1SDimitry Andric     // Emit the SHT_LLVM_BB_ADDR_MAP section containing basic block address
324*0fca6ea1SDimitry Andric     // which can be used to map virtual addresses to machine basic blocks.
325*0fca6ea1SDimitry Andric     unsigned BBAddrMap : 1;
326*0fca6ea1SDimitry Andric 
3275ffd83dbSDimitry Andric     /// Emit basic blocks into separate sections.
3285ffd83dbSDimitry Andric     BasicBlockSection BBSections = BasicBlockSection::None;
3295ffd83dbSDimitry Andric 
3305ffd83dbSDimitry Andric     /// Memory Buffer that contains information on sampled basic blocks and used
3315ffd83dbSDimitry Andric     /// to selectively generate basic block sections.
3325ffd83dbSDimitry Andric     std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
3335ffd83dbSDimitry Andric 
3345ffd83dbSDimitry Andric     /// The flag enables call site info production. It is used only for debug
3355ffd83dbSDimitry Andric     /// info, and it is restricted only to optimized code. This can be used for
3365ffd83dbSDimitry Andric     /// something else, so that should be controlled in the frontend.
3375ffd83dbSDimitry Andric     unsigned EmitCallSiteInfo : 1;
3385ffd83dbSDimitry Andric     /// Set if the target supports the debug entry values by default.
3395ffd83dbSDimitry Andric     unsigned SupportsDebugEntryValues : 1;
3405ffd83dbSDimitry Andric     /// When set to true, the EnableDebugEntryValues option forces production
3415ffd83dbSDimitry Andric     /// of debug entry values even if the target does not officially support
3425ffd83dbSDimitry Andric     /// it. Useful for testing purposes only. This flag should never be checked
3435ffd83dbSDimitry Andric     /// directly, always use \ref ShouldEmitDebugEntryValues instead.
3440b57cec5SDimitry Andric      unsigned EnableDebugEntryValues : 1;
3455ffd83dbSDimitry Andric     /// NOTE: There are targets that still do not support the debug entry values
3465ffd83dbSDimitry Andric     /// production.
3475ffd83dbSDimitry Andric     bool ShouldEmitDebugEntryValues() const;
3480b57cec5SDimitry Andric 
349e8d8bef9SDimitry Andric     // When set to true, use experimental new debug variable location tracking,
350e8d8bef9SDimitry Andric     // which seeks to follow the values of variables rather than their location,
351e8d8bef9SDimitry Andric     // post isel.
352e8d8bef9SDimitry Andric     unsigned ValueTrackingVariableLocations : 1;
353e8d8bef9SDimitry Andric 
354480093f4SDimitry Andric     /// Emit DWARF debug frame section.
355480093f4SDimitry Andric     unsigned ForceDwarfFrameSection : 1;
356480093f4SDimitry Andric 
3575ffd83dbSDimitry Andric     /// Emit XRay Function Index section
35806c3fb27SDimitry Andric     unsigned XRayFunctionIndex : 1;
3595ffd83dbSDimitry Andric 
360fe6060f1SDimitry Andric     /// When set to true, don't use DWARF extensions in later DWARF versions.
361fe6060f1SDimitry Andric     /// By default, it is set to false.
362fe6060f1SDimitry Andric     unsigned DebugStrictDwarf : 1;
363e8d8bef9SDimitry Andric 
36404eeddc0SDimitry Andric     /// Emit the hotpatch flag in CodeView debug.
36504eeddc0SDimitry Andric     unsigned Hotpatch : 1;
36604eeddc0SDimitry Andric 
36781ad6265SDimitry Andric     /// Enables scalar MASS conversions
36881ad6265SDimitry Andric     unsigned PPCGenScalarMASSEntries : 1;
36981ad6265SDimitry Andric 
37081ad6265SDimitry Andric     /// Enable JustMyCode instrumentation.
37181ad6265SDimitry Andric     unsigned JMCInstrument : 1;
37281ad6265SDimitry Andric 
37381ad6265SDimitry Andric     /// Enable the CFIFixup pass.
37481ad6265SDimitry Andric     unsigned EnableCFIFixup : 1;
37581ad6265SDimitry Andric 
37681ad6265SDimitry Andric     /// When set to true, enable MisExpect Diagnostics
37781ad6265SDimitry Andric     /// By default, it is set to false
37881ad6265SDimitry Andric     unsigned MisExpect : 1;
37981ad6265SDimitry Andric 
38006c3fb27SDimitry Andric     /// When set to true, const objects with relocatable address values are put
38106c3fb27SDimitry Andric     /// into the RO data section.
38206c3fb27SDimitry Andric     unsigned XCOFFReadOnlyPointers : 1;
38306c3fb27SDimitry Andric 
384fe6060f1SDimitry Andric     /// Name of the stack usage file (i.e., .su file) if user passes
385fe6060f1SDimitry Andric     /// -fstack-usage. If empty, it can be implied that -fstack-usage is not
386fe6060f1SDimitry Andric     /// passed on the command line.
387fe6060f1SDimitry Andric     std::string StackUsageOutput;
388e8d8bef9SDimitry Andric 
389349cc55cSDimitry Andric     /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
390349cc55cSDimitry Andric     unsigned LoopAlignment = 0;
391349cc55cSDimitry Andric 
3920b57cec5SDimitry Andric     /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
3930b57cec5SDimitry Andric     /// on the command line. This setting may either be Default, Soft, or Hard.
3940b57cec5SDimitry Andric     /// Default selects the target's default behavior. Soft selects the ABI for
3950b57cec5SDimitry Andric     /// software floating point, but does not indicate that FP hardware may not
3960b57cec5SDimitry Andric     /// be used. Such a combination is unfortunately popular (e.g.
3970b57cec5SDimitry Andric     /// arm-apple-darwin). Hard presumes that the normal FP ABI is used.
3980b57cec5SDimitry Andric     FloatABI::ABIType FloatABIType = FloatABI::Default;
3990b57cec5SDimitry Andric 
400fe6060f1SDimitry Andric     /// AllowFPOpFusion - This flag is set by the -fp-contract=xxx option.
4010b57cec5SDimitry Andric     /// This controls the creation of fused FP ops that store intermediate
4020b57cec5SDimitry Andric     /// results in higher precision than IEEE allows (E.g. FMAs).
4030b57cec5SDimitry Andric     ///
4040b57cec5SDimitry Andric     /// Fast mode - allows formation of fused FP ops whenever they're
4050b57cec5SDimitry Andric     /// profitable.
4060b57cec5SDimitry Andric     /// Standard mode - allow fusion only for 'blessed' FP ops. At present the
4070b57cec5SDimitry Andric     /// only blessed op is the fmuladd intrinsic. In the future more blessed ops
4080b57cec5SDimitry Andric     /// may be added.
4090b57cec5SDimitry Andric     /// Strict mode - allow fusion only if/when it can be proven that the excess
4100b57cec5SDimitry Andric     /// precision won't effect the result.
4110b57cec5SDimitry Andric     ///
4120b57cec5SDimitry Andric     /// Note: This option only controls formation of fused ops by the
4130b57cec5SDimitry Andric     /// optimizers.  Fused operations that are explicitly specified (e.g. FMA
4140b57cec5SDimitry Andric     /// via the llvm.fma.* intrinsic) will always be honored, regardless of
4150b57cec5SDimitry Andric     /// the value of this option.
4160b57cec5SDimitry Andric     FPOpFusion::FPOpFusionMode AllowFPOpFusion = FPOpFusion::Standard;
4170b57cec5SDimitry Andric 
4180b57cec5SDimitry Andric     /// ThreadModel - This flag specifies the type of threading model to assume
4190b57cec5SDimitry Andric     /// for things like atomics
4200b57cec5SDimitry Andric     ThreadModel::Model ThreadModel = ThreadModel::POSIX;
4210b57cec5SDimitry Andric 
4220b57cec5SDimitry Andric     /// EABIVersion - This flag specifies the EABI version
4230b57cec5SDimitry Andric     EABI EABIVersion = EABI::Default;
4240b57cec5SDimitry Andric 
4250b57cec5SDimitry Andric     /// Which debugger to tune for.
4260b57cec5SDimitry Andric     DebuggerKind DebuggerTuning = DebuggerKind::Default;
4270b57cec5SDimitry Andric 
4285ffd83dbSDimitry Andric   private:
4295ffd83dbSDimitry Andric     /// Flushing mode to assume in default FP environment.
4305ffd83dbSDimitry Andric     DenormalMode FPDenormalMode;
4315ffd83dbSDimitry Andric 
4325ffd83dbSDimitry Andric     /// Flushing mode to assume in default FP environment, for float/vector of
4335ffd83dbSDimitry Andric     /// float.
4345ffd83dbSDimitry Andric     DenormalMode FP32DenormalMode;
4355ffd83dbSDimitry Andric 
4365ffd83dbSDimitry Andric   public:
4375ffd83dbSDimitry Andric     void setFPDenormalMode(DenormalMode Mode) {
4385ffd83dbSDimitry Andric       FPDenormalMode = Mode;
4395ffd83dbSDimitry Andric     }
4405ffd83dbSDimitry Andric 
4415ffd83dbSDimitry Andric     void setFP32DenormalMode(DenormalMode Mode) {
4425ffd83dbSDimitry Andric       FP32DenormalMode = Mode;
4435ffd83dbSDimitry Andric     }
4445ffd83dbSDimitry Andric 
4455ffd83dbSDimitry Andric     DenormalMode getRawFPDenormalMode() const {
4465ffd83dbSDimitry Andric       return FPDenormalMode;
4475ffd83dbSDimitry Andric     }
4485ffd83dbSDimitry Andric 
4495ffd83dbSDimitry Andric     DenormalMode getRawFP32DenormalMode() const {
4505ffd83dbSDimitry Andric       return FP32DenormalMode;
4515ffd83dbSDimitry Andric     }
4525ffd83dbSDimitry Andric 
4535ffd83dbSDimitry Andric     DenormalMode getDenormalMode(const fltSemantics &FPType) const;
4540b57cec5SDimitry Andric 
4550b57cec5SDimitry Andric     /// What exception model to use
4560b57cec5SDimitry Andric     ExceptionHandling ExceptionModel = ExceptionHandling::None;
4570b57cec5SDimitry Andric 
4580b57cec5SDimitry Andric     /// Machine level options.
4590b57cec5SDimitry Andric     MCTargetOptions MCOptions;
4600eae32dcSDimitry Andric 
4610eae32dcSDimitry Andric     /// Stores the filename/path of the final .o/.obj file, to be written in the
4620eae32dcSDimitry Andric     /// debug information. This is used for emitting the CodeView S_OBJNAME
4630eae32dcSDimitry Andric     /// record.
4640eae32dcSDimitry Andric     std::string ObjectFilenameForDebug;
4650b57cec5SDimitry Andric   };
4660b57cec5SDimitry Andric 
4670b57cec5SDimitry Andric } // End llvm namespace
4680b57cec5SDimitry Andric 
4690b57cec5SDimitry Andric #endif
470