blob: f8129463b54ca144aab6a2f237878e2f4265992b [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- MCTargetOptionsCommandFlags.h --------------------------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
7//===----------------------------------------------------------------------===//
8//
9// This file contains machine code-specific flags that are shared between
10// different command line tools.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
15#define LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
16
17#include "llvm/MC/MCTargetOptions.h"
18#include "llvm/Support/CommandLine.h"
19using namespace llvm;
20
21static 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")));
29
30static cl::opt<bool> RelaxAll("mc-relax-all",
31 cl::desc("When used with filetype=obj, "
32 "relax all fixups in the emitted object file"));
33
34static 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"));
39
40static cl::opt<bool> PIECopyRelocations("pie-copy-relocations", cl::desc("PIE Copy Relocations"));
41
42static cl::opt<int> DwarfVersion("dwarf-version", cl::desc("Dwarf version"),
43 cl::init(0));
44
45static cl::opt<bool> ShowMCInst("asm-show-inst",
46 cl::desc("Emit internal instruction representation to "
47 "assembly file"));
48
49static cl::opt<bool> FatalWarnings("fatal-warnings",
50 cl::desc("Treat warnings as errors"));
51
52static cl::opt<bool> NoWarn("no-warn", cl::desc("Suppress all warnings"));
53static cl::alias NoWarnW("W", cl::desc("Alias for --no-warn"), cl::aliasopt(NoWarn));
54
55static cl::opt<bool> NoDeprecatedWarn("no-deprecated-warn",
56 cl::desc("Suppress all deprecated warnings"));
57
58static cl::opt<std::string>
59ABIName("target-abi", cl::Hidden,
60 cl::desc("The name of the ABI to be targeted from the backend."),
61 cl::init(""));
62
63static 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;
77}
78
79#endif