• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- MCTargetOptions.h - MC Target Options -------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_MC_MCTARGETOPTIONS_H
11 #define LLVM_MC_MCTARGETOPTIONS_H
12 
13 #include <string>
14 
15 namespace llvm {
16 
17 class StringRef;
18 
19 class MCTargetOptions {
20 public:
21   enum AsmInstrumentation {
22     AsmInstrumentationNone,
23     AsmInstrumentationAddress
24   };
25 
26   /// Enables AddressSanitizer instrumentation at machine level.
27   bool SanitizeAddress : 1;
28 
29   bool MCRelaxAll : 1;
30   bool MCNoExecStack : 1;
31   bool MCFatalWarnings : 1;
32   bool MCNoWarn : 1;
33   bool MCSaveTempLabels : 1;
34   bool MCUseDwarfDirectory : 1;
35   bool MCIncrementalLinkerCompatible : 1;
36   bool ShowMCEncoding : 1;
37   bool ShowMCInst : 1;
38   bool AsmVerbose : 1;
39 
40   /// Preserve Comments in Assembly.
41   bool PreserveAsmComments : 1;
42 
43   int DwarfVersion;
44   /// getABIName - If this returns a non-empty string this represents the
45   /// textual name of the ABI that we want the backend to use, e.g. o32, or
46   /// aapcs-linux.
47   StringRef getABIName() const;
48   std::string ABIName;
49   MCTargetOptions();
50 };
51 
52 inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
53 #define ARE_EQUAL(X) LHS.X == RHS.X
54   return (ARE_EQUAL(SanitizeAddress) &&
55           ARE_EQUAL(MCRelaxAll) &&
56           ARE_EQUAL(MCNoExecStack) &&
57           ARE_EQUAL(MCFatalWarnings) &&
58           ARE_EQUAL(MCNoWarn) &&
59           ARE_EQUAL(MCSaveTempLabels) &&
60           ARE_EQUAL(MCUseDwarfDirectory) &&
61           ARE_EQUAL(MCIncrementalLinkerCompatible) &&
62           ARE_EQUAL(ShowMCEncoding) &&
63           ARE_EQUAL(ShowMCInst) &&
64           ARE_EQUAL(AsmVerbose) &&
65           ARE_EQUAL(DwarfVersion) &&
66           ARE_EQUAL(ABIName));
67 #undef ARE_EQUAL
68 }
69 
70 inline bool operator!=(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
71   return !(LHS == RHS);
72 }
73 
74 } // end namespace llvm
75 
76 #endif
77