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
17namespace llvm {
18
19enum 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
31enum 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
37class StringRef;
38
39class MCTargetOptions {
40public:
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 ShowMCEncoding : 1;
55 bool ShowMCInst : 1;
56 bool AsmVerbose : 1;
57
58 /// Preserve Comments in Assembly.
59 bool PreserveAsmComments : 1;
60
61 bool Dwarf64 : 1;
62
63 EmitDwarfUnwindType EmitDwarfUnwind;
64
65 int DwarfVersion = 0;
66
67 enum DwarfDirectory {
68 // Force disable
69 DisableDwarfDirectory,
70 // Force enable, for assemblers that support
71 // `.file fileno directory filename' syntax
72 EnableDwarfDirectory,
73 // Default is based on the target
74 DefaultDwarfDirectory
75 };
76 DwarfDirectory MCUseDwarfDirectory;
77
78 std::string ABIName;
79 std::string AssemblyLanguage;
80 std::string SplitDwarfFile;
81 std::string AsSecureLogFile;
82
83 const char *Argv0 = nullptr;
84 ArrayRef<std::string> CommandLineArgs;
85
86 /// Additional paths to search for `.include` directives when using the
87 /// integrated assembler.
88 std::vector<std::string> IASSearchPaths;
89
90 // Whether to emit compact-unwind for non-canonical personality
91 // functions on Darwins.
92 bool EmitCompactUnwindNonCanonical : 1;
93
94 // Whether or not to use full register names on PowerPC.
95 bool PPCUseFullRegisterNames : 1;
96
97 MCTargetOptions();
98
99 /// getABIName - If this returns a non-empty string this represents the
100 /// textual name of the ABI that we want the backend to use, e.g. o32, or
101 /// aapcs-linux.
102 StringRef getABIName() const;
103
104 /// getAssemblyLanguage - If this returns a non-empty string this represents
105 /// the textual name of the assembly language that we will use for this
106 /// target, e.g. masm.
107 StringRef getAssemblyLanguage() const;
108};
109
110} // end namespace llvm
111
112#endif // LLVM_MC_MCTARGETOPTIONS_H
113

source code of llvm/include/llvm/MC/MCTargetOptions.h