MCSectionGOFF.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/MC/MCSectionGOFF.h - GOFF Machine Code Sections ----*- 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. ///
  14. /// \file
  15. /// This file declares the MCSectionGOFF class, which contains all of the
  16. /// necessary machine code sections for the GOFF file format.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_MC_MCSECTIONGOFF_H
  20. #define LLVM_MC_MCSECTIONGOFF_H
  21. #include "llvm/BinaryFormat/GOFF.h"
  22. #include "llvm/MC/MCSection.h"
  23. #include "llvm/Support/raw_ostream.h"
  24. namespace llvm {
  25. class MCExpr;
  26. class MCSectionGOFF final : public MCSection {
  27. private:
  28. MCSection *Parent;
  29. const MCExpr *SubsectionId;
  30. friend class MCContext;
  31. MCSectionGOFF(StringRef Name, SectionKind K, MCSection *P, const MCExpr *Sub)
  32. : MCSection(SV_GOFF, Name, K, nullptr), Parent(P), SubsectionId(Sub) {}
  33. public:
  34. void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
  35. raw_ostream &OS,
  36. const MCExpr *Subsection) const override {
  37. OS << "\t.section\t\"" << getName() << "\"\n";
  38. }
  39. bool useCodeAlign() const override { return false; }
  40. bool isVirtualSection() const override { return false; }
  41. MCSection *getParent() const { return Parent; }
  42. const MCExpr *getSubsectionId() const { return SubsectionId; }
  43. static bool classof(const MCSection *S) { return S->getVariant() == SV_GOFF; }
  44. };
  45. } // end namespace llvm
  46. #endif
  47. #ifdef __GNUC__
  48. #pragma GCC diagnostic pop
  49. #endif