[PGO] convert a subset of C++ interfaces into C (for sharing) (NFC)
[oota-llvm.git] / include / llvm / MC / MCObjectFileInfo.h
index 57e0c82dc35f8ccd464bba38069c5dfb91a9bd1c..eaca3833dc8914ded4f8b8e21218f48166adcbca 100644 (file)
 #include "llvm/Support/CodeGen.h"
 
 namespace llvm {
-  class MCContext;
-  class MCSection;
-  class StringRef;
+class MCContext;
+class MCSection;
 
 class MCObjectFileInfo {
 protected:
-  /// CommDirectiveSupportsAlignment - True if .comm supports alignment.  This
-  /// is a hack for as long as we support 10.4 Tiger, whose assembler doesn't
-  /// support alignment on comm.
+  /// True if .comm supports alignment.  This is a hack for as long as we
+  /// support 10.4 Tiger, whose assembler doesn't support alignment on comm.
   bool CommDirectiveSupportsAlignment;
 
-  /// SupportsWeakEmptyEHFrame - True if target object file supports a
-  /// weak_definition of constant 0 for an omitted EH frame.
+  /// True if target object file supports a weak_definition of constant 0 for an
+  /// omitted EH frame.
   bool SupportsWeakOmittedEHFrame;
 
-  /// SupportsCompactUnwindWithoutEHFrame - True if the target object file
-  /// supports emitting a compact unwind section without an associated EH frame
-  /// section.
+  /// True if the target object file supports emitting a compact unwind section
+  /// without an associated EH frame section.
   bool SupportsCompactUnwindWithoutEHFrame;
 
+  /// OmitDwarfIfHaveCompactUnwind - True if the target object file
+  /// supports having some functions with compact unwind and other with
+  /// dwarf unwind.
+  bool OmitDwarfIfHaveCompactUnwind;
+
   /// PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values
   /// for EH.
   unsigned PersonalityEncoding;
@@ -45,20 +47,13 @@ protected:
   unsigned FDECFIEncoding;
   unsigned TTypeEncoding;
 
-  /// Section flags for eh_frame
-  unsigned EHSectionType;
-  unsigned EHSectionFlags;
-
-  /// CompactUnwindDwarfEHFrameOnly - Compact unwind encoding indicating that we
-  /// should emit only an EH frame.
+  /// Compact unwind encoding indicating that we should emit only an EH frame.
   unsigned CompactUnwindDwarfEHFrameOnly;
 
   /// Section directive for standard text.
-  ///
   MCSection *TextSection;
 
   /// Section directive for standard data.
-  ///
   MCSection *DataSection;
 
   /// Section that is default initialized to zero.
@@ -101,7 +96,7 @@ protected:
   // can be enabled by a compiler flag.
   MCSection *DwarfPubNamesSection;
 
-  // DWARF5 Experimental Debug Info Sections
+  /// DWARF5 Experimental Debug Info Sections
   /// DwarfAccelNamesSection, DwarfAccelObjCSection,
   /// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
   /// If we use the DWARF accelerated hash tables then we want to emit these
@@ -111,7 +106,7 @@ protected:
   MCSection *DwarfAccelNamespaceSection;
   MCSection *DwarfAccelTypesSection;
 
-  /// These are used for the Fission separate debug information files.
+  // These are used for the Fission separate debug information files.
   MCSection *DwarfInfoDWOSection;
   MCSection *DwarfTypesDWOSection;
   MCSection *DwarfAbbrevDWOSection;
@@ -121,51 +116,54 @@ protected:
   MCSection *DwarfStrOffDWOSection;
   MCSection *DwarfAddrSection;
 
-  /// Sections for newer gnu pubnames and pubtypes.
+  /// Section for newer gnu pubnames.
   MCSection *DwarfGnuPubNamesSection;
+  /// Section for newer gnu pubtypes.
   MCSection *DwarfGnuPubTypesSection;
 
   MCSection *COFFDebugSymbolsSection;
 
-  // Extra TLS Variable Data section.  If the target needs to put additional
-  // information for a TLS variable, it'll go here.
+  /// Extra TLS Variable Data section.
+  ///
+  /// If the target needs to put additional information for a TLS variable,
+  /// it'll go here.
   MCSection *TLSExtraDataSection;
 
   /// Section directive for Thread Local data. ELF, MachO and COFF.
   MCSection *TLSDataSection; // Defaults to ".tdata".
 
-  /// Section directive for Thread Local uninitialized data. Null if this target
-  /// doesn't support a BSS section. ELF and MachO only.
+  /// Section directive for Thread Local uninitialized data.
+  ///
+  /// Null if this target doesn't support a BSS section. ELF and MachO only.
   MCSection *TLSBSSSection; // Defaults to ".tbss".
 
   /// StackMap section.
   MCSection *StackMapSection;
 
-  /// EH frame section. It is initialized on demand so it can be overwritten
-  /// (with uniquing).
-  MCSection *EHFrameSection;
+  /// FaultMap section.
+  MCSection *FaultMapSection;
 
-  /// ELF specific sections.
+  /// EH frame section.
   ///
-  MCSection *DataRelSection;
-  const MCSection *DataRelLocalSection;
+  /// It is initialized on demand so it can be overwritten (with uniquing).
+  MCSection *EHFrameSection;
+
+  // ELF specific sections.
   MCSection *DataRelROSection;
-  MCSection *DataRelROLocalSection;
   MCSection *MergeableConst4Section;
   MCSection *MergeableConst8Section;
   MCSection *MergeableConst16Section;
 
-  /// MachO specific sections.
-  ///
+  // MachO specific sections.
 
-  /// Section for thread local structure information. Contains the source code
-  /// name of the variable, visibility and a pointer to the initial value
-  /// (.tdata or .tbss).
+  /// Section for thread local structure information.
+  ///
+  /// Contains the source code name of the variable, visibility and a pointer to
+  /// the initial value (.tdata or .tbss).
   MCSection *TLSTLVSection; // Defaults to ".tlv".
 
-  /// TLSThreadInitSection - Section for thread local data initialization
-  /// functions.
-  const MCSection *TLSThreadInitSection;  // Defaults to ".thread_init_func".
+  /// Section for thread local data initialization functions.
+  const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
 
   MCSection *CStringSection;
   MCSection *UStringSection;
@@ -182,16 +180,18 @@ protected:
   MCSection *NonLazySymbolPointerSection;
 
   /// COFF specific sections.
-  ///
   MCSection *DrectveSection;
   MCSection *PDataSection;
   MCSection *XDataSection;
+  MCSection *SXDataSection;
 
 public:
-  virtual ~MCObjectFileInfo() { };
-
-  void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM,
-                            MCContext &ctx);
+  void InitMCObjectFileInfo(const Triple &TT, Reloc::Model RM,
+                            CodeModel::Model CM, MCContext &ctx);
+  LLVM_ATTRIBUTE_DEPRECATED(
+      void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM,
+                                CodeModel::Model CM, MCContext &ctx),
+      "StringRef GNU Triple argument replaced by a llvm::Triple object");
 
   bool getSupportsWeakOmittedEHFrame() const {
     return SupportsWeakOmittedEHFrame;
@@ -199,6 +199,10 @@ public:
   bool getSupportsCompactUnwindWithoutEHFrame() const {
     return SupportsCompactUnwindWithoutEHFrame;
   }
+  bool getOmitDwarfIfHaveCompactUnwind() const {
+    return OmitDwarfIfHaveCompactUnwind;
+  }
+
   bool getCommDirectiveSupportsAlignment() const {
     return CommDirectiveSupportsAlignment;
   }
@@ -215,6 +219,7 @@ public:
   MCSection *getTextSection() const { return TextSection; }
   MCSection *getDataSection() const { return DataSection; }
   MCSection *getBSSSection() const { return BSSSection; }
+  MCSection *getReadOnlySection() const { return ReadOnlySection; }
   MCSection *getLSDASection() const { return LSDASection; }
   MCSection *getCompactUnwindSection() const { return CompactUnwindSection; }
   MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
@@ -267,15 +272,10 @@ public:
   MCSection *getTLSBSSSection() const { return TLSBSSSection; }
 
   MCSection *getStackMapSection() const { return StackMapSection; }
+  MCSection *getFaultMapSection() const { return FaultMapSection; }
 
-  /// ELF specific sections.
-  ///
-  MCSection *getDataRelSection() const { return DataRelSection; }
-  const MCSection *getDataRelLocalSection() const {
-    return DataRelLocalSection;
-  }
+  // ELF specific sections.
   MCSection *getDataRelROSection() const { return DataRelROSection; }
-  MCSection *getDataRelROLocalSection() const { return DataRelROLocalSection; }
   const MCSection *getMergeableConst4Section() const {
     return MergeableConst4Section;
   }
@@ -286,8 +286,7 @@ public:
     return MergeableConst16Section;
   }
 
-  /// MachO specific sections.
-  ///
+  // MachO specific sections.
   const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
   const MCSection *getTLSThreadInitSection() const {
     return TLSThreadInitSection;
@@ -318,26 +317,20 @@ public:
     return NonLazySymbolPointerSection;
   }
 
-  /// COFF specific sections.
-  ///
+  // COFF specific sections.
   MCSection *getDrectveSection() const { return DrectveSection; }
   MCSection *getPDataSection() const { return PDataSection; }
   MCSection *getXDataSection() const { return XDataSection; }
+  MCSection *getSXDataSection() const { return SXDataSection; }
 
   MCSection *getEHFrameSection() {
-    if (!EHFrameSection)
-      InitEHFrameSection();
     return EHFrameSection;
   }
 
   enum Environment { IsMachO, IsELF, IsCOFF };
-  Environment getObjectFileType() const {
-    return Env;
-  }
+  Environment getObjectFileType() const { return Env; }
 
-  Reloc::Model getRelocM() const {
-    return RelocM;
-  }
+  Reloc::Model getRelocM() const { return RelocM; }
 
 private:
   Environment Env;
@@ -346,15 +339,9 @@ private:
   MCContext *Ctx;
   Triple TT;
 
-  void InitMachOMCObjectFileInfo(Triple T);
-  void InitELFMCObjectFileInfo(Triple T);
-  void InitCOFFMCObjectFileInfo(Triple T);
-
-  /// InitEHFrameSection - Initialize EHFrameSection on demand.
-  ///
-  void InitEHFrameSection();
-
-  virtual unsigned SelectMipsTTypeEncoding() const;
+  void initMachOMCObjectFileInfo(Triple T);
+  void initELFMCObjectFileInfo(Triple T);
+  void initCOFFMCObjectFileInfo(Triple T);
 
 public:
   const Triple &getTargetTriple() const { return TT; }