ARMMCAsmInfo.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //===-- ARMMCAsmInfo.cpp - ARM asm properties -----------------------------===//
  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. // This file contains the declarations of the ARMMCAsmInfo properties.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "ARMMCAsmInfo.h"
  13. #include "llvm/ADT/Triple.h"
  14. using namespace llvm;
  15. void ARMMCAsmInfoDarwin::anchor() { }
  16. ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(const Triple &TheTriple) {
  17. if ((TheTriple.getArch() == Triple::armeb) ||
  18. (TheTriple.getArch() == Triple::thumbeb))
  19. IsLittleEndian = false;
  20. Data64bitsDirective = nullptr;
  21. CommentString = "@";
  22. Code16Directive = ".code\t16";
  23. Code32Directive = ".code\t32";
  24. UseDataRegionDirectives = true;
  25. SupportsDebugInformation = true;
  26. // Conditional Thumb 4-byte instructions can have an implicit IT.
  27. MaxInstLength = 6;
  28. // Exceptions handling
  29. ExceptionsType = (TheTriple.isOSDarwin() && !TheTriple.isWatchABI())
  30. ? ExceptionHandling::SjLj
  31. : ExceptionHandling::DwarfCFI;
  32. }
  33. void ARMELFMCAsmInfo::anchor() { }
  34. ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
  35. if ((TheTriple.getArch() == Triple::armeb) ||
  36. (TheTriple.getArch() == Triple::thumbeb))
  37. IsLittleEndian = false;
  38. // ".comm align is in bytes but .align is pow-2."
  39. AlignmentIsInBytes = false;
  40. Data64bitsDirective = nullptr;
  41. CommentString = "@";
  42. Code16Directive = ".code\t16";
  43. Code32Directive = ".code\t32";
  44. SupportsDebugInformation = true;
  45. // Conditional Thumb 4-byte instructions can have an implicit IT.
  46. MaxInstLength = 6;
  47. // Exceptions handling
  48. switch (TheTriple.getOS()) {
  49. case Triple::NetBSD:
  50. ExceptionsType = ExceptionHandling::DwarfCFI;
  51. break;
  52. default:
  53. ExceptionsType = ExceptionHandling::ARM;
  54. break;
  55. }
  56. // foo(plt) instead of foo@plt
  57. UseParensForSymbolVariant = true;
  58. }
  59. void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
  60. UseIntegratedAssembler = Value;
  61. if (!UseIntegratedAssembler) {
  62. // gas doesn't handle VFP register names in cfi directives,
  63. // so don't use register names with external assembler.
  64. // See https://sourceware.org/bugzilla/show_bug.cgi?id=16694
  65. DwarfRegNumForCFI = true;
  66. }
  67. }
  68. void ARMCOFFMCAsmInfoMicrosoft::anchor() { }
  69. ARMCOFFMCAsmInfoMicrosoft::ARMCOFFMCAsmInfoMicrosoft() {
  70. AlignmentIsInBytes = false;
  71. SupportsDebugInformation = true;
  72. ExceptionsType = ExceptionHandling::WinEH;
  73. PrivateGlobalPrefix = "$M";
  74. PrivateLabelPrefix = "$M";
  75. CommentString = "@";
  76. // Conditional Thumb 4-byte instructions can have an implicit IT.
  77. MaxInstLength = 6;
  78. }
  79. void ARMCOFFMCAsmInfoGNU::anchor() { }
  80. ARMCOFFMCAsmInfoGNU::ARMCOFFMCAsmInfoGNU() {
  81. AlignmentIsInBytes = false;
  82. HasSingleParameterDotFile = true;
  83. CommentString = "@";
  84. Code16Directive = ".code\t16";
  85. Code32Directive = ".code\t32";
  86. PrivateGlobalPrefix = ".L";
  87. PrivateLabelPrefix = ".L";
  88. SupportsDebugInformation = true;
  89. ExceptionsType = ExceptionHandling::DwarfCFI;
  90. UseParensForSymbolVariant = true;
  91. DwarfRegNumForCFI = false;
  92. // Conditional Thumb 4-byte instructions can have an implicit IT.
  93. MaxInstLength = 6;
  94. }