MCTargetOptionsCommandFlags.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //===-- MCTargetOptionsCommandFlags.h --------------------------*- 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. // This file contains machine code-specific flags that are shared between
  11. // different command line tools.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
  15. #define LLVM_MC_MCTARGETOPTIONSCOMMANDFLAGS_H
  16. #include "llvm/MC/MCTargetOptions.h"
  17. #include "llvm/Support/CommandLine.h"
  18. using namespace llvm;
  19. cl::opt<MCTargetOptions::AsmInstrumentation> AsmInstrumentation(
  20. "asm-instrumentation", cl::desc("Instrumentation of inline assembly and "
  21. "assembly source files"),
  22. cl::init(MCTargetOptions::AsmInstrumentationNone),
  23. cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, "none",
  24. "no instrumentation at all"),
  25. clEnumValN(MCTargetOptions::AsmInstrumentationAddress, "address",
  26. "instrument instructions with memory arguments"),
  27. clEnumValEnd));
  28. cl::opt<bool> RelaxAll("mc-relax-all",
  29. cl::desc("When used with filetype=obj, "
  30. "relax all fixups in the emitted object file"));
  31. cl::opt<int> DwarfVersion("dwarf-version", cl::desc("Dwarf version"),
  32. cl::init(0));
  33. cl::opt<bool> ShowMCInst("asm-show-inst",
  34. cl::desc("Emit internal instruction representation to "
  35. "assembly file"));
  36. cl::opt<std::string>
  37. ABIName("target-abi", cl::Hidden,
  38. cl::desc("The name of the ABI to be targeted from the backend."),
  39. cl::init(""));
  40. static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
  41. MCTargetOptions Options;
  42. Options.SanitizeAddress =
  43. (AsmInstrumentation == MCTargetOptions::AsmInstrumentationAddress);
  44. Options.MCRelaxAll = RelaxAll;
  45. Options.DwarfVersion = DwarfVersion;
  46. Options.ShowMCInst = ShowMCInst;
  47. Options.ABIName = ABIName;
  48. return Options;
  49. }
  50. #endif