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 };
26 
27 enum class DebugCompressionType {
28   None, ///< No compression
29   GNU,  ///< zlib-gnu style compression
30   Z,    ///< zlib style complession
31 };
32 
33 class StringRef;
34 
35 class MCTargetOptions {
36 public:
37   enum AsmInstrumentation {
38     AsmInstrumentationNone,
39     AsmInstrumentationAddress
40   };
41 
42   bool MCRelaxAll : 1;
43   bool MCNoExecStack : 1;
44   bool MCFatalWarnings : 1;
45   bool MCNoWarn : 1;
46   bool MCNoDeprecatedWarn : 1;
47   bool MCSaveTempLabels : 1;
48   bool MCUseDwarfDirectory : 1;
49   bool MCIncrementalLinkerCompatible : 1;
50   bool ShowMCEncoding : 1;
51   bool ShowMCInst : 1;
52   bool AsmVerbose : 1;
53 
54   /// Preserve Comments in Assembly.
55   bool PreserveAsmComments : 1;
56 
57   bool Dwarf64 : 1;
58   int DwarfVersion = 0;
59 
60   std::string ABIName;
61   std::string AssemblyLanguage;
62   std::string SplitDwarfFile;
63 
64   const char *Argv0 = nullptr;
65   ArrayRef<const char *> CommandLineArgs;
66 
67   /// Additional paths to search for `.include` directives when using the
68   /// integrated assembler.
69   std::vector<std::string> IASSearchPaths;
70 
71   MCTargetOptions();
72 
73   /// getABIName - If this returns a non-empty string this represents the
74   /// textual name of the ABI that we want the backend to use, e.g. o32, or
75   /// aapcs-linux.
76   StringRef getABIName() const;
77 
78   /// getAssemblyLanguage - If this returns a non-empty string this represents
79   /// the textual name of the assembly language that we will use for this
80   /// target, e.g. masm.
81   StringRef getAssemblyLanguage() const;
82 };
83 
84 } // end namespace llvm
85 
86 #endif // LLVM_MC_MCTARGETOPTIONS_H
87