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 "llvm/Support/Compression.h" |
14 | #include <string> |
15 | #include <vector> |
16 | |
17 | namespace llvm { |
18 | |
19 | enum class ExceptionHandling { |
20 | None, ///< No exception support |
21 | DwarfCFI, ///< DWARF-like instruction based exceptions |
22 | SjLj, ///< setjmp/longjmp based exceptions |
23 | ARM, ///< ARM EHABI |
24 | WinEH, ///< Windows Exception Handling |
25 | Wasm, ///< WebAssembly Exception Handling |
26 | AIX, ///< AIX Exception Handling |
27 | ZOS, ///< z/OS MVS Exception Handling. Very similar to DwarfCFI, but the PPA1 |
28 | ///< is used instead of an .eh_frame section. |
29 | }; |
30 | |
31 | enum class EmitDwarfUnwindType { |
32 | Always, // Always emit dwarf unwind |
33 | NoCompactUnwind, // Only emit if compact unwind isn't available |
34 | Default, // Default behavior is based on the target |
35 | }; |
36 | |
37 | class StringRef; |
38 | |
39 | class MCTargetOptions { |
40 | public: |
41 | enum AsmInstrumentation { |
42 | AsmInstrumentationNone, |
43 | AsmInstrumentationAddress |
44 | }; |
45 | |
46 | bool MCRelaxAll : 1; |
47 | bool MCNoExecStack : 1; |
48 | bool MCFatalWarnings : 1; |
49 | bool MCNoWarn : 1; |
50 | bool MCNoDeprecatedWarn : 1; |
51 | bool MCNoTypeCheck : 1; |
52 | bool MCSaveTempLabels : 1; |
53 | bool MCIncrementalLinkerCompatible : 1; |
54 | bool FDPIC : 1; |
55 | bool ShowMCEncoding : 1; |
56 | bool ShowMCInst : 1; |
57 | bool AsmVerbose : 1; |
58 | |
59 | /// Preserve Comments in Assembly. |
60 | bool : 1; |
61 | |
62 | bool Dwarf64 : 1; |
63 | |
64 | // If true, prefer R_X86_64_[REX_]GOTPCRELX to R_X86_64_GOTPCREL on x86-64 |
65 | // ELF. |
66 | bool X86RelaxRelocations = true; |
67 | |
68 | EmitDwarfUnwindType EmitDwarfUnwind; |
69 | |
70 | int DwarfVersion = 0; |
71 | |
72 | enum DwarfDirectory { |
73 | // Force disable |
74 | DisableDwarfDirectory, |
75 | // Force enable, for assemblers that support |
76 | // `.file fileno directory filename' syntax |
77 | EnableDwarfDirectory, |
78 | // Default is based on the target |
79 | DefaultDwarfDirectory |
80 | }; |
81 | DwarfDirectory MCUseDwarfDirectory; |
82 | |
83 | // Whether to compress DWARF debug sections. |
84 | DebugCompressionType CompressDebugSections = DebugCompressionType::None; |
85 | |
86 | std::string ABIName; |
87 | std::string AssemblyLanguage; |
88 | std::string SplitDwarfFile; |
89 | std::string AsSecureLogFile; |
90 | |
91 | const char *Argv0 = nullptr; |
92 | ArrayRef<std::string> CommandLineArgs; |
93 | |
94 | /// Additional paths to search for `.include` directives when using the |
95 | /// integrated assembler. |
96 | std::vector<std::string> IASSearchPaths; |
97 | |
98 | // Whether to emit compact-unwind for non-canonical personality |
99 | // functions on Darwins. |
100 | bool EmitCompactUnwindNonCanonical : 1; |
101 | |
102 | // Whether or not to use full register names on PowerPC. |
103 | bool PPCUseFullRegisterNames : 1; |
104 | |
105 | MCTargetOptions(); |
106 | |
107 | /// getABIName - If this returns a non-empty string this represents the |
108 | /// textual name of the ABI that we want the backend to use, e.g. o32, or |
109 | /// aapcs-linux. |
110 | StringRef getABIName() const; |
111 | |
112 | /// getAssemblyLanguage - If this returns a non-empty string this represents |
113 | /// the textual name of the assembly language that we will use for this |
114 | /// target, e.g. masm. |
115 | StringRef getAssemblyLanguage() const; |
116 | }; |
117 | |
118 | } // end namespace llvm |
119 | |
120 | #endif // LLVM_MC_MCTARGETOPTIONS_H |
121 | |