Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

  1. //===- MCSection.h - Machine Code Sections ----------------------*- 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 declares the MCSection class.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCSECTION_H
  14. #define LLVM_MC_MCSECTION_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/MC/SectionKind.h"
  17. #include "llvm/Support/Compiler.h"
  18. namespace llvm {
  19. class MCAsmInfo;
  20. class MCExpr;
  21. class raw_ostream;
  22. /// MCSection - Instances of this class represent a uniqued identifier for a
  23. /// section in the current translation unit. The MCContext class uniques and
  24. /// creates these.
  25. class MCSection {
  26. public:
  27. enum SectionVariant {
  28. SV_COFF = 0,
  29. SV_ELF,
  30. SV_MachO
  31. };
  32. private:
  33. MCSection(const MCSection&) LLVM_DELETED_FUNCTION;
  34. void operator=(const MCSection&) LLVM_DELETED_FUNCTION;
  35. protected:
  36. MCSection(SectionVariant V, SectionKind K) : Variant(V), Kind(K) {}
  37. SectionVariant Variant;
  38. SectionKind Kind;
  39. public:
  40. virtual ~MCSection();
  41. SectionKind getKind() const { return Kind; }
  42. SectionVariant getVariant() const { return Variant; }
  43. virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
  44. raw_ostream &OS,
  45. const MCExpr *Subsection) const = 0;
  46. // Convenience routines to get label names for the beginning/end of a
  47. // section.
  48. virtual std::string getLabelBeginName() const = 0;
  49. virtual std::string getLabelEndName() const = 0;
  50. /// isBaseAddressKnownZero - Return true if we know that this section will
  51. /// get a base address of zero. In cases where we know that this is true we
  52. /// can emit section offsets as direct references to avoid a subtraction
  53. /// from the base of the section, saving a relocation.
  54. virtual bool isBaseAddressKnownZero() const {
  55. return false;
  56. }
  57. // UseCodeAlign - Return true if a .align directive should use
  58. // "optimized nops" to fill instead of 0s.
  59. virtual bool UseCodeAlign() const = 0;
  60. /// isVirtualSection - Check whether this section is "virtual", that is
  61. /// has no actual object file contents.
  62. virtual bool isVirtualSection() const = 0;
  63. };
  64. } // end namespace llvm
  65. #endif