Recommit [NFC] Better encapsulation of llvm::Optional Storage
[llvm-complete.git] / include / llvm / MC / MCTargetOptionsCommandFlags.inc
blobf8129463b54ca144aab6a2f237878e2f4265992b
1 //===-- MCTargetOptionsCommandFlags.h --------------------------*- 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 machine code-specific flags that are shared between
10 // different command line tools.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
15 #define LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
17 #include "llvm/MC/MCTargetOptions.h"
18 #include "llvm/Support/CommandLine.h"
19 using namespace llvm;
21 static cl::opt<MCTargetOptions::AsmInstrumentation> AsmInstrumentation(
22     "asm-instrumentation", cl::desc("Instrumentation of inline assembly and "
23                                     "assembly source files"),
24     cl::init(MCTargetOptions::AsmInstrumentationNone),
25     cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, "none",
26                           "no instrumentation at all"),
27                clEnumValN(MCTargetOptions::AsmInstrumentationAddress, "address",
28                           "instrument instructions with memory arguments")));
30 static cl::opt<bool> RelaxAll("mc-relax-all",
31                        cl::desc("When used with filetype=obj, "
32                                 "relax all fixups in the emitted object file"));
34 static cl::opt<bool> IncrementalLinkerCompatible(
35     "incremental-linker-compatible",
36     cl::desc(
37         "When used with filetype=obj, "
38         "emit an object file which can be used with an incremental linker"));
40 static cl::opt<bool> PIECopyRelocations("pie-copy-relocations", cl::desc("PIE Copy Relocations"));
42 static cl::opt<int> DwarfVersion("dwarf-version", cl::desc("Dwarf version"),
43                           cl::init(0));
45 static cl::opt<bool> ShowMCInst("asm-show-inst",
46                          cl::desc("Emit internal instruction representation to "
47                                   "assembly file"));
49 static cl::opt<bool> FatalWarnings("fatal-warnings",
50                             cl::desc("Treat warnings as errors"));
52 static cl::opt<bool> NoWarn("no-warn", cl::desc("Suppress all warnings"));
53 static cl::alias NoWarnW("W", cl::desc("Alias for --no-warn"), cl::aliasopt(NoWarn));
55 static cl::opt<bool> NoDeprecatedWarn("no-deprecated-warn",
56                                cl::desc("Suppress all deprecated warnings"));
58 static cl::opt<std::string>
59 ABIName("target-abi", cl::Hidden,
60         cl::desc("The name of the ABI to be targeted from the backend."),
61         cl::init(""));
63 static MCTargetOptions InitMCTargetOptionsFromFlags() {
64   MCTargetOptions Options;
65   Options.SanitizeAddress =
66       (AsmInstrumentation == MCTargetOptions::AsmInstrumentationAddress);
67   Options.MCRelaxAll = RelaxAll;
68   Options.MCIncrementalLinkerCompatible = IncrementalLinkerCompatible;
69   Options.MCPIECopyRelocations = PIECopyRelocations;
70   Options.DwarfVersion = DwarfVersion;
71   Options.ShowMCInst = ShowMCInst;
72   Options.ABIName = ABIName;
73   Options.MCFatalWarnings = FatalWarnings;
74   Options.MCNoWarn = NoWarn;
75   Options.MCNoDeprecatedWarn = NoDeprecatedWarn;
76   return Options;
79 #endif