PPCMCAsmInfo.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //===-- PPCMCAsmInfo.cpp - PPC 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 MCAsmInfoDarwin properties.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "PPCMCAsmInfo.h"
  13. #include "llvm/ADT/Triple.h"
  14. #include <cassert>
  15. using namespace llvm;
  16. void PPCELFMCAsmInfo::anchor() { }
  17. PPCELFMCAsmInfo::PPCELFMCAsmInfo(bool is64Bit, const Triple& T) {
  18. // FIXME: This is not always needed. For example, it is not needed in the
  19. // v2 abi.
  20. NeedsLocalForSize = true;
  21. if (is64Bit) {
  22. CodePointerSize = CalleeSaveStackSlotSize = 8;
  23. }
  24. IsLittleEndian =
  25. T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle;
  26. // ".comm align is in bytes but .align is pow-2."
  27. AlignmentIsInBytes = false;
  28. CommentString = "#";
  29. // Uses '.section' before '.bss' directive
  30. UsesELFSectionDirectiveForBSS = true;
  31. // Debug Information
  32. SupportsDebugInformation = true;
  33. DollarIsPC = true;
  34. // Set up DWARF directives
  35. MinInstAlignment = 4;
  36. // Exceptions handling
  37. ExceptionsType = ExceptionHandling::DwarfCFI;
  38. ZeroDirective = "\t.space\t";
  39. Data64bitsDirective = is64Bit ? "\t.quad\t" : nullptr;
  40. AssemblerDialect = 1; // New-Style mnemonics.
  41. LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
  42. }
  43. void PPCXCOFFMCAsmInfo::anchor() {}
  44. PPCXCOFFMCAsmInfo::PPCXCOFFMCAsmInfo(bool Is64Bit, const Triple &T) {
  45. if (T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle)
  46. report_fatal_error("XCOFF is not supported for little-endian targets");
  47. CodePointerSize = CalleeSaveStackSlotSize = Is64Bit ? 8 : 4;
  48. // A size of 8 is only supported by the assembler under 64-bit.
  49. Data64bitsDirective = Is64Bit ? "\t.vbyte\t8, " : nullptr;
  50. // Debug Information
  51. SupportsDebugInformation = true;
  52. // Set up DWARF directives
  53. MinInstAlignment = 4;
  54. // Support $ as PC in inline asm
  55. DollarIsPC = true;
  56. }