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