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.

75 lines
2.5 KiB

  1. //===- MCSectionCOFF.h - COFF 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 MCSectionCOFF class.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_MC_MCSECTIONCOFF_H
  14. #define LLVM_MC_MCSECTIONCOFF_H
  15. #include "llvm/ADT/StringRef.h"
  16. #include "llvm/MC/MCSection.h"
  17. #include "llvm/Support/COFF.h"
  18. namespace llvm {
  19. /// MCSectionCOFF - This represents a section on Windows
  20. class MCSectionCOFF : public MCSection {
  21. // The memory for this string is stored in the same MCContext as *this.
  22. StringRef SectionName;
  23. /// Characteristics - This is the Characteristics field of a section,
  24. // drawn from the enums below.
  25. unsigned Characteristics;
  26. /// Selection - This is the Selection field for the section symbol, if
  27. /// it is a COMDAT section (Characteristics & IMAGE_SCN_LNK_COMDAT) != 0
  28. int Selection;
  29. private:
  30. friend class MCContext;
  31. MCSectionCOFF(StringRef Section, unsigned Characteristics,
  32. int Selection, SectionKind K)
  33. : MCSection(SV_COFF, K), SectionName(Section),
  34. Characteristics(Characteristics), Selection (Selection) {
  35. assert ((Characteristics & 0x00F00000) == 0 &&
  36. "alignment must not be set upon section creation");
  37. }
  38. ~MCSectionCOFF();
  39. public:
  40. /// ShouldOmitSectionDirective - Decides whether a '.section' directive
  41. /// should be printed before the section name
  42. bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
  43. StringRef getSectionName() const { return SectionName; }
  44. virtual std::string getLabelBeginName() const {
  45. return SectionName.str() + "_begin";
  46. }
  47. virtual std::string getLabelEndName() const {
  48. return SectionName.str() + "_end";
  49. }
  50. unsigned getCharacteristics() const { return Characteristics; }
  51. int getSelection () const { return Selection; }
  52. virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
  53. raw_ostream &OS,
  54. const MCExpr *Subsection) const;
  55. virtual bool UseCodeAlign() const;
  56. virtual bool isVirtualSection() const;
  57. static bool classof(const MCSection *S) {
  58. return S->getVariant() == SV_COFF;
  59. }
  60. };
  61. } // end namespace llvm
  62. #endif