diff options
Diffstat (limited to 'llvm/include/llvm')
27 files changed, 97 insertions, 97 deletions
diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h index 9e2dc1a..956dcbc 100644 --- a/llvm/include/llvm/Analysis/DXILResource.h +++ b/llvm/include/llvm/Analysis/DXILResource.h @@ -359,6 +359,8 @@ public: std::tie(RHS.RecordID, RHS.Space, RHS.LowerBound, RHS.Size); } bool overlapsWith(const ResourceBinding &RHS) const { + if (Size == UINT32_MAX) + return LowerBound < RHS.LowerBound; return Space == RHS.Space && LowerBound + Size - 1 >= RHS.LowerBound; } }; diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h index 09e3945..bff7707 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h +++ b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h @@ -160,6 +160,12 @@ m_scev_ZExt(const Op0_t &Op0) { return m_scev_Unary<SCEVZeroExtendExpr>(Op0); } +template <typename Op0_t> +inline SCEVUnaryExpr_match<SCEVPtrToIntExpr, Op0_t> +m_scev_PtrToInt(const Op0_t &Op0) { + return SCEVUnaryExpr_match<SCEVPtrToIntExpr, Op0_t>(Op0); +} + /// Match a binary SCEV. template <typename SCEVTy, typename Op0_t, typename Op1_t> struct SCEVBinaryExpr_match { diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index a683229..39136bc 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -101,6 +101,9 @@ /* Define if LLVM is using tflite */ #cmakedefine LLVM_HAVE_TFLITE +/* Define if we want to check profile consistency in lit tests */ +#cmakedefine LLVM_ENABLE_PROFCHECK + /* Define to 1 if you have the <sysexits.h> header file. */ #cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} diff --git a/llvm/include/llvm/Demangle/DemangleConfig.h b/llvm/include/llvm/Demangle/DemangleConfig.h index 8807a0e..7ee23a4 100644 --- a/llvm/include/llvm/Demangle/DemangleConfig.h +++ b/llvm/include/llvm/Demangle/DemangleConfig.h @@ -103,7 +103,7 @@ #if defined(LLVM_EXPORTS) #define DEMANGLE_ABI __declspec(dllexport) #else -#define DEMANGLE_ABI__declspec(dllimport) +#define DEMANGLE_ABI __declspec(dllimport) #endif #else #if __has_attribute(visibility) diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h index 862be04..5f7225e 100644 --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -68,6 +68,7 @@ enum DiagnosticKind { DK_StackSize, DK_Linker, DK_Lowering, + DK_LegalizationFailure, DK_DebugMetadataVersion, DK_DebugMetadataInvalid, DK_Instrumentation, @@ -383,6 +384,30 @@ private: DiagnosticLocation Loc; }; +class LLVM_ABI DiagnosticInfoLegalizationFailure + : public DiagnosticInfoWithLocationBase { +private: + /// Message to be reported. + const Twine &MsgStr; + +public: + DiagnosticInfoLegalizationFailure(const Twine &MsgStr LLVM_LIFETIME_BOUND, + const Function &Fn, + const DiagnosticLocation &Loc, + DiagnosticSeverity Severity = DS_Error) + : DiagnosticInfoWithLocationBase(DK_LegalizationFailure, Severity, Fn, + Loc), + MsgStr(MsgStr) {} + + const Twine &getMsgStr() const { return MsgStr; } + + void print(DiagnosticPrinter &DP) const override; + + static bool classof(const DiagnosticInfo *DI) { + return DI->getKind() == DK_LegalizationFailure; + } +}; + class LLVM_ABI DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase { private: diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h index 71da048..402e12a 100644 --- a/llvm/include/llvm/MC/MCAsmInfo.h +++ b/llvm/include/llvm/MC/MCAsmInfo.h @@ -494,6 +494,10 @@ public: /// returns true => .text virtual bool shouldOmitSectionDirective(StringRef SectionName) const; + // Return true if a .align directive should use "optimized nops" to fill + // instead of 0s. + virtual bool useCodeAlign(const MCSection &Sec) const { return false; } + bool usesSunStyleELFSectionSwitchSyntax() const { return SunStyleELFSectionSwitchSyntax; } diff --git a/llvm/include/llvm/MC/MCAsmInfoCOFF.h b/llvm/include/llvm/MC/MCAsmInfoCOFF.h index 1dfb475..631b549 100644 --- a/llvm/include/llvm/MC/MCAsmInfoCOFF.h +++ b/llvm/include/llvm/MC/MCAsmInfoCOFF.h @@ -15,6 +15,7 @@ namespace llvm { class MCAsmInfoCOFF : public MCAsmInfo { virtual void anchor(); + bool useCodeAlign(const MCSection &Sec) const final; protected: explicit MCAsmInfoCOFF(); diff --git a/llvm/include/llvm/MC/MCAsmInfoDarwin.h b/llvm/include/llvm/MC/MCAsmInfoDarwin.h index 4ca62b3..9bc5dd7 100644 --- a/llvm/include/llvm/MC/MCAsmInfoDarwin.h +++ b/llvm/include/llvm/MC/MCAsmInfoDarwin.h @@ -21,6 +21,7 @@ namespace llvm { class MCAsmInfoDarwin : public MCAsmInfo { public: explicit MCAsmInfoDarwin(); + bool useCodeAlign(const MCSection &Sec) const final; /// True if the section is atomized using the symbols in it. /// This is false if the section is atomized based on its contents (MachO' __TEXT,__cstring for diff --git a/llvm/include/llvm/MC/MCAsmInfoELF.h b/llvm/include/llvm/MC/MCAsmInfoELF.h index 408d4df..80cbf5c 100644 --- a/llvm/include/llvm/MC/MCAsmInfoELF.h +++ b/llvm/include/llvm/MC/MCAsmInfoELF.h @@ -16,6 +16,7 @@ namespace llvm { class MCAsmInfoELF : public MCAsmInfo { virtual void anchor(); MCSection *getNonexecutableStackSection(MCContext &Ctx) const final; + bool useCodeAlign(const MCSection &Sec) const final; protected: MCAsmInfoELF(); diff --git a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h index 5483899..06a3fed 100644 --- a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h +++ b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h @@ -14,10 +14,9 @@ namespace llvm { class MCAsmInfoXCOFF : public MCAsmInfo { - virtual void anchor(); - protected: MCAsmInfoXCOFF(); + bool useCodeAlign(const MCSection &Sec) const final; public: // Return true only when C is an acceptable character inside a diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h index c137f61..ddac161 100644 --- a/llvm/include/llvm/MC/MCContext.h +++ b/llvm/include/llvm/MC/MCContext.h @@ -333,8 +333,6 @@ private: void reportCommon(SMLoc Loc, std::function<void(SMDiagnostic &, const SourceMgr *)>); - MCFragment *allocInitialFragment(MCSection &Sec); - MCSymbolTableEntry &getSymbolTableEntry(StringRef Name); MCSymbol *createSymbolImpl(const MCSymbolTableEntry *Name, bool IsTemporary); diff --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h index 51e4df5..170e2e7 100644 --- a/llvm/include/llvm/MC/MCMachObjectWriter.h +++ b/llvm/include/llvm/MC/MCMachObjectWriter.h @@ -16,7 +16,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCLinkerOptimizationHint.h" #include "llvm/MC/MCObjectWriter.h" -#include "llvm/MC/MCSection.h" +#include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/StringTableBuilder.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/EndianStream.h" @@ -276,7 +276,7 @@ public: uint64_t SectionDataSize, uint32_t MaxProt, uint32_t InitProt); - void writeSection(const MCAssembler &Asm, const MCSection &Sec, + void writeSection(const MCAssembler &Asm, const MCSectionMachO &Sec, uint64_t VMAddr, uint64_t FileOffset, unsigned Flags, uint64_t RelocationsStart, unsigned NumRelocations); diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h index aea93e9..bbbee15 100644 --- a/llvm/include/llvm/MC/MCObjectStreamer.h +++ b/llvm/include/llvm/MC/MCObjectStreamer.h @@ -102,7 +102,6 @@ public: void emitSLEB128Value(const MCExpr *Value) override; void emitWeakReference(MCSymbol *Alias, const MCSymbol *Target) override; void changeSection(MCSection *Section, uint32_t Subsection = 0) override; - void switchSectionNoPrint(MCSection *Section) override; void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override; /// Emit an instruction to a special fragment, because this instruction diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h index c1f3f02..6ee2ed1e 100644 --- a/llvm/include/llvm/MC/MCSection.h +++ b/llvm/include/llvm/MC/MCSection.h @@ -540,17 +540,6 @@ public: friend class MCFragment; static constexpr unsigned NonUniqueID = ~0U; - enum SectionVariant { - SV_COFF = 0, - SV_ELF, - SV_GOFF, - SV_MachO, - SV_Wasm, - SV_XCOFF, - SV_SPIRV, - SV_DXContainer, - }; - struct iterator { MCFragment *F = nullptr; iterator() = default; @@ -570,6 +559,8 @@ private: // At parse time, this holds the fragment list of the current subsection. At // layout time, this holds the concatenated fragment lists of all subsections. FragList *CurFragList; + // In many object file formats, this denotes the section symbol. In Mach-O, + // this denotes an optional temporary label at the section start. MCSymbol *Begin; MCSymbol *End = nullptr; /// The alignment requirement of this section. @@ -589,6 +580,8 @@ private: /// offset between two locations may not be fully resolved. bool LinkerRelaxable : 1; + MCFragment DummyFragment; + // Mapping from subsection number to fragment list. At layout time, the // subsection 0 list is replaced with concatenated fragments from all // subsections. @@ -602,10 +595,8 @@ private: protected: // TODO Make Name private when possible. StringRef Name; - SectionVariant Variant; - MCSection(SectionVariant V, StringRef Name, bool IsText, bool IsBss, - MCSymbol *Begin); + MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin); // Protected non-virtual dtor prevents destroy through a base class pointer. ~MCSection() {} @@ -616,8 +607,6 @@ public: StringRef getName() const { return Name; } bool isText() const { return IsText; } - SectionVariant getVariant() const { return Variant; } - MCSymbol *getBeginSymbol() { return Begin; } const MCSymbol *getBeginSymbol() const { return const_cast<MCSection *>(this)->getBeginSymbol(); @@ -650,7 +639,7 @@ public: bool isLinkerRelaxable() const { return LinkerRelaxable; } void setLinkerRelaxable() { LinkerRelaxable = true; } - MCFragment &getDummyFragment() { return *Subsections[0].second.Head; } + MCFragment &getDummyFragment() { return DummyFragment; } FragList *curFragList() const { return CurFragList; } iterator begin() const { return iterator(CurFragList->Head); } @@ -661,11 +650,7 @@ public: virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, - uint32_t Subsection) const = 0; - - /// Return true if a .align directive should use "optimized nops" to fill - /// instead of 0s. - virtual bool useCodeAlign() const = 0; + uint32_t Subsection) const {} /// Check whether this section is "virtual", that is has no actual object /// file contents. diff --git a/llvm/include/llvm/MC/MCSectionCOFF.h b/llvm/include/llvm/MC/MCSectionCOFF.h index f979413a..8df54a4 100644 --- a/llvm/include/llvm/MC/MCSectionCOFF.h +++ b/llvm/include/llvm/MC/MCSectionCOFF.h @@ -55,7 +55,7 @@ private: MCSectionCOFF(StringRef Name, unsigned Characteristics, MCSymbol *COMDATSymbol, int Selection, unsigned UniqueID, MCSymbol *Begin) - : MCSection(SV_COFF, Name, Characteristics & COFF::IMAGE_SCN_CNT_CODE, + : MCSection(Name, Characteristics & COFF::IMAGE_SCN_CNT_CODE, Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA, Begin), Characteristics(Characteristics), COMDATSymbol(COMDATSymbol), @@ -81,7 +81,6 @@ public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override; unsigned getOrAssignWinCFISectionID(unsigned *NextID) const { if (WinCFISectionID == ~0U) @@ -92,8 +91,6 @@ public: static bool isImplicitlyDiscardable(StringRef Name) { return Name.starts_with(".debug"); } - - static bool classof(const MCSection *S) { return S->getVariant() == SV_COFF; } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionDXContainer.h b/llvm/include/llvm/MC/MCSectionDXContainer.h index 723b477..7d8e0c5 100644 --- a/llvm/include/llvm/MC/MCSectionDXContainer.h +++ b/llvm/include/llvm/MC/MCSectionDXContainer.h @@ -24,13 +24,7 @@ class MCSectionDXContainer final : public MCSection { friend class MCContext; MCSectionDXContainer(StringRef Name, SectionKind K, MCSymbol *Begin) - : MCSection(SV_DXContainer, Name, K.isText(), /*IsVirtual=*/false, - Begin) {} - -public: - void printSwitchToSection(const MCAsmInfo &, const Triple &, raw_ostream &, - uint32_t) const override; - bool useCodeAlign() const override { return false; } + : MCSection(Name, K.isText(), /*IsVirtual=*/false, Begin) {} }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h index 64a4daf..287b57c 100644 --- a/llvm/include/llvm/MC/MCSectionELF.h +++ b/llvm/include/llvm/MC/MCSectionELF.h @@ -58,8 +58,8 @@ private: unsigned entrySize, const MCSymbolELF *group, bool IsComdat, unsigned UniqueID, MCSymbol *Begin, const MCSymbolELF *LinkedToSym) - : MCSection(SV_ELF, Name, flags & ELF::SHF_EXECINSTR, - type == ELF::SHT_NOBITS, Begin), + : MCSection(Name, flags & ELF::SHF_EXECINSTR, type == ELF::SHT_NOBITS, + Begin), Type(type), Flags(flags), UniqueID(UniqueID), EntrySize(entrySize), Group(group, IsComdat), LinkedToSym(LinkedToSym) { assert((!(Flags & ELF::SHF_GROUP) || Group.getPointer()) && @@ -83,7 +83,6 @@ public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override; bool isUnique() const { return UniqueID != NonUniqueID; } unsigned getUniqueID() const { return UniqueID; } @@ -100,10 +99,6 @@ public: std::pair<uint64_t, uint64_t> getOffsets() const { return std::make_pair(StartOffset, EndOffset); } - - static bool classof(const MCSection *S) { - return S->getVariant() == SV_ELF; - } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionGOFF.h b/llvm/include/llvm/MC/MCSectionGOFF.h index b166397..491e56b 100644 --- a/llvm/include/llvm/MC/MCSectionGOFF.h +++ b/llvm/include/llvm/MC/MCSectionGOFF.h @@ -56,32 +56,27 @@ class LLVM_ABI MCSectionGOFF final : public MCSection { MCSectionGOFF(StringRef Name, SectionKind K, bool IsVirtual, GOFF::SDAttr SDAttributes, MCSectionGOFF *Parent) - : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr), - Parent(Parent), SDAttributes(SDAttributes), - SymbolType(GOFF::ESD_ST_SectionDefinition), IsBSS(K.isBSS()), - RequiresNonZeroLength(0), Emitted(0) {} + : MCSection(Name, K.isText(), IsVirtual, nullptr), Parent(Parent), + SDAttributes(SDAttributes), SymbolType(GOFF::ESD_ST_SectionDefinition), + IsBSS(K.isBSS()), RequiresNonZeroLength(0), Emitted(0) {} MCSectionGOFF(StringRef Name, SectionKind K, bool IsVirtual, GOFF::EDAttr EDAttributes, MCSectionGOFF *Parent) - : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr), - Parent(Parent), EDAttributes(EDAttributes), - SymbolType(GOFF::ESD_ST_ElementDefinition), IsBSS(K.isBSS()), - RequiresNonZeroLength(0), Emitted(0) {} + : MCSection(Name, K.isText(), IsVirtual, nullptr), Parent(Parent), + EDAttributes(EDAttributes), SymbolType(GOFF::ESD_ST_ElementDefinition), + IsBSS(K.isBSS()), RequiresNonZeroLength(0), Emitted(0) {} MCSectionGOFF(StringRef Name, SectionKind K, bool IsVirtual, GOFF::PRAttr PRAttributes, MCSectionGOFF *Parent) - : MCSection(SV_GOFF, Name, K.isText(), IsVirtual, nullptr), - Parent(Parent), PRAttributes(PRAttributes), - SymbolType(GOFF::ESD_ST_PartReference), IsBSS(K.isBSS()), - RequiresNonZeroLength(0), Emitted(0) {} + : MCSection(Name, K.isText(), IsVirtual, nullptr), Parent(Parent), + PRAttributes(PRAttributes), SymbolType(GOFF::ESD_ST_PartReference), + IsBSS(K.isBSS()), RequiresNonZeroLength(0), Emitted(0) {} public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override { return false; } - // Return the parent section. MCSectionGOFF *getParent() const { return Parent; } @@ -123,8 +118,6 @@ public: bool requiresNonZeroLength() const { return RequiresNonZeroLength; } void setName(StringRef SectionName) { Name = SectionName; } - - static bool classof(const MCSection *S) { return S->getVariant() == SV_GOFF; } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h index 4312175..1588847 100644 --- a/llvm/include/llvm/MC/MCSectionMachO.h +++ b/llvm/include/llvm/MC/MCSectionMachO.h @@ -79,7 +79,6 @@ public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override; void allocAtoms(); const MCSymbol *getAtom(size_t I) const; @@ -87,10 +86,6 @@ public: unsigned getLayoutOrder() const { return LayoutOrder; } void setLayoutOrder(unsigned Value) { LayoutOrder = Value; } - - static bool classof(const MCSection *S) { - return S->getVariant() == SV_MachO; - } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionSPIRV.h b/llvm/include/llvm/MC/MCSectionSPIRV.h index 091114a..6850965 100644 --- a/llvm/include/llvm/MC/MCSectionSPIRV.h +++ b/llvm/include/llvm/MC/MCSectionSPIRV.h @@ -18,22 +18,13 @@ namespace llvm { -class MCSymbol; - class MCSectionSPIRV final : public MCSection { friend class MCContext; MCSectionSPIRV() - : MCSection(SV_SPIRV, "", /*IsText=*/true, /*IsVirtual=*/false, + : MCSection("", /*IsText=*/true, /*IsVirtual=*/false, /*Begin=*/nullptr) {} // TODO: Add StringRef Name to MCSectionSPIRV. - -public: - ~MCSectionSPIRV() = default; - void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, - raw_ostream &OS, - uint32_t Subsection) const override {} - bool useCodeAlign() const override { return false; } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionWasm.h b/llvm/include/llvm/MC/MCSectionWasm.h index 4523818..86f1418 100644 --- a/llvm/include/llvm/MC/MCSectionWasm.h +++ b/llvm/include/llvm/MC/MCSectionWasm.h @@ -51,7 +51,7 @@ class MCSectionWasm final : public MCSection { friend class MCContext; MCSectionWasm(StringRef Name, SectionKind K, unsigned SegmentFlags, const MCSymbolWasm *Group, unsigned UniqueID, MCSymbol *Begin) - : MCSection(SV_Wasm, Name, K.isText(), /*IsVirtual=*/false, Begin), + : MCSection(Name, K.isText(), /*IsVirtual=*/false, Begin), UniqueID(UniqueID), Group(Group), IsWasmData(K.isReadOnly() || K.isWriteable()), IsMetadata(K.isMetadata()), SegmentFlags(SegmentFlags) {} @@ -67,7 +67,6 @@ public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override; bool isWasmData() const { return IsWasmData; } bool isMetadata() const { return IsMetadata; } @@ -89,7 +88,6 @@ public: assert(isWasmData()); IsPassive = V; } - static bool classof(const MCSection *S) { return S->getVariant() == SV_Wasm; } }; } // end namespace llvm diff --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h index 499df6b5..ca0946c 100644 --- a/llvm/include/llvm/MC/MCSectionXCOFF.h +++ b/llvm/include/llvm/MC/MCSectionXCOFF.h @@ -46,7 +46,7 @@ class MCSectionXCOFF final : public MCSection { XCOFF::SymbolType ST, SectionKind K, MCSymbolXCOFF *QualName, MCSymbol *Begin, StringRef SymbolTableName, bool MultiSymbolsAllowed) - : MCSection(SV_XCOFF, Name, K.isText(), + : MCSection(Name, K.isText(), /*IsVirtual=*/ST == XCOFF::XTY_CM && SMC != XCOFF::XMC_TD, Begin), CsectProp(XCOFF::CsectProperties(SMC, ST)), QualName(QualName), @@ -77,7 +77,7 @@ class MCSectionXCOFF final : public MCSection { XCOFF::DwarfSectionSubtypeFlags DwarfSubtypeFlags, MCSymbol *Begin, StringRef SymbolTableName, bool MultiSymbolsAllowed) - : MCSection(SV_XCOFF, Name, K.isText(), /*IsVirtual=*/false, Begin), + : MCSection(Name, K.isText(), /*IsVirtual=*/false, Begin), QualName(QualName), SymbolTableName(SymbolTableName), DwarfSubtypeFlags(DwarfSubtypeFlags), MultiSymbolsAllowed(MultiSymbolsAllowed), Kind(K) { @@ -95,10 +95,6 @@ class MCSectionXCOFF final : public MCSection { public: ~MCSectionXCOFF(); - static bool classof(const MCSection *S) { - return S->getVariant() == SV_XCOFF; - } - XCOFF::StorageMappingClass getMappingClass() const { assert(isCsect() && "Only csect section has mapping class property!"); return CsectProp->MappingClass; @@ -118,7 +114,6 @@ public: void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override; - bool useCodeAlign() const override; StringRef getSymbolTableName() const { return SymbolTableName; } void setSymbolTableName(StringRef STN) { SymbolTableName = STN; } bool isMultiSymbolsAllowed() const { return MultiSymbolsAllowed; } diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index dfaf348..79c715e 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -438,7 +438,7 @@ public: assert(!CurFrag || CurFrag->getKind() == MCFragment::FT_Data); return CurFrag; } - size_t getCurFragOffset() const { return getCurrentFragment()->Offset; } + size_t getCurFragSize() const { return getCurrentFragment()->getFixedSize(); } /// Save the current and previous section on the section stack. void pushSection() { SectionStack.push_back( @@ -459,7 +459,7 @@ public: bool switchSection(MCSection *Section, const MCExpr *); /// Similar to switchSection, but does not print the section directive. - virtual void switchSectionNoPrint(MCSection *Section); + void switchSectionNoPrint(MCSection *Section); /// Create the default sections and set the initial one. virtual void initSections(bool NoExecStack, const MCSubtargetInfo &STI); diff --git a/llvm/include/llvm/MC/MCXCOFFStreamer.h b/llvm/include/llvm/MC/MCXCOFFStreamer.h index 870d48f..c3bc2ca9 100644 --- a/llvm/include/llvm/MC/MCXCOFFStreamer.h +++ b/llvm/include/llvm/MC/MCXCOFFStreamer.h @@ -22,6 +22,7 @@ public: XCOFFObjectWriter &getWriter(); + void changeSection(MCSection *Section, uint32_t Subsection = 0) override; bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override; void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override; diff --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h index 9556bf2..b1b17e3 100644 --- a/llvm/include/llvm/Support/DebugLog.h +++ b/llvm/include/llvm/Support/DebugLog.h @@ -26,10 +26,17 @@ namespace llvm { // << "] " << "Bitset contains: " << Bitset << "\n"); #define LDBG() DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), DEBUG_TYPE) +#if defined(__SHORT_FILE__) +#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, TYPE) \ + for (bool _c = (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)); _c; \ + _c = false) \ + ::llvm::impl::LogWithNewline(TYPE, __SHORT_FILE__, __LINE__, (STREAM)) +#else #define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, TYPE) \ for (bool _c = (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)); _c; \ _c = false) \ ::llvm::impl::LogWithNewline(TYPE, __FILE__, __LINE__, (STREAM)) +#endif namespace impl { class LogWithNewline { @@ -37,9 +44,12 @@ public: LogWithNewline(const char *debug_type, const char *file, int line, raw_ostream &os) : os(os) { +#if !defined(__SHORT_FILE__) + file = ::llvm::impl::LogWithNewline::getShortFileName(file); +#endif if (debug_type) - os << debug_type << " "; - os << "[" << file << ":" << line << "] "; + os << "[" << debug_type << "] "; + os << file << ":" << line << " "; } ~LogWithNewline() { os << '\n'; } template <typename T> raw_ostream &operator<<(const T &t) && { @@ -51,6 +61,16 @@ public: LogWithNewline(const LogWithNewline &) = delete; LogWithNewline &operator=(const LogWithNewline &) = delete; LogWithNewline &operator=(LogWithNewline &&) = delete; + static constexpr const char *getShortFileName(const char *path) { + // Remove the path prefix from the file name. + const char *filename = path; + for (const char *p = path; *p != '\0'; ++p) { + if (*p == '/' || *p == '\\') { + filename = p + 1; + } + } + return filename; + } private: raw_ostream &os; diff --git a/llvm/include/llvm/TextAPI/SymbolSet.h b/llvm/include/llvm/TextAPI/SymbolSet.h index cd30663..a04cb35 100644 --- a/llvm/include/llvm/TextAPI/SymbolSet.h +++ b/llvm/include/llvm/TextAPI/SymbolSet.h @@ -92,6 +92,7 @@ private: public: SymbolSet() = default; + ~SymbolSet(); LLVM_ABI Symbol *addGlobal(EncodeKind Kind, StringRef Name, SymbolFlags Flags, const Target &Targ); size_t size() const { return Symbols.size(); } diff --git a/llvm/include/llvm/Transforms/ObjCARC.h b/llvm/include/llvm/Transforms/ObjCARC.h index c927513..c4b4c4f 100644 --- a/llvm/include/llvm/Transforms/ObjCARC.h +++ b/llvm/include/llvm/Transforms/ObjCARC.h @@ -35,10 +35,6 @@ struct ObjCARCContractPass : public PassInfoMixin<ObjCARCContractPass> { LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); }; -struct ObjCARCAPElimPass : public PassInfoMixin<ObjCARCAPElimPass> { - LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); -}; - struct ObjCARCExpandPass : public PassInfoMixin<ObjCARCExpandPass> { LLVM_ABI PreservedAnalyses run(Function &M, FunctionAnalysisManager &AM); }; |