• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
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<bool> RelaxAll("mc-relax-all",
22                       cl::desc("When used with filetype=obj, "
23                                "relax all fixups in the emitted object file"));
24
25static cl::opt<bool> IncrementalLinkerCompatible(
26    "incremental-linker-compatible",
27    cl::desc(
28        "When used with filetype=obj, "
29        "emit an object file which can be used with an incremental linker"));
30
31static cl::opt<int> DwarfVersion("dwarf-version", cl::desc("Dwarf version"),
32                          cl::init(0));
33
34static cl::opt<bool> ShowMCInst("asm-show-inst",
35                         cl::desc("Emit internal instruction representation to "
36                                  "assembly file"));
37
38static cl::opt<bool> FatalWarnings("fatal-warnings",
39                            cl::desc("Treat warnings as errors"));
40
41static cl::opt<bool> NoWarn("no-warn", cl::desc("Suppress all warnings"));
42static cl::alias NoWarnW("W", cl::desc("Alias for --no-warn"), cl::aliasopt(NoWarn));
43
44static cl::opt<bool> NoDeprecatedWarn("no-deprecated-warn",
45                               cl::desc("Suppress all deprecated warnings"));
46
47static cl::opt<std::string>
48ABIName("target-abi", cl::Hidden,
49        cl::desc("The name of the ABI to be targeted from the backend."),
50        cl::init(""));
51
52static MCTargetOptions InitMCTargetOptionsFromFlags() {
53  MCTargetOptions Options;
54  Options.MCRelaxAll = RelaxAll;
55  Options.MCIncrementalLinkerCompatible = IncrementalLinkerCompatible;
56  Options.DwarfVersion = DwarfVersion;
57  Options.ShowMCInst = ShowMCInst;
58  Options.ABIName = ABIName;
59  Options.MCFatalWarnings = FatalWarnings;
60  Options.MCNoWarn = NoWarn;
61  Options.MCNoDeprecatedWarn = NoDeprecatedWarn;
62  return Options;
63}
64
65#endif
66