/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/CommandFlags.inc
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- CommandFlags.h - Command Line Flags Interface -----------*- 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 | | // This file contains codegen-specific flags that are shared between different |
10 | | // command line tools. The tools "llc" and "opt" both use this file to prevent |
11 | | // flag duplication. |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #include "llvm/ADT/StringExtras.h" |
16 | | #include "llvm/IR/Instructions.h" |
17 | | #include "llvm/IR/Intrinsics.h" |
18 | | #include "llvm/IR/Module.h" |
19 | | #include "llvm/MC/MCTargetOptionsCommandFlags.inc" |
20 | | #include "llvm/MC/SubtargetFeature.h" |
21 | | #include "llvm/Support/CodeGen.h" |
22 | | #include "llvm/Support/CommandLine.h" |
23 | | #include "llvm/Support/Host.h" |
24 | | #include "llvm/Target/TargetMachine.h" |
25 | | #include "llvm/Target/TargetOptions.h" |
26 | | #include <string> |
27 | | using namespace llvm; |
28 | | |
29 | | static cl::opt<std::string> |
30 | | MArch("march", |
31 | | cl::desc("Architecture to generate code for (see --version)")); |
32 | | |
33 | | static cl::opt<std::string> |
34 | | MCPU("mcpu", |
35 | | cl::desc("Target a specific cpu type (-mcpu=help for details)"), |
36 | | cl::value_desc("cpu-name"), cl::init("")); |
37 | | |
38 | | static cl::list<std::string> |
39 | | MAttrs("mattr", cl::CommaSeparated, |
40 | | cl::desc("Target specific attributes (-mattr=help for details)"), |
41 | | cl::value_desc("a1,+a2,-a3,...")); |
42 | | |
43 | | static cl::opt<Reloc::Model> RelocModel( |
44 | | "relocation-model", cl::desc("Choose relocation model"), |
45 | | cl::values( |
46 | | clEnumValN(Reloc::Static, "static", "Non-relocatable code"), |
47 | | clEnumValN(Reloc::PIC_, "pic", |
48 | | "Fully relocatable, position independent code"), |
49 | | clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", |
50 | | "Relocatable external references, non-relocatable code"), |
51 | | clEnumValN(Reloc::ROPI, "ropi", |
52 | | "Code and read-only data relocatable, accessed PC-relative"), |
53 | | clEnumValN( |
54 | | Reloc::RWPI, "rwpi", |
55 | | "Read-write data relocatable, accessed relative to static base"), |
56 | | clEnumValN(Reloc::ROPI_RWPI, "ropi-rwpi", |
57 | | "Combination of ropi and rwpi"))); |
58 | | |
59 | 32.3k | LLVM_ATTRIBUTE_UNUSED static Optional<Reloc::Model> getRelocModel() { |
60 | 32.3k | if (RelocModel.getNumOccurrences()) { |
61 | 2.00k | Reloc::Model R = RelocModel; |
62 | 2.00k | return R; |
63 | 2.00k | } |
64 | 30.3k | return None; |
65 | 30.3k | } Line | Count | Source | 59 | 4.57k | LLVM_ATTRIBUTE_UNUSED static Optional<Reloc::Model> getRelocModel() { | 60 | 4.57k | if (RelocModel.getNumOccurrences()) { | 61 | 11 | Reloc::Model R = RelocModel; | 62 | 11 | return R; | 63 | 11 | } | 64 | 4.56k | return None; | 65 | 4.56k | } |
Line | Count | Source | 59 | 24.9k | LLVM_ATTRIBUTE_UNUSED static Optional<Reloc::Model> getRelocModel() { | 60 | 24.9k | if (RelocModel.getNumOccurrences()) { | 61 | 1.99k | Reloc::Model R = RelocModel; | 62 | 1.99k | return R; | 63 | 1.99k | } | 64 | 22.9k | return None; | 65 | 22.9k | } |
TargetOptionsCommandFlags.cpp:getRelocModel() Line | Count | Source | 59 | 2.78k | LLVM_ATTRIBUTE_UNUSED static Optional<Reloc::Model> getRelocModel() { | 60 | 2.78k | if (RelocModel.getNumOccurrences()) { | 61 | 2 | Reloc::Model R = RelocModel; | 62 | 2 | return R; | 63 | 2 | } | 64 | 2.77k | return None; | 65 | 2.77k | } |
|
66 | | |
67 | | static cl::opt<ThreadModel::Model> TMModel( |
68 | | "thread-model", cl::desc("Choose threading model"), |
69 | | cl::init(ThreadModel::POSIX), |
70 | | cl::values(clEnumValN(ThreadModel::POSIX, "posix", "POSIX thread model"), |
71 | | clEnumValN(ThreadModel::Single, "single", |
72 | | "Single thread model"))); |
73 | | |
74 | | static cl::opt<llvm::CodeModel::Model> CMModel( |
75 | | "code-model", cl::desc("Choose code model"), |
76 | | cl::values(clEnumValN(CodeModel::Tiny, "tiny", "Tiny code model"), |
77 | | clEnumValN(CodeModel::Small, "small", "Small code model"), |
78 | | clEnumValN(CodeModel::Kernel, "kernel", "Kernel code model"), |
79 | | clEnumValN(CodeModel::Medium, "medium", "Medium code model"), |
80 | | clEnumValN(CodeModel::Large, "large", "Large code model"))); |
81 | | |
82 | 32.3k | LLVM_ATTRIBUTE_UNUSED static Optional<CodeModel::Model> getCodeModel() { |
83 | 32.3k | if (CMModel.getNumOccurrences()) { |
84 | 219 | CodeModel::Model M = CMModel; |
85 | 219 | return M; |
86 | 219 | } |
87 | 32.1k | return None; |
88 | 32.1k | } Line | Count | Source | 82 | 4.57k | LLVM_ATTRIBUTE_UNUSED static Optional<CodeModel::Model> getCodeModel() { | 83 | 4.57k | if (CMModel.getNumOccurrences()) { | 84 | 0 | CodeModel::Model M = CMModel; | 85 | 0 | return M; | 86 | 0 | } | 87 | 4.57k | return None; | 88 | 4.57k | } |
Line | Count | Source | 82 | 24.9k | LLVM_ATTRIBUTE_UNUSED static Optional<CodeModel::Model> getCodeModel() { | 83 | 24.9k | if (CMModel.getNumOccurrences()) { | 84 | 217 | CodeModel::Model M = CMModel; | 85 | 217 | return M; | 86 | 217 | } | 87 | 24.7k | return None; | 88 | 24.7k | } |
TargetOptionsCommandFlags.cpp:getCodeModel() Line | Count | Source | 82 | 2.78k | LLVM_ATTRIBUTE_UNUSED static Optional<CodeModel::Model> getCodeModel() { | 83 | 2.78k | if (CMModel.getNumOccurrences()) { | 84 | 2 | CodeModel::Model M = CMModel; | 85 | 2 | return M; | 86 | 2 | } | 87 | 2.77k | return None; | 88 | 2.77k | } |
|
89 | | |
90 | | static cl::opt<llvm::ExceptionHandling> ExceptionModel( |
91 | | "exception-model", cl::desc("exception model"), |
92 | | cl::init(ExceptionHandling::None), |
93 | | cl::values( |
94 | | clEnumValN(ExceptionHandling::None, "default", |
95 | | "default exception handling model"), |
96 | | clEnumValN(ExceptionHandling::DwarfCFI, "dwarf", |
97 | | "DWARF-like CFI based exception handling"), |
98 | | clEnumValN(ExceptionHandling::SjLj, "sjlj", "SjLj exception handling"), |
99 | | clEnumValN(ExceptionHandling::ARM, "arm", "ARM EHABI exceptions"), |
100 | | clEnumValN(ExceptionHandling::WinEH, "wineh", |
101 | | "Windows exception model"), |
102 | | clEnumValN(ExceptionHandling::Wasm, "wasm", |
103 | | "WebAssembly exception handling"))); |
104 | | |
105 | | static cl::opt<TargetMachine::CodeGenFileType> FileType( |
106 | | "filetype", cl::init(TargetMachine::CGFT_AssemblyFile), |
107 | | cl::desc( |
108 | | "Choose a file type (not all types are supported by all targets):"), |
109 | | cl::values(clEnumValN(TargetMachine::CGFT_AssemblyFile, "asm", |
110 | | "Emit an assembly ('.s') file"), |
111 | | clEnumValN(TargetMachine::CGFT_ObjectFile, "obj", |
112 | | "Emit a native object ('.o') file"), |
113 | | clEnumValN(TargetMachine::CGFT_Null, "null", |
114 | | "Emit nothing, for performance testing"))); |
115 | | |
116 | | static cl::opt<llvm::FramePointer::FP> FramePointerUsage( |
117 | | "frame-pointer", cl::desc("Specify frame pointer elimination optimization"), |
118 | | cl::init(llvm::FramePointer::None), |
119 | | cl::values( |
120 | | clEnumValN(llvm::FramePointer::All, "all", |
121 | | "Disable frame pointer elimination"), |
122 | | clEnumValN(llvm::FramePointer::NonLeaf, "non-leaf", |
123 | | "Disable frame pointer elimination for non-leaf frame"), |
124 | | clEnumValN(llvm::FramePointer::None, "none", |
125 | | "Enable frame pointer elimination"))); |
126 | | |
127 | | static cl::opt<bool> EnableUnsafeFPMath( |
128 | | "enable-unsafe-fp-math", |
129 | | cl::desc("Enable optimizations that may decrease FP precision"), |
130 | | cl::init(false)); |
131 | | |
132 | | static cl::opt<bool> EnableNoInfsFPMath( |
133 | | "enable-no-infs-fp-math", |
134 | | cl::desc("Enable FP math optimizations that assume no +-Infs"), |
135 | | cl::init(false)); |
136 | | |
137 | | static cl::opt<bool> EnableNoNaNsFPMath( |
138 | | "enable-no-nans-fp-math", |
139 | | cl::desc("Enable FP math optimizations that assume no NaNs"), |
140 | | cl::init(false)); |
141 | | |
142 | | static cl::opt<bool> EnableNoSignedZerosFPMath( |
143 | | "enable-no-signed-zeros-fp-math", |
144 | | cl::desc("Enable FP math optimizations that assume " |
145 | | "the sign of 0 is insignificant"), |
146 | | cl::init(false)); |
147 | | |
148 | | static cl::opt<bool> |
149 | | EnableNoTrappingFPMath("enable-no-trapping-fp-math", |
150 | | cl::desc("Enable setting the FP exceptions build " |
151 | | "attribute not to use exceptions"), |
152 | | cl::init(false)); |
153 | | |
154 | | static cl::opt<llvm::FPDenormal::DenormalMode> DenormalMode( |
155 | | "denormal-fp-math", |
156 | | cl::desc("Select which denormal numbers the code is permitted to require"), |
157 | | cl::init(FPDenormal::IEEE), |
158 | | cl::values(clEnumValN(FPDenormal::IEEE, "ieee", |
159 | | "IEEE 754 denormal numbers"), |
160 | | clEnumValN(FPDenormal::PreserveSign, "preserve-sign", |
161 | | "the sign of a flushed-to-zero number is preserved " |
162 | | "in the sign of 0"), |
163 | | clEnumValN(FPDenormal::PositiveZero, "positive-zero", |
164 | | "denormals are flushed to positive zero"))); |
165 | | |
166 | | static cl::opt<bool> EnableHonorSignDependentRoundingFPMath( |
167 | | "enable-sign-dependent-rounding-fp-math", cl::Hidden, |
168 | | cl::desc("Force codegen to assume rounding mode can change dynamically"), |
169 | | cl::init(false)); |
170 | | |
171 | | static cl::opt<llvm::FloatABI::ABIType> FloatABIForCalls( |
172 | | "float-abi", cl::desc("Choose float ABI type"), cl::init(FloatABI::Default), |
173 | | cl::values(clEnumValN(FloatABI::Default, "default", |
174 | | "Target default float ABI type"), |
175 | | clEnumValN(FloatABI::Soft, "soft", |
176 | | "Soft float ABI (implied by -soft-float)"), |
177 | | clEnumValN(FloatABI::Hard, "hard", |
178 | | "Hard float ABI (uses FP registers)"))); |
179 | | |
180 | | static cl::opt<llvm::FPOpFusion::FPOpFusionMode> FuseFPOps( |
181 | | "fp-contract", cl::desc("Enable aggressive formation of fused FP ops"), |
182 | | cl::init(FPOpFusion::Standard), |
183 | | cl::values( |
184 | | clEnumValN(FPOpFusion::Fast, "fast", "Fuse FP ops whenever profitable"), |
185 | | clEnumValN(FPOpFusion::Standard, "on", "Only fuse 'blessed' FP ops."), |
186 | | clEnumValN(FPOpFusion::Strict, "off", |
187 | | "Only fuse FP ops when the result won't be affected."))); |
188 | | |
189 | | static cl::opt<bool> DontPlaceZerosInBSS( |
190 | | "nozero-initialized-in-bss", |
191 | | cl::desc("Don't place zero-initialized symbols into bss section"), |
192 | | cl::init(false)); |
193 | | |
194 | | static cl::opt<bool> EnableGuaranteedTailCallOpt( |
195 | | "tailcallopt", |
196 | | cl::desc( |
197 | | "Turn fastcc calls into tail calls by (potentially) changing ABI."), |
198 | | cl::init(false)); |
199 | | |
200 | | static cl::opt<bool> DisableTailCalls("disable-tail-calls", |
201 | | cl::desc("Never emit tail calls"), |
202 | | cl::init(false)); |
203 | | |
204 | | static cl::opt<bool> StackSymbolOrdering("stack-symbol-ordering", |
205 | | cl::desc("Order local stack symbols."), |
206 | | cl::init(true)); |
207 | | |
208 | | static cl::opt<unsigned> |
209 | | OverrideStackAlignment("stack-alignment", |
210 | | cl::desc("Override default stack alignment"), |
211 | | cl::init(0)); |
212 | | |
213 | | static cl::opt<bool> |
214 | | StackRealign("stackrealign", |
215 | | cl::desc("Force align the stack to the minimum alignment"), |
216 | | cl::init(false)); |
217 | | |
218 | | static cl::opt<std::string> TrapFuncName( |
219 | | "trap-func", cl::Hidden, |
220 | | cl::desc("Emit a call to trap function rather than a trap instruction"), |
221 | | cl::init("")); |
222 | | |
223 | | static cl::opt<bool> UseCtors("use-ctors", |
224 | | cl::desc("Use .ctors instead of .init_array."), |
225 | | cl::init(false)); |
226 | | |
227 | | static cl::opt<bool> RelaxELFRelocations( |
228 | | "relax-elf-relocations", |
229 | | cl::desc("Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"), |
230 | | cl::init(false)); |
231 | | |
232 | | static cl::opt<bool> DataSections("data-sections", |
233 | | cl::desc("Emit data into separate sections"), |
234 | | cl::init(false)); |
235 | | |
236 | | static cl::opt<bool> |
237 | | FunctionSections("function-sections", |
238 | | cl::desc("Emit functions into separate sections"), |
239 | | cl::init(false)); |
240 | | |
241 | | static cl::opt<bool> EmulatedTLS("emulated-tls", |
242 | | cl::desc("Use emulated TLS model"), |
243 | | cl::init(false)); |
244 | | |
245 | | static cl::opt<bool> |
246 | | UniqueSectionNames("unique-section-names", |
247 | | cl::desc("Give unique names to every section"), |
248 | | cl::init(true)); |
249 | | |
250 | | static cl::opt<llvm::EABI> |
251 | | EABIVersion("meabi", cl::desc("Set EABI type (default depends on triple):"), |
252 | | cl::init(EABI::Default), |
253 | | cl::values(clEnumValN(EABI::Default, "default", |
254 | | "Triple default EABI version"), |
255 | | clEnumValN(EABI::EABI4, "4", "EABI version 4"), |
256 | | clEnumValN(EABI::EABI5, "5", "EABI version 5"), |
257 | | clEnumValN(EABI::GNU, "gnu", "EABI GNU"))); |
258 | | |
259 | | static cl::opt<DebuggerKind> DebuggerTuningOpt( |
260 | | "debugger-tune", cl::desc("Tune debug info for a particular debugger"), |
261 | | cl::init(DebuggerKind::Default), |
262 | | cl::values(clEnumValN(DebuggerKind::GDB, "gdb", "gdb"), |
263 | | clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"), |
264 | | clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)"))); |
265 | | |
266 | | static cl::opt<bool> EnableStackSizeSection( |
267 | | "stack-size-section", |
268 | | cl::desc("Emit a section containing stack size metadata"), cl::init(false)); |
269 | | |
270 | | static cl::opt<bool> |
271 | | EnableAddrsig("addrsig", cl::desc("Emit an address-significance table"), |
272 | | cl::init(false)); |
273 | | |
274 | | static cl::opt<bool> |
275 | | EnableDebugEntryValues("debug-entry-values", |
276 | | cl::desc("Emit debug info about parameter's entry values"), |
277 | | cl::init(false)); |
278 | | |
279 | | // Common utility function tightly tied to the options listed here. Initializes |
280 | | // a TargetOptions object with CodeGen flags and returns it. |
281 | 38.7k | static TargetOptions InitTargetOptionsFromCodeGenFlags() { |
282 | 38.7k | TargetOptions Options; |
283 | 38.7k | Options.AllowFPOpFusion = FuseFPOps; |
284 | 38.7k | Options.UnsafeFPMath = EnableUnsafeFPMath; |
285 | 38.7k | Options.NoInfsFPMath = EnableNoInfsFPMath; |
286 | 38.7k | Options.NoNaNsFPMath = EnableNoNaNsFPMath; |
287 | 38.7k | Options.NoSignedZerosFPMath = EnableNoSignedZerosFPMath; |
288 | 38.7k | Options.NoTrappingFPMath = EnableNoTrappingFPMath; |
289 | 38.7k | Options.FPDenormalMode = DenormalMode; |
290 | 38.7k | Options.HonorSignDependentRoundingFPMathOption = |
291 | 38.7k | EnableHonorSignDependentRoundingFPMath; |
292 | 38.7k | if (FloatABIForCalls != FloatABI::Default) |
293 | 133 | Options.FloatABIType = FloatABIForCalls; |
294 | 38.7k | Options.NoZerosInBSS = DontPlaceZerosInBSS; |
295 | 38.7k | Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; |
296 | 38.7k | Options.StackAlignmentOverride = OverrideStackAlignment; |
297 | 38.7k | Options.StackSymbolOrdering = StackSymbolOrdering; |
298 | 38.7k | Options.UseInitArray = !UseCtors; |
299 | 38.7k | Options.RelaxELFRelocations = RelaxELFRelocations; |
300 | 38.7k | Options.DataSections = DataSections; |
301 | 38.7k | Options.FunctionSections = FunctionSections; |
302 | 38.7k | Options.UniqueSectionNames = UniqueSectionNames; |
303 | 38.7k | Options.EmulatedTLS = EmulatedTLS; |
304 | 38.7k | Options.ExplicitEmulatedTLS = EmulatedTLS.getNumOccurrences() > 0; |
305 | 38.7k | Options.ExceptionModel = ExceptionModel; |
306 | 38.7k | Options.EmitStackSizeSection = EnableStackSizeSection; |
307 | 38.7k | Options.EmitAddrsig = EnableAddrsig; |
308 | 38.7k | Options.EnableDebugEntryValues = EnableDebugEntryValues; |
309 | 38.7k | |
310 | 38.7k | Options.MCOptions = InitMCTargetOptionsFromFlags(); |
311 | 38.7k | |
312 | 38.7k | Options.ThreadModel = TMModel; |
313 | 38.7k | Options.EABIVersion = EABIVersion; |
314 | 38.7k | Options.DebuggerTuning = DebuggerTuningOpt; |
315 | 38.7k | |
316 | 38.7k | return Options; |
317 | 38.7k | } opt.cpp:InitTargetOptionsFromCodeGenFlags() Line | Count | Source | 281 | 10.9k | static TargetOptions InitTargetOptionsFromCodeGenFlags() { | 282 | 10.9k | TargetOptions Options; | 283 | 10.9k | Options.AllowFPOpFusion = FuseFPOps; | 284 | 10.9k | Options.UnsafeFPMath = EnableUnsafeFPMath; | 285 | 10.9k | Options.NoInfsFPMath = EnableNoInfsFPMath; | 286 | 10.9k | Options.NoNaNsFPMath = EnableNoNaNsFPMath; | 287 | 10.9k | Options.NoSignedZerosFPMath = EnableNoSignedZerosFPMath; | 288 | 10.9k | Options.NoTrappingFPMath = EnableNoTrappingFPMath; | 289 | 10.9k | Options.FPDenormalMode = DenormalMode; | 290 | 10.9k | Options.HonorSignDependentRoundingFPMathOption = | 291 | 10.9k | EnableHonorSignDependentRoundingFPMath; | 292 | 10.9k | if (FloatABIForCalls != FloatABI::Default) | 293 | 0 | Options.FloatABIType = FloatABIForCalls; | 294 | 10.9k | Options.NoZerosInBSS = DontPlaceZerosInBSS; | 295 | 10.9k | Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; | 296 | 10.9k | Options.StackAlignmentOverride = OverrideStackAlignment; | 297 | 10.9k | Options.StackSymbolOrdering = StackSymbolOrdering; | 298 | 10.9k | Options.UseInitArray = !UseCtors; | 299 | 10.9k | Options.RelaxELFRelocations = RelaxELFRelocations; | 300 | 10.9k | Options.DataSections = DataSections; | 301 | 10.9k | Options.FunctionSections = FunctionSections; | 302 | 10.9k | Options.UniqueSectionNames = UniqueSectionNames; | 303 | 10.9k | Options.EmulatedTLS = EmulatedTLS; | 304 | 10.9k | Options.ExplicitEmulatedTLS = EmulatedTLS.getNumOccurrences() > 0; | 305 | 10.9k | Options.ExceptionModel = ExceptionModel; | 306 | 10.9k | Options.EmitStackSizeSection = EnableStackSizeSection; | 307 | 10.9k | Options.EmitAddrsig = EnableAddrsig; | 308 | 10.9k | Options.EnableDebugEntryValues = EnableDebugEntryValues; | 309 | 10.9k | | 310 | 10.9k | Options.MCOptions = InitMCTargetOptionsFromFlags(); | 311 | 10.9k | | 312 | 10.9k | Options.ThreadModel = TMModel; | 313 | 10.9k | Options.EABIVersion = EABIVersion; | 314 | 10.9k | Options.DebuggerTuning = DebuggerTuningOpt; | 315 | 10.9k | | 316 | 10.9k | return Options; | 317 | 10.9k | } |
llc.cpp:InitTargetOptionsFromCodeGenFlags() Line | Count | Source | 281 | 24.9k | static TargetOptions InitTargetOptionsFromCodeGenFlags() { | 282 | 24.9k | TargetOptions Options; | 283 | 24.9k | Options.AllowFPOpFusion = FuseFPOps; | 284 | 24.9k | Options.UnsafeFPMath = EnableUnsafeFPMath; | 285 | 24.9k | Options.NoInfsFPMath = EnableNoInfsFPMath; | 286 | 24.9k | Options.NoNaNsFPMath = EnableNoNaNsFPMath; | 287 | 24.9k | Options.NoSignedZerosFPMath = EnableNoSignedZerosFPMath; | 288 | 24.9k | Options.NoTrappingFPMath = EnableNoTrappingFPMath; | 289 | 24.9k | Options.FPDenormalMode = DenormalMode; | 290 | 24.9k | Options.HonorSignDependentRoundingFPMathOption = | 291 | 24.9k | EnableHonorSignDependentRoundingFPMath; | 292 | 24.9k | if (FloatABIForCalls != FloatABI::Default) | 293 | 133 | Options.FloatABIType = FloatABIForCalls; | 294 | 24.9k | Options.NoZerosInBSS = DontPlaceZerosInBSS; | 295 | 24.9k | Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; | 296 | 24.9k | Options.StackAlignmentOverride = OverrideStackAlignment; | 297 | 24.9k | Options.StackSymbolOrdering = StackSymbolOrdering; | 298 | 24.9k | Options.UseInitArray = !UseCtors; | 299 | 24.9k | Options.RelaxELFRelocations = RelaxELFRelocations; | 300 | 24.9k | Options.DataSections = DataSections; | 301 | 24.9k | Options.FunctionSections = FunctionSections; | 302 | 24.9k | Options.UniqueSectionNames = UniqueSectionNames; | 303 | 24.9k | Options.EmulatedTLS = EmulatedTLS; | 304 | 24.9k | Options.ExplicitEmulatedTLS = EmulatedTLS.getNumOccurrences() > 0; | 305 | 24.9k | Options.ExceptionModel = ExceptionModel; | 306 | 24.9k | Options.EmitStackSizeSection = EnableStackSizeSection; | 307 | 24.9k | Options.EmitAddrsig = EnableAddrsig; | 308 | 24.9k | Options.EnableDebugEntryValues = EnableDebugEntryValues; | 309 | 24.9k | | 310 | 24.9k | Options.MCOptions = InitMCTargetOptionsFromFlags(); | 311 | 24.9k | | 312 | 24.9k | Options.ThreadModel = TMModel; | 313 | 24.9k | Options.EABIVersion = EABIVersion; | 314 | 24.9k | Options.DebuggerTuning = DebuggerTuningOpt; | 315 | 24.9k | | 316 | 24.9k | return Options; | 317 | 24.9k | } |
TargetOptionsCommandFlags.cpp:InitTargetOptionsFromCodeGenFlags() Line | Count | Source | 281 | 2.86k | static TargetOptions InitTargetOptionsFromCodeGenFlags() { | 282 | 2.86k | TargetOptions Options; | 283 | 2.86k | Options.AllowFPOpFusion = FuseFPOps; | 284 | 2.86k | Options.UnsafeFPMath = EnableUnsafeFPMath; | 285 | 2.86k | Options.NoInfsFPMath = EnableNoInfsFPMath; | 286 | 2.86k | Options.NoNaNsFPMath = EnableNoNaNsFPMath; | 287 | 2.86k | Options.NoSignedZerosFPMath = EnableNoSignedZerosFPMath; | 288 | 2.86k | Options.NoTrappingFPMath = EnableNoTrappingFPMath; | 289 | 2.86k | Options.FPDenormalMode = DenormalMode; | 290 | 2.86k | Options.HonorSignDependentRoundingFPMathOption = | 291 | 2.86k | EnableHonorSignDependentRoundingFPMath; | 292 | 2.86k | if (FloatABIForCalls != FloatABI::Default) | 293 | 0 | Options.FloatABIType = FloatABIForCalls; | 294 | 2.86k | Options.NoZerosInBSS = DontPlaceZerosInBSS; | 295 | 2.86k | Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; | 296 | 2.86k | Options.StackAlignmentOverride = OverrideStackAlignment; | 297 | 2.86k | Options.StackSymbolOrdering = StackSymbolOrdering; | 298 | 2.86k | Options.UseInitArray = !UseCtors; | 299 | 2.86k | Options.RelaxELFRelocations = RelaxELFRelocations; | 300 | 2.86k | Options.DataSections = DataSections; | 301 | 2.86k | Options.FunctionSections = FunctionSections; | 302 | 2.86k | Options.UniqueSectionNames = UniqueSectionNames; | 303 | 2.86k | Options.EmulatedTLS = EmulatedTLS; | 304 | 2.86k | Options.ExplicitEmulatedTLS = EmulatedTLS.getNumOccurrences() > 0; | 305 | 2.86k | Options.ExceptionModel = ExceptionModel; | 306 | 2.86k | Options.EmitStackSizeSection = EnableStackSizeSection; | 307 | 2.86k | Options.EmitAddrsig = EnableAddrsig; | 308 | 2.86k | Options.EnableDebugEntryValues = EnableDebugEntryValues; | 309 | 2.86k | | 310 | 2.86k | Options.MCOptions = InitMCTargetOptionsFromFlags(); | 311 | 2.86k | | 312 | 2.86k | Options.ThreadModel = TMModel; | 313 | 2.86k | Options.EABIVersion = EABIVersion; | 314 | 2.86k | Options.DebuggerTuning = DebuggerTuningOpt; | 315 | 2.86k | | 316 | 2.86k | return Options; | 317 | 2.86k | } |
|
318 | | |
319 | 32.3k | LLVM_ATTRIBUTE_UNUSED static std::string getCPUStr() { |
320 | 32.3k | // If user asked for the 'native' CPU, autodetect here. If autodection fails, |
321 | 32.3k | // this will set the CPU to an empty string which tells the target to |
322 | 32.3k | // pick a basic default. |
323 | 32.3k | if (MCPU == "native") |
324 | 0 | return sys::getHostCPUName(); |
325 | 32.3k | |
326 | 32.3k | return MCPU; |
327 | 32.3k | } Line | Count | Source | 319 | 4.58k | LLVM_ATTRIBUTE_UNUSED static std::string getCPUStr() { | 320 | 4.58k | // If user asked for the 'native' CPU, autodetect here. If autodection fails, | 321 | 4.58k | // this will set the CPU to an empty string which tells the target to | 322 | 4.58k | // pick a basic default. | 323 | 4.58k | if (MCPU == "native") | 324 | 0 | return sys::getHostCPUName(); | 325 | 4.58k | | 326 | 4.58k | return MCPU; | 327 | 4.58k | } |
Line | Count | Source | 319 | 24.9k | LLVM_ATTRIBUTE_UNUSED static std::string getCPUStr() { | 320 | 24.9k | // If user asked for the 'native' CPU, autodetect here. If autodection fails, | 321 | 24.9k | // this will set the CPU to an empty string which tells the target to | 322 | 24.9k | // pick a basic default. | 323 | 24.9k | if (MCPU == "native") | 324 | 0 | return sys::getHostCPUName(); | 325 | 24.9k | | 326 | 24.9k | return MCPU; | 327 | 24.9k | } |
TargetOptionsCommandFlags.cpp:getCPUStr() Line | Count | Source | 319 | 2.83k | LLVM_ATTRIBUTE_UNUSED static std::string getCPUStr() { | 320 | 2.83k | // If user asked for the 'native' CPU, autodetect here. If autodection fails, | 321 | 2.83k | // this will set the CPU to an empty string which tells the target to | 322 | 2.83k | // pick a basic default. | 323 | 2.83k | if (MCPU == "native") | 324 | 0 | return sys::getHostCPUName(); | 325 | 2.83k | | 326 | 2.83k | return MCPU; | 327 | 2.83k | } |
|
328 | | |
329 | 29.5k | LLVM_ATTRIBUTE_UNUSED static std::string getFeaturesStr() { |
330 | 29.5k | SubtargetFeatures Features; |
331 | 29.5k | |
332 | 29.5k | // If user asked for the 'native' CPU, we need to autodetect features. |
333 | 29.5k | // This is necessary for x86 where the CPU might not support all the |
334 | 29.5k | // features the autodetected CPU name lists in the target. For example, |
335 | 29.5k | // not all Sandybridge processors support AVX. |
336 | 29.5k | if (MCPU == "native") { |
337 | 0 | StringMap<bool> HostFeatures; |
338 | 0 | if (sys::getHostCPUFeatures(HostFeatures)) |
339 | 0 | for (auto &F : HostFeatures) |
340 | 0 | Features.AddFeature(F.first(), F.second); |
341 | 0 | } |
342 | 29.5k | |
343 | 40.5k | for (unsigned i = 0; i != MAttrs.size(); ++i10.9k ) |
344 | 10.9k | Features.AddFeature(MAttrs[i]); |
345 | 29.5k | |
346 | 29.5k | return Features.getString(); |
347 | 29.5k | } Line | Count | Source | 329 | 4.58k | LLVM_ATTRIBUTE_UNUSED static std::string getFeaturesStr() { | 330 | 4.58k | SubtargetFeatures Features; | 331 | 4.58k | | 332 | 4.58k | // If user asked for the 'native' CPU, we need to autodetect features. | 333 | 4.58k | // This is necessary for x86 where the CPU might not support all the | 334 | 4.58k | // features the autodetected CPU name lists in the target. For example, | 335 | 4.58k | // not all Sandybridge processors support AVX. | 336 | 4.58k | if (MCPU == "native") { | 337 | 0 | StringMap<bool> HostFeatures; | 338 | 0 | if (sys::getHostCPUFeatures(HostFeatures)) | 339 | 0 | for (auto &F : HostFeatures) | 340 | 0 | Features.AddFeature(F.first(), F.second); | 341 | 0 | } | 342 | 4.58k | | 343 | 5.46k | for (unsigned i = 0; i != MAttrs.size(); ++i878 ) | 344 | 878 | Features.AddFeature(MAttrs[i]); | 345 | 4.58k | | 346 | 4.58k | return Features.getString(); | 347 | 4.58k | } |
Line | Count | Source | 329 | 24.9k | LLVM_ATTRIBUTE_UNUSED static std::string getFeaturesStr() { | 330 | 24.9k | SubtargetFeatures Features; | 331 | 24.9k | | 332 | 24.9k | // If user asked for the 'native' CPU, we need to autodetect features. | 333 | 24.9k | // This is necessary for x86 where the CPU might not support all the | 334 | 24.9k | // features the autodetected CPU name lists in the target. For example, | 335 | 24.9k | // not all Sandybridge processors support AVX. | 336 | 24.9k | if (MCPU == "native") { | 337 | 0 | StringMap<bool> HostFeatures; | 338 | 0 | if (sys::getHostCPUFeatures(HostFeatures)) | 339 | 0 | for (auto &F : HostFeatures) | 340 | 0 | Features.AddFeature(F.first(), F.second); | 341 | 0 | } | 342 | 24.9k | | 343 | 35.0k | for (unsigned i = 0; i != MAttrs.size(); ++i10.1k ) | 344 | 10.1k | Features.AddFeature(MAttrs[i]); | 345 | 24.9k | | 346 | 24.9k | return Features.getString(); | 347 | 24.9k | } |
Unexecuted instantiation: TargetOptionsCommandFlags.cpp:getFeaturesStr() |
348 | | |
349 | 0 | LLVM_ATTRIBUTE_UNUSED static std::vector<std::string> getFeatureList() { |
350 | 0 | SubtargetFeatures Features; |
351 | 0 |
|
352 | 0 | // If user asked for the 'native' CPU, we need to autodetect features. |
353 | 0 | // This is necessary for x86 where the CPU might not support all the |
354 | 0 | // features the autodetected CPU name lists in the target. For example, |
355 | 0 | // not all Sandybridge processors support AVX. |
356 | 0 | if (MCPU == "native") { |
357 | 0 | StringMap<bool> HostFeatures; |
358 | 0 | if (sys::getHostCPUFeatures(HostFeatures)) |
359 | 0 | for (auto &F : HostFeatures) |
360 | 0 | Features.AddFeature(F.first(), F.second); |
361 | 0 | } |
362 | 0 |
|
363 | 0 | for (unsigned i = 0; i != MAttrs.size(); ++i) |
364 | 0 | Features.AddFeature(MAttrs[i]); |
365 | 0 |
|
366 | 0 | return Features.getFeatures(); |
367 | 0 | } Unexecuted instantiation: opt.cpp:getFeatureList() Unexecuted instantiation: llc.cpp:getFeatureList() Unexecuted instantiation: TargetOptionsCommandFlags.cpp:getFeatureList() |
368 | | |
369 | | /// Set function attributes of functions in Module M based on CPU, |
370 | | /// Features, and command line flags. |
371 | | LLVM_ATTRIBUTE_UNUSED static void |
372 | 35.8k | setFunctionAttributes(StringRef CPU, StringRef Features, Module &M) { |
373 | 368k | for (auto &F : M) { |
374 | 368k | auto &Ctx = F.getContext(); |
375 | 368k | AttributeList Attrs = F.getAttributes(); |
376 | 368k | AttrBuilder NewAttrs; |
377 | 368k | |
378 | 368k | if (!CPU.empty()) |
379 | 85.6k | NewAttrs.addAttribute("target-cpu", CPU); |
380 | 368k | if (!Features.empty()) |
381 | 166k | NewAttrs.addAttribute("target-features", Features); |
382 | 368k | if (FramePointerUsage.getNumOccurrences() > 0) { |
383 | 2.44k | if (FramePointerUsage == llvm::FramePointer::All) |
384 | 2.41k | NewAttrs.addAttribute("frame-pointer", "all"); |
385 | 27 | else if (FramePointerUsage == llvm::FramePointer::NonLeaf) |
386 | 0 | NewAttrs.addAttribute("frame-pointer", "non-leaf"); |
387 | 27 | else if (FramePointerUsage == llvm::FramePointer::None) |
388 | 27 | NewAttrs.addAttribute("frame-pointer", "none"); |
389 | 2.44k | } |
390 | 368k | if (DisableTailCalls.getNumOccurrences() > 0) |
391 | 60 | NewAttrs.addAttribute("disable-tail-calls", |
392 | 60 | toStringRef(DisableTailCalls)); |
393 | 368k | if (StackRealign) |
394 | 84 | NewAttrs.addAttribute("stackrealign"); |
395 | 368k | |
396 | 368k | if (TrapFuncName.getNumOccurrences() > 0) |
397 | 12 | for (auto &B : F) |
398 | 7 | for (auto &I : B) |
399 | 14 | if (auto *Call = dyn_cast<CallInst>(&I)) |
400 | 7 | if (const auto *F = Call->getCalledFunction()) |
401 | 7 | if (F->getIntrinsicID() == Intrinsic::debugtrap || |
402 | 7 | F->getIntrinsicID() == Intrinsic::trap5 ) |
403 | 7 | Call->addAttribute( |
404 | 7 | llvm::AttributeList::FunctionIndex, |
405 | 7 | Attribute::get(Ctx, "trap-func-name", TrapFuncName)); |
406 | 368k | |
407 | 368k | // Let NewAttrs override Attrs. |
408 | 368k | F.setAttributes( |
409 | 368k | Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs)); |
410 | 368k | } |
411 | 35.8k | } opt.cpp:setFunctionAttributes(llvm::StringRef, llvm::StringRef, llvm::Module&) Line | Count | Source | 372 | 10.9k | setFunctionAttributes(StringRef CPU, StringRef Features, Module &M) { | 373 | 88.7k | for (auto &F : M) { | 374 | 88.7k | auto &Ctx = F.getContext(); | 375 | 88.7k | AttributeList Attrs = F.getAttributes(); | 376 | 88.7k | AttrBuilder NewAttrs; | 377 | 88.7k | | 378 | 88.7k | if (!CPU.empty()) | 379 | 8.60k | NewAttrs.addAttribute("target-cpu", CPU); | 380 | 88.7k | if (!Features.empty()) | 381 | 15.3k | NewAttrs.addAttribute("target-features", Features); | 382 | 88.7k | if (FramePointerUsage.getNumOccurrences() > 0) { | 383 | 0 | if (FramePointerUsage == llvm::FramePointer::All) | 384 | 0 | NewAttrs.addAttribute("frame-pointer", "all"); | 385 | 0 | else if (FramePointerUsage == llvm::FramePointer::NonLeaf) | 386 | 0 | NewAttrs.addAttribute("frame-pointer", "non-leaf"); | 387 | 0 | else if (FramePointerUsage == llvm::FramePointer::None) | 388 | 0 | NewAttrs.addAttribute("frame-pointer", "none"); | 389 | 0 | } | 390 | 88.7k | if (DisableTailCalls.getNumOccurrences() > 0) | 391 | 0 | NewAttrs.addAttribute("disable-tail-calls", | 392 | 0 | toStringRef(DisableTailCalls)); | 393 | 88.7k | if (StackRealign) | 394 | 0 | NewAttrs.addAttribute("stackrealign"); | 395 | 88.7k | | 396 | 88.7k | if (TrapFuncName.getNumOccurrences() > 0) | 397 | 0 | for (auto &B : F) | 398 | 0 | for (auto &I : B) | 399 | 0 | if (auto *Call = dyn_cast<CallInst>(&I)) | 400 | 0 | if (const auto *F = Call->getCalledFunction()) | 401 | 0 | if (F->getIntrinsicID() == Intrinsic::debugtrap || | 402 | 0 | F->getIntrinsicID() == Intrinsic::trap) | 403 | 0 | Call->addAttribute( | 404 | 0 | llvm::AttributeList::FunctionIndex, | 405 | 0 | Attribute::get(Ctx, "trap-func-name", TrapFuncName)); | 406 | 88.7k | | 407 | 88.7k | // Let NewAttrs override Attrs. | 408 | 88.7k | F.setAttributes( | 409 | 88.7k | Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs)); | 410 | 88.7k | } | 411 | 10.9k | } |
llc.cpp:setFunctionAttributes(llvm::StringRef, llvm::StringRef, llvm::Module&) Line | Count | Source | 372 | 24.9k | setFunctionAttributes(StringRef CPU, StringRef Features, Module &M) { | 373 | 279k | for (auto &F : M) { | 374 | 279k | auto &Ctx = F.getContext(); | 375 | 279k | AttributeList Attrs = F.getAttributes(); | 376 | 279k | AttrBuilder NewAttrs; | 377 | 279k | | 378 | 279k | if (!CPU.empty()) | 379 | 77.0k | NewAttrs.addAttribute("target-cpu", CPU); | 380 | 279k | if (!Features.empty()) | 381 | 151k | NewAttrs.addAttribute("target-features", Features); | 382 | 279k | if (FramePointerUsage.getNumOccurrences() > 0) { | 383 | 2.44k | if (FramePointerUsage == llvm::FramePointer::All) | 384 | 2.41k | NewAttrs.addAttribute("frame-pointer", "all"); | 385 | 27 | else if (FramePointerUsage == llvm::FramePointer::NonLeaf) | 386 | 0 | NewAttrs.addAttribute("frame-pointer", "non-leaf"); | 387 | 27 | else if (FramePointerUsage == llvm::FramePointer::None) | 388 | 27 | NewAttrs.addAttribute("frame-pointer", "none"); | 389 | 2.44k | } | 390 | 279k | if (DisableTailCalls.getNumOccurrences() > 0) | 391 | 60 | NewAttrs.addAttribute("disable-tail-calls", | 392 | 60 | toStringRef(DisableTailCalls)); | 393 | 279k | if (StackRealign) | 394 | 84 | NewAttrs.addAttribute("stackrealign"); | 395 | 279k | | 396 | 279k | if (TrapFuncName.getNumOccurrences() > 0) | 397 | 12 | for (auto &B : F) | 398 | 7 | for (auto &I : B) | 399 | 14 | if (auto *Call = dyn_cast<CallInst>(&I)) | 400 | 7 | if (const auto *F = Call->getCalledFunction()) | 401 | 7 | if (F->getIntrinsicID() == Intrinsic::debugtrap || | 402 | 7 | F->getIntrinsicID() == Intrinsic::trap5 ) | 403 | 7 | Call->addAttribute( | 404 | 7 | llvm::AttributeList::FunctionIndex, | 405 | 7 | Attribute::get(Ctx, "trap-func-name", TrapFuncName)); | 406 | 279k | | 407 | 279k | // Let NewAttrs override Attrs. | 408 | 279k | F.setAttributes( | 409 | 279k | Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs)); | 410 | 279k | } | 411 | 24.9k | } |
Unexecuted instantiation: TargetOptionsCommandFlags.cpp:setFunctionAttributes(llvm::StringRef, llvm::StringRef, llvm::Module&) |