1 //===- MCTargetOptions.h - MC Target Options --------------------*- 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 #ifndef LLVM_MC_MCTARGETOPTIONS_H 10 #define LLVM_MC_MCTARGETOPTIONS_H 11 12 #include "llvm/ADT/ArrayRef.h" 13 #include <string> 14 #include <vector> 15 16 namespace llvm { 17 18 enum class ExceptionHandling { 19 None, ///< No exception support 20 DwarfCFI, ///< DWARF-like instruction based exceptions 21 SjLj, ///< setjmp/longjmp based exceptions 22 ARM, ///< ARM EHABI 23 WinEH, ///< Windows Exception Handling 24 Wasm, ///< WebAssembly Exception Handling 25 AIX, ///< AIX Exception Handling 26 }; 27 28 enum class DebugCompressionType { 29 None, ///< No compression 30 Z, ///< zlib style complession 31 }; 32 33 enum class EmitDwarfUnwindType { 34 Always, // Always emit dwarf unwind 35 NoCompactUnwind, // Only emit if compact unwind isn't available 36 Default, // Default behavior is based on the target 37 }; 38 39 class StringRef; 40 41 class MCTargetOptions { 42 public: 43 enum AsmInstrumentation { 44 AsmInstrumentationNone, 45 AsmInstrumentationAddress 46 }; 47 48 bool MCRelaxAll : 1; 49 bool MCNoExecStack : 1; 50 bool MCFatalWarnings : 1; 51 bool MCNoWarn : 1; 52 bool MCNoDeprecatedWarn : 1; 53 bool MCNoTypeCheck : 1; 54 bool MCSaveTempLabels : 1; 55 bool MCIncrementalLinkerCompatible : 1; 56 bool ShowMCEncoding : 1; 57 bool ShowMCInst : 1; 58 bool AsmVerbose : 1; 59 60 /// Preserve Comments in Assembly. 61 bool PreserveAsmComments : 1; 62 63 bool Dwarf64 : 1; 64 65 EmitDwarfUnwindType EmitDwarfUnwind; 66 67 int DwarfVersion = 0; 68 69 enum DwarfDirectory { 70 // Force disable 71 DisableDwarfDirectory, 72 // Force enable, for assemblers that support 73 // `.file fileno directory filename' syntax 74 EnableDwarfDirectory, 75 // Default is based on the target 76 DefaultDwarfDirectory 77 }; 78 DwarfDirectory MCUseDwarfDirectory; 79 80 std::string ABIName; 81 std::string AssemblyLanguage; 82 std::string SplitDwarfFile; 83 84 const char *Argv0 = nullptr; 85 ArrayRef<std::string> CommandLineArgs; 86 87 /// Additional paths to search for `.include` directives when using the 88 /// integrated assembler. 89 std::vector<std::string> IASSearchPaths; 90 91 MCTargetOptions(); 92 93 /// getABIName - If this returns a non-empty string this represents the 94 /// textual name of the ABI that we want the backend to use, e.g. o32, or 95 /// aapcs-linux. 96 StringRef getABIName() const; 97 98 /// getAssemblyLanguage - If this returns a non-empty string this represents 99 /// the textual name of the assembly language that we will use for this 100 /// target, e.g. masm. 101 StringRef getAssemblyLanguage() const; 102 }; 103 104 } // end namespace llvm 105 106 #endif // LLVM_MC_MCTARGETOPTIONS_H 107