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};
28
29enum class EmitDwarfUnwindType {
30 Always, // Always emit dwarf unwind
31 NoCompactUnwind, // Only emit if compact unwind isn't available
32 Default, // Default behavior is based on the target
33};
34
35class StringRef;
36
37class MCTargetOptions {
38public:
39 enum AsmInstrumentation {
40 AsmInstrumentationNone,
41 AsmInstrumentationAddress
42 };
43
44 bool MCRelaxAll : 1;
45 bool MCNoExecStack : 1;
46 bool MCFatalWarnings : 1;
47 bool MCNoWarn : 1;
48 bool MCNoDeprecatedWarn : 1;
49 bool MCNoTypeCheck : 1;
50 bool MCSaveTempLabels : 1;
51 bool MCIncrementalLinkerCompatible : 1;
52 bool ShowMCEncoding : 1;
53 bool ShowMCInst : 1;
54 bool AsmVerbose : 1;
55
56 /// Preserve Comments in Assembly.
57 bool PreserveAsmComments : 1;
58
59 bool Dwarf64 : 1;
60
61 EmitDwarfUnwindType EmitDwarfUnwind;
62
63 int DwarfVersion = 0;
64
65 enum DwarfDirectory {
66 // Force disable
67 DisableDwarfDirectory,
68 // Force enable, for assemblers that support
69 // `.file fileno directory filename' syntax
70 EnableDwarfDirectory,
71 // Default is based on the target
72 DefaultDwarfDirectory
73 };
74 DwarfDirectory MCUseDwarfDirectory;
75
76 std::string ABIName;
77 std::string AssemblyLanguage;
78 std::string SplitDwarfFile;
79 std::string AsSecureLogFile;
80
81 const char *Argv0 = nullptr;
82 ArrayRef<std::string> CommandLineArgs;
83
84 /// Additional paths to search for `.include` directives when using the
85 /// integrated assembler.
86 std::vector<std::string> IASSearchPaths;
87
88 // Whether to emit compact-unwind for non-canonical personality
89 // functions on Darwins.
90 bool EmitCompactUnwindNonCanonical : 1;
91
92 MCTargetOptions();
93
94 /// getABIName - If this returns a non-empty string this represents the
95 /// textual name of the ABI that we want the backend to use, e.g. o32, or
96 /// aapcs-linux.
97 StringRef getABIName() const;
98
99 /// getAssemblyLanguage - If this returns a non-empty string this represents
100 /// the textual name of the assembly language that we will use for this
101 /// target, e.g. masm.
102 StringRef getAssemblyLanguage() const;
103};
104
105} // end namespace llvm
106
107#endif // LLVM_MC_MCTARGETOPTIONS_H
108

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