1 //===- MCTargetOptions.h - MC Target Options --------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_MC_MCTARGETOPTIONS_H
10 #define LLVM_MC_MCTARGETOPTIONS_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include <string>
14 #include <vector>
15 
16 namespace llvm {
17 
18 enum class ExceptionHandling {
19   None,     ///< No exception support
20   DwarfCFI, ///< DWARF-like instruction based exceptions
21   SjLj,     ///< setjmp/longjmp based exceptions
22   ARM,      ///< ARM EHABI
23   WinEH,    ///< Windows Exception Handling
24   Wasm,     ///< WebAssembly Exception Handling
25   AIX,      ///< AIX Exception Handling
26 };
27 
28 enum class DebugCompressionType {
29   None, ///< No compression
30   GNU,  ///< zlib-gnu style compression
31   Z,    ///< zlib style complession
32 };
33 
34 class StringRef;
35 
36 class MCTargetOptions {
37 public:
38   enum AsmInstrumentation {
39     AsmInstrumentationNone,
40     AsmInstrumentationAddress
41   };
42 
43   bool MCRelaxAll : 1;
44   bool MCNoExecStack : 1;
45   bool MCFatalWarnings : 1;
46   bool MCNoWarn : 1;
47   bool MCNoDeprecatedWarn : 1;
48   bool MCSaveTempLabels : 1;
49   bool MCUseDwarfDirectory : 1;
50   bool MCIncrementalLinkerCompatible : 1;
51   bool ShowMCEncoding : 1;
52   bool ShowMCInst : 1;
53   bool AsmVerbose : 1;
54 
55   /// Preserve Comments in Assembly.
56   bool PreserveAsmComments : 1;
57 
58   bool Dwarf64 : 1;
59   int DwarfVersion = 0;
60 
61   std::string ABIName;
62   std::string AssemblyLanguage;
63   std::string SplitDwarfFile;
64 
65   const char *Argv0 = nullptr;
66   ArrayRef<const char *> CommandLineArgs;
67 
68   /// Additional paths to search for `.include` directives when using the
69   /// integrated assembler.
70   std::vector<std::string> IASSearchPaths;
71 
72   MCTargetOptions();
73 
74   /// getABIName - If this returns a non-empty string this represents the
75   /// textual name of the ABI that we want the backend to use, e.g. o32, or
76   /// aapcs-linux.
77   StringRef getABIName() const;
78 
79   /// getAssemblyLanguage - If this returns a non-empty string this represents
80   /// the textual name of the assembly language that we will use for this
81   /// target, e.g. masm.
82   StringRef getAssemblyLanguage() const;
83 };
84 
85 } // end namespace llvm
86 
87 #endif // LLVM_MC_MCTARGETOPTIONS_H
88