LLVM 24.0.0git
MCTargetOptions.h
Go to the documentation of this file.
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"
16#include <string>
17#include <utility>
18#include <vector>
19
20namespace llvm {
21
23 Always, // Always emit dwarf unwind
24 NoCompactUnwind, // Only emit if compact unwind isn't available
25 DwarfOnly, // Force compact unwind to reference DWARF
26 Default, // Default behavior is based on the target
27};
28
29// For ELF targets, whether to adjust relocations referencing eligible local
30// symbols to use section symbols.
32 All, // For all eligible local symbols (default)
33 Internal, // For .L symbols
34 None, // Never use section symbols
35};
36
37class StringRef;
38namespace cl {
39class LibraryOptionsContext;
40} // namespace cl
41
43public:
48
49 bool MCRelaxAll : 1;
50 bool MCNoExecStack : 1;
52 bool MCNoWarn : 1;
54 bool MCNoTypeCheck : 1;
57 bool FDPIC : 1;
59 bool ShowMCInst : 1;
60 bool AsmVerbose : 1;
61
62 /// Preserve Comments in Assembly.
64
65 bool Dwarf64 : 1;
66
67 // Use CREL relocation format for ELF.
68 bool Crel = false;
69
70 bool ImplicitMapSyms = false;
71
72 /// Use relocations for DWARF cross-section offsets in Mach-O.
74
75 // If true, prefer R_X86_64_[REX_]GOTPCRELX to R_X86_64_GOTPCREL on x86-64
76 // ELF.
78
79 bool X86Sse2Avx = false;
80
81 // Disable the integrated assembler.
82 bool DisableIntegratedAS = false;
83
84 // For ELF relocations, controls section symbol conversion.
86
87 std::optional<unsigned> OutputAsmVariant;
88
90
91 int DwarfVersion = 0;
92
93 /// If greater than 0, overrides the default MCAsmInfo binutils version.
94 std::pair<int, int> BinutilsVersion = {0, 0};
95
97 // Force disable
99 // Force enable, for assemblers that support
100 // `.file fileno directory filename' syntax
102 // Default is based on the target
104 };
106
107 // Whether to compress DWARF debug sections.
109
110 std::string ABIName;
111 std::string AssemblyLanguage;
112 std::string SplitDwarfFile;
113 std::string AsSecureLogFile;
114
115 // Used for codeview debug info. These will be set as compiler path and commandline arguments in LF_BUILDINFO
116 std::string Argv0;
117 std::string CommandlineArgs;
118
119 /// Additional paths to search for `.include` directives when using the
120 /// integrated assembler.
121 std::vector<std::string> IASSearchPaths;
122
123 // InstPrinter options.
124 std::vector<std::string> InstPrinterOptions;
125
126 // Whether to emit compact-unwind for non-canonical personality
127 // functions on Darwins.
129
130 // Whether to emit SFrame unwind sections.
132
133 // Whether or not to use full register names on PowerPC.
135
136 // Force 8-byte (sdata8) pointer encodings for ELF exception-handling.
137 // On x86_64 this affects the .eh_frame FDE CFI plus the personality, LSDA,
138 // and TType encodings; on AArch64/PPC64 only the FDE CFI encoding changes
139 // (personality/LSDA/TType already default to sdata8).
140 bool LargeEHEncoding = false;
141
142 // The library options of the compilation, usually its LLVMContext's.
143 // TODO: Make it non-null once every tool sets it. Null means the global
144 // values.
146
148
149 /// Parse a binutils version string ("major[.minor]" or "none") into a
150 /// (major, minor) pair. "none" maps to {INT_MAX, INT_MAX}.
151 LLVM_ABI static std::pair<int, int> parseBinutilsVersion(StringRef Version);
152
153 /// getABIName - If this returns a non-empty string this represents the
154 /// textual name of the ABI that we want the backend to use, e.g. o32, or
155 /// aapcs-linux.
157
158 /// getAssemblyLanguage - If this returns a non-empty string this represents
159 /// the textual name of the assembly language that we will use for this
160 /// target, e.g. masm.
162};
163
164} // end namespace llvm
165
166#endif // LLVM_MC_MCTARGETOPTIONS_H
#define LLVM_ABI
Definition Compiler.h:211
bool PreserveAsmComments
Preserve Comments in Assembly.
DwarfDirectory MCUseDwarfDirectory
EmitDwarfUnwindType EmitDwarfUnwind
std::vector< std::string > InstPrinterOptions
RelocSectionSymType RelocSectionSym
const cl::LibraryOptionsContext * LibraryOptions
std::optional< unsigned > OutputAsmVariant
DebugCompressionType CompressDebugSections
std::vector< std::string > IASSearchPaths
Additional paths to search for .include directives when using the integrated assembler.
LLVM_ABI StringRef getAssemblyLanguage() const
getAssemblyLanguage - If this returns a non-empty string this represents the textual name of the asse...
std::pair< int, int > BinutilsVersion
If greater than 0, overrides the default MCAsmInfo binutils version.
LLVM_ABI StringRef getABIName() const
getABIName - If this returns a non-empty string this represents the textual name of the ABI that we w...
static LLVM_ABI std::pair< int, int > parseBinutilsVersion(StringRef Version)
Parse a binutils version string ("major[.minor]" or "none") into a (major, minor) pair.
bool MachORelocatableDwarf
Use relocations for DWARF cross-section offsets in Mach-O.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This is an optimization pass for GlobalISel generic memory operations.
RelocSectionSymType
EmitDwarfUnwindType
DebugCompressionType
Definition Compression.h:28
@ None
No compression.
Definition Compression.h:29
@ Always
Always emit .debug_str_offsets talbes as DWARF64 for testing.
Definition DWP.h:32