MCTargetOptions.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- MCTargetOptions.h - MC Target Options --------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCTARGETOPTIONS_H
  14. #define LLVM_MC_MCTARGETOPTIONS_H
  15. #include "llvm/ADT/ArrayRef.h"
  16. #include "llvm/Support/Compression.h"
  17. #include <string>
  18. #include <vector>
  19. namespace llvm {
  20. enum class ExceptionHandling {
  21. None, ///< No exception support
  22. DwarfCFI, ///< DWARF-like instruction based exceptions
  23. SjLj, ///< setjmp/longjmp based exceptions
  24. ARM, ///< ARM EHABI
  25. WinEH, ///< Windows Exception Handling
  26. Wasm, ///< WebAssembly Exception Handling
  27. AIX, ///< AIX Exception Handling
  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. class StringRef;
  35. class MCTargetOptions {
  36. public:
  37. enum AsmInstrumentation {
  38. AsmInstrumentationNone,
  39. AsmInstrumentationAddress
  40. };
  41. bool MCRelaxAll : 1;
  42. bool MCNoExecStack : 1;
  43. bool MCFatalWarnings : 1;
  44. bool MCNoWarn : 1;
  45. bool MCNoDeprecatedWarn : 1;
  46. bool MCNoTypeCheck : 1;
  47. bool MCSaveTempLabels : 1;
  48. bool MCIncrementalLinkerCompatible : 1;
  49. bool ShowMCEncoding : 1;
  50. bool ShowMCInst : 1;
  51. bool AsmVerbose : 1;
  52. /// Preserve Comments in Assembly.
  53. bool PreserveAsmComments : 1;
  54. bool Dwarf64 : 1;
  55. EmitDwarfUnwindType EmitDwarfUnwind;
  56. int DwarfVersion = 0;
  57. enum DwarfDirectory {
  58. // Force disable
  59. DisableDwarfDirectory,
  60. // Force enable, for assemblers that support
  61. // `.file fileno directory filename' syntax
  62. EnableDwarfDirectory,
  63. // Default is based on the target
  64. DefaultDwarfDirectory
  65. };
  66. DwarfDirectory MCUseDwarfDirectory;
  67. std::string ABIName;
  68. std::string AssemblyLanguage;
  69. std::string SplitDwarfFile;
  70. std::string AsSecureLogFile;
  71. const char *Argv0 = nullptr;
  72. ArrayRef<std::string> CommandLineArgs;
  73. /// Additional paths to search for `.include` directives when using the
  74. /// integrated assembler.
  75. std::vector<std::string> IASSearchPaths;
  76. MCTargetOptions();
  77. /// getABIName - If this returns a non-empty string this represents the
  78. /// textual name of the ABI that we want the backend to use, e.g. o32, or
  79. /// aapcs-linux.
  80. StringRef getABIName() const;
  81. /// getAssemblyLanguage - If this returns a non-empty string this represents
  82. /// the textual name of the assembly language that we will use for this
  83. /// target, e.g. masm.
  84. StringRef getAssemblyLanguage() const;
  85. };
  86. } // end namespace llvm
  87. #endif // LLVM_MC_MCTARGETOPTIONS_H
  88. #ifdef __GNUC__
  89. #pragma GCC diagnostic pop
  90. #endif