Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:15

0001 //===- MCTargetOptions.h - MC Target Options --------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_MC_MCTARGETOPTIONS_H
0010 #define LLVM_MC_MCTARGETOPTIONS_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/Support/Compression.h"
0014 #include <string>
0015 #include <vector>
0016 
0017 namespace llvm {
0018 
0019 enum class ExceptionHandling {
0020   None,     ///< No exception support
0021   DwarfCFI, ///< DWARF-like instruction based exceptions
0022   SjLj,     ///< setjmp/longjmp based exceptions
0023   ARM,      ///< ARM EHABI
0024   WinEH,    ///< Windows Exception Handling
0025   Wasm,     ///< WebAssembly Exception Handling
0026   AIX,      ///< AIX Exception Handling
0027   ZOS,      ///< z/OS MVS Exception Handling. Very similar to DwarfCFI, but the PPA1
0028             ///< is used instead of an .eh_frame section.
0029 };
0030 
0031 enum class EmitDwarfUnwindType {
0032   Always,          // Always emit dwarf unwind
0033   NoCompactUnwind, // Only emit if compact unwind isn't available
0034   Default,         // Default behavior is based on the target
0035 };
0036 
0037 class StringRef;
0038 
0039 class MCTargetOptions {
0040 public:
0041   enum AsmInstrumentation {
0042     AsmInstrumentationNone,
0043     AsmInstrumentationAddress
0044   };
0045 
0046   bool MCRelaxAll : 1;
0047   bool MCNoExecStack : 1;
0048   bool MCFatalWarnings : 1;
0049   bool MCNoWarn : 1;
0050   bool MCNoDeprecatedWarn : 1;
0051   bool MCNoTypeCheck : 1;
0052   bool MCSaveTempLabels : 1;
0053   bool MCIncrementalLinkerCompatible : 1;
0054   bool FDPIC : 1;
0055   bool ShowMCEncoding : 1;
0056   bool ShowMCInst : 1;
0057   bool AsmVerbose : 1;
0058 
0059   /// Preserve Comments in Assembly.
0060   bool PreserveAsmComments : 1;
0061 
0062   bool Dwarf64 : 1;
0063 
0064   // Use CREL relocation format for ELF.
0065   bool Crel = false;
0066 
0067   bool ImplicitMapSyms = false;
0068 
0069   // If true, prefer R_X86_64_[REX_]GOTPCRELX to R_X86_64_GOTPCREL on x86-64
0070   // ELF.
0071   bool X86RelaxRelocations = true;
0072 
0073   bool X86Sse2Avx = false;
0074 
0075   std::optional<unsigned> OutputAsmVariant;
0076 
0077   EmitDwarfUnwindType EmitDwarfUnwind;
0078 
0079   int DwarfVersion = 0;
0080 
0081   enum DwarfDirectory {
0082     // Force disable
0083     DisableDwarfDirectory,
0084     // Force enable, for assemblers that support
0085     // `.file fileno directory filename' syntax
0086     EnableDwarfDirectory,
0087     // Default is based on the target
0088     DefaultDwarfDirectory
0089   };
0090   DwarfDirectory MCUseDwarfDirectory;
0091 
0092   // Whether to compress DWARF debug sections.
0093   DebugCompressionType CompressDebugSections = DebugCompressionType::None;
0094 
0095   std::string ABIName;
0096   std::string AssemblyLanguage;
0097   std::string SplitDwarfFile;
0098   std::string AsSecureLogFile;
0099 
0100   // Used for codeview debug info. These will be set as compiler path and commandline arguments in LF_BUILDINFO
0101   std::string Argv0;
0102   std::string CommandlineArgs;
0103 
0104   /// Additional paths to search for `.include` directives when using the
0105   /// integrated assembler.
0106   std::vector<std::string> IASSearchPaths;
0107 
0108   // Whether to emit compact-unwind for non-canonical personality
0109   // functions on Darwins.
0110   bool EmitCompactUnwindNonCanonical : 1;
0111 
0112   // Whether or not to use full register names on PowerPC.
0113   bool PPCUseFullRegisterNames : 1;
0114 
0115   MCTargetOptions();
0116 
0117   /// getABIName - If this returns a non-empty string this represents the
0118   /// textual name of the ABI that we want the backend to use, e.g. o32, or
0119   /// aapcs-linux.
0120   StringRef getABIName() const;
0121 
0122   /// getAssemblyLanguage - If this returns a non-empty string this represents
0123   /// the textual name of the assembly language that we will use for this
0124   /// target, e.g. masm.
0125   StringRef getAssemblyLanguage() const;
0126 };
0127 
0128 } // end namespace llvm
0129 
0130 #endif // LLVM_MC_MCTARGETOPTIONS_H