aboutsummaryrefslogtreecommitdiff
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Analysis/IR2Vec.h2
-rw-r--r--llvm/include/llvm/CodeGen/CommandFlags.h2
-rw-r--r--llvm/include/llvm/CodeGen/MIRYamlMapping.h3
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h2
-rw-r--r--llvm/include/llvm/MC/MCAsmInfo.h4
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoCOFF.h2
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoDarwin.h2
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoELF.h2
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoGOFF.h3
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoWasm.h3
-rw-r--r--llvm/include/llvm/MC/MCAsmInfoXCOFF.h2
-rw-r--r--llvm/include/llvm/MC/MCSection.h6
-rw-r--r--llvm/include/llvm/MC/MCSectionCOFF.h7
-rw-r--r--llvm/include/llvm/MC/MCSectionDXContainer.h4
-rw-r--r--llvm/include/llvm/MC/MCSectionELF.h9
-rw-r--r--llvm/include/llvm/MC/MCSectionGOFF.h5
-rw-r--r--llvm/include/llvm/MC/MCSectionMachO.h7
-rw-r--r--llvm/include/llvm/MC/MCSectionSPIRV.h8
-rw-r--r--llvm/include/llvm/MC/MCSectionWasm.h9
-rw-r--r--llvm/include/llvm/MC/MCSectionXCOFF.h4
-rw-r--r--llvm/include/llvm/MC/MCSymbolELF.h1
-rw-r--r--llvm/include/llvm/Support/Debug.h12
-rw-r--r--llvm/include/llvm/Support/DebugLog.h173
-rw-r--r--llvm/include/llvm/Support/ThreadPool.h8
-rw-r--r--llvm/include/llvm/Target/TargetOptions.h12
-rw-r--r--llvm/include/llvm/Target/TargetSelectionDAG.td3
-rw-r--r--llvm/include/llvm/TargetParser/Triple.h7
-rw-r--r--llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h7
28 files changed, 194 insertions, 115 deletions
diff --git a/llvm/include/llvm/Analysis/IR2Vec.h b/llvm/include/llvm/Analysis/IR2Vec.h
index d87457c..498c19b 100644
--- a/llvm/include/llvm/Analysis/IR2Vec.h
+++ b/llvm/include/llvm/Analysis/IR2Vec.h
@@ -153,6 +153,7 @@ class Vocabulary {
static_cast<unsigned>(OperandKind::MaxOperandKind),
"OperandKindNames array size must match MaxOperandKind");
+public:
/// Vocabulary layout constants
#define LAST_OTHER_INST(NUM) static constexpr unsigned MaxOpcodes = NUM;
#include "llvm/IR/Instruction.def"
@@ -162,7 +163,6 @@ class Vocabulary {
static constexpr unsigned MaxOperandKinds =
static_cast<unsigned>(OperandKind::MaxOperandKind);
-public:
Vocabulary() = default;
Vocabulary(VocabVector &&Vocab);
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index aefdb53..d500e94 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -133,6 +133,8 @@ LLVM_ABI bool getEnableStackSizeSection();
LLVM_ABI bool getEnableAddrsig();
+LLVM_ABI bool getEnableCallGraphSection();
+
LLVM_ABI bool getEmitCallSiteInfo();
LLVM_ABI bool getEnableMachineFunctionSplitter();
diff --git a/llvm/include/llvm/CodeGen/MIRYamlMapping.h b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
index 119786f..0f3f945 100644
--- a/llvm/include/llvm/CodeGen/MIRYamlMapping.h
+++ b/llvm/include/llvm/CodeGen/MIRYamlMapping.h
@@ -482,6 +482,8 @@ struct CallSiteInfo {
MachineInstrLoc CallLocation;
std::vector<ArgRegPair> ArgForwardingRegs;
+ /// Numeric callee type identifiers for the callgraph section.
+ std::vector<uint64_t> CalleeTypeIds;
bool operator==(const CallSiteInfo &Other) const {
return CallLocation.BlockNum == Other.CallLocation.BlockNum &&
@@ -511,6 +513,7 @@ template <> struct MappingTraits<CallSiteInfo> {
YamlIO.mapRequired("offset", CSInfo.CallLocation.Offset);
YamlIO.mapOptional("fwdArgRegs", CSInfo.ArgForwardingRegs,
std::vector<CallSiteInfo::ArgRegPair>());
+ YamlIO.mapOptional("calleeTypeIds", CSInfo.CalleeTypeIds);
}
static const bool flow = true;
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index e5958ec..7f88323 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -515,6 +515,8 @@ public:
struct CallSiteInfo {
/// Vector of call argument and its forwarding register.
SmallVector<ArgRegPair, 1> ArgRegPairs;
+ /// Callee type ids.
+ SmallVector<ConstantInt *, 4> CalleeTypeIds;
};
struct CalledGlobalInfo {
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 402e12a..6c12cd3 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -35,6 +35,7 @@ class MCStreamer;
class MCSubtargetInfo;
class MCSymbol;
class MCValue;
+class Triple;
class raw_ostream;
namespace WinEH {
@@ -485,6 +486,9 @@ public:
/// syntactically correct.
virtual bool isValidUnquotedName(StringRef Name) const;
+ virtual void printSwitchToSection(const MCSection &, uint32_t Subsection,
+ const Triple &, raw_ostream &) const {}
+
/// Return true if the .section directive should be omitted when
/// emitting \p SectionName. For example:
///
diff --git a/llvm/include/llvm/MC/MCAsmInfoCOFF.h b/llvm/include/llvm/MC/MCAsmInfoCOFF.h
index 631b549..dc7832c 100644
--- a/llvm/include/llvm/MC/MCAsmInfoCOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoCOFF.h
@@ -15,6 +15,8 @@ namespace llvm {
class MCAsmInfoCOFF : public MCAsmInfo {
virtual void anchor();
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
bool useCodeAlign(const MCSection &Sec) const final;
protected:
diff --git a/llvm/include/llvm/MC/MCAsmInfoDarwin.h b/llvm/include/llvm/MC/MCAsmInfoDarwin.h
index 9bc5dd7..12bc3e9 100644
--- a/llvm/include/llvm/MC/MCAsmInfoDarwin.h
+++ b/llvm/include/llvm/MC/MCAsmInfoDarwin.h
@@ -21,6 +21,8 @@ namespace llvm {
class MCAsmInfoDarwin : public MCAsmInfo {
public:
explicit MCAsmInfoDarwin();
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
bool useCodeAlign(const MCSection &Sec) const final;
/// True if the section is atomized using the symbols in it.
diff --git a/llvm/include/llvm/MC/MCAsmInfoELF.h b/llvm/include/llvm/MC/MCAsmInfoELF.h
index 80cbf5c..c05e4ad 100644
--- a/llvm/include/llvm/MC/MCAsmInfoELF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoELF.h
@@ -16,6 +16,8 @@ namespace llvm {
class MCAsmInfoELF : public MCAsmInfo {
virtual void anchor();
MCSection *getNonexecutableStackSection(MCContext &Ctx) const final;
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
bool useCodeAlign(const MCSection &Sec) const final;
protected:
diff --git a/llvm/include/llvm/MC/MCAsmInfoGOFF.h b/llvm/include/llvm/MC/MCAsmInfoGOFF.h
index 1f3b263..e62d2ae 100644
--- a/llvm/include/llvm/MC/MCAsmInfoGOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoGOFF.h
@@ -19,7 +19,8 @@
namespace llvm {
class MCAsmInfoGOFF : public MCAsmInfo {
- virtual void anchor();
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
protected:
MCAsmInfoGOFF();
diff --git a/llvm/include/llvm/MC/MCAsmInfoWasm.h b/llvm/include/llvm/MC/MCAsmInfoWasm.h
index 3afc610..d98de6c 100644
--- a/llvm/include/llvm/MC/MCAsmInfoWasm.h
+++ b/llvm/include/llvm/MC/MCAsmInfoWasm.h
@@ -13,7 +13,8 @@
namespace llvm {
class MCAsmInfoWasm : public MCAsmInfo {
- virtual void anchor();
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
protected:
MCAsmInfoWasm();
diff --git a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
index 06a3fed..fd1ae82 100644
--- a/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
+++ b/llvm/include/llvm/MC/MCAsmInfoXCOFF.h
@@ -16,6 +16,8 @@ namespace llvm {
class MCAsmInfoXCOFF : public MCAsmInfo {
protected:
MCAsmInfoXCOFF();
+ void printSwitchToSection(const MCSection &, uint32_t, const Triple &,
+ raw_ostream &) const final;
bool useCodeAlign(const MCSection &Sec) const final;
public:
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index 9378786..7989310 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -597,8 +597,6 @@ protected:
StringRef Name;
MCSection(StringRef Name, bool IsText, bool IsBss, MCSymbol *Begin);
- // Protected non-virtual dtor prevents destroy through a base class pointer.
- ~MCSection() {}
public:
MCSection(const MCSection &) = delete;
@@ -648,10 +646,6 @@ public:
void dump(DenseMap<const MCFragment *, SmallVector<const MCSymbol *, 0>>
*FragToSyms = nullptr) const;
- virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const = 0;
-
/// Check whether this section is "virtual", that is has no actual object
/// file contents.
bool isBssSection() const { return IsBss; }
diff --git a/llvm/include/llvm/MC/MCSectionCOFF.h b/llvm/include/llvm/MC/MCSectionCOFF.h
index 8df54a4..71efc41 100644
--- a/llvm/include/llvm/MC/MCSectionCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionCOFF.h
@@ -51,6 +51,7 @@ class MCSectionCOFF final : public MCSection {
private:
friend class MCContext;
+ friend class MCAsmInfoCOFF;
// The storage of Name is owned by MCContext's COFFUniquingMap.
MCSectionCOFF(StringRef Name, unsigned Characteristics,
MCSymbol *COMDATSymbol, int Selection, unsigned UniqueID,
@@ -67,7 +68,7 @@ private:
public:
/// Decides whether a '.section' directive should be printed before the
/// section name
- bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
+ bool shouldOmitSectionDirective(StringRef Name) const;
unsigned getCharacteristics() const { return Characteristics; }
MCSymbol *getCOMDATSymbol() const { return COMDATSymbol; }
@@ -78,10 +79,6 @@ public:
bool isUnique() const { return UniqueID != NonUniqueID; }
unsigned getUniqueID() const { return UniqueID; }
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const override;
-
unsigned getOrAssignWinCFISectionID(unsigned *NextID) const {
if (WinCFISectionID == ~0U)
WinCFISectionID = (*NextID)++;
diff --git a/llvm/include/llvm/MC/MCSectionDXContainer.h b/llvm/include/llvm/MC/MCSectionDXContainer.h
index 2516afa..7d8e0c5 100644
--- a/llvm/include/llvm/MC/MCSectionDXContainer.h
+++ b/llvm/include/llvm/MC/MCSectionDXContainer.h
@@ -25,10 +25,6 @@ class MCSectionDXContainer final : public MCSection {
MCSectionDXContainer(StringRef Name, SectionKind K, MCSymbol *Begin)
: MCSection(Name, K.isText(), /*IsVirtual=*/false, Begin) {}
-
-public:
- void printSwitchToSection(const MCAsmInfo &, const Triple &, raw_ostream &,
- uint32_t) const override;
};
} // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h
index 287b57c..f089dd9 100644
--- a/llvm/include/llvm/MC/MCSectionELF.h
+++ b/llvm/include/llvm/MC/MCSectionELF.h
@@ -52,6 +52,7 @@ class MCSectionELF final : public MCSection {
private:
friend class MCContext;
+ friend class MCAsmInfoELF;
// The storage of Name is owned by MCContext's ELFUniquingMap.
MCSectionELF(StringRef Name, unsigned type, unsigned flags,
@@ -69,10 +70,6 @@ private:
}
public:
- /// Decides whether a '.section' directive should be printed before the
- /// section name
- bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
-
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
unsigned getEntrySize() const { return EntrySize; }
@@ -80,10 +77,6 @@ public:
const MCSymbolELF *getGroup() const { return Group.getPointer(); }
bool isComdat() const { return Group.getInt(); }
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const override;
-
bool isUnique() const { return UniqueID != NonUniqueID; }
unsigned getUniqueID() const { return UniqueID; }
diff --git a/llvm/include/llvm/MC/MCSectionGOFF.h b/llvm/include/llvm/MC/MCSectionGOFF.h
index 491e56b..2136148 100644
--- a/llvm/include/llvm/MC/MCSectionGOFF.h
+++ b/llvm/include/llvm/MC/MCSectionGOFF.h
@@ -52,6 +52,7 @@ class LLVM_ABI MCSectionGOFF final : public MCSection {
mutable unsigned Emitted : 1;
friend class MCContext;
+ friend class MCAsmInfoGOFF;
friend class MCSymbolGOFF;
MCSectionGOFF(StringRef Name, SectionKind K, bool IsVirtual,
@@ -73,10 +74,6 @@ class LLVM_ABI MCSectionGOFF final : public MCSection {
IsBSS(K.isBSS()), RequiresNonZeroLength(0), Emitted(0) {}
public:
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const override;
-
// Return the parent section.
MCSectionGOFF *getParent() const { return Parent; }
diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h
index 1588847..a65d7e0 100644
--- a/llvm/include/llvm/MC/MCSectionMachO.h
+++ b/llvm/include/llvm/MC/MCSectionMachO.h
@@ -23,6 +23,8 @@ namespace llvm {
/// This represents a section on a Mach-O system (used by Mac OS X). On a Mac
/// system, these are also described in /usr/include/mach-o/loader.h.
class LLVM_ABI MCSectionMachO final : public MCSection {
+ friend class MCContext;
+ friend class MCAsmInfoDarwin;
char SegmentName[16]; // Not necessarily null terminated!
/// This is the SECTION_TYPE and SECTION_ATTRIBUTES field of a section, drawn
@@ -42,7 +44,6 @@ class LLVM_ABI MCSectionMachO final : public MCSection {
MCSectionMachO(StringRef Segment, StringRef Section, unsigned TAA,
unsigned reserved2, SectionKind K, MCSymbol *Begin);
- friend class MCContext;
public:
StringRef getSegmentName() const {
@@ -76,10 +77,6 @@ public:
bool &TAAParsed, // Out.
unsigned &StubSize); // Out.
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const override;
-
void allocAtoms();
const MCSymbol *getAtom(size_t I) const;
void setAtom(size_t I, const MCSymbol *Sym);
diff --git a/llvm/include/llvm/MC/MCSectionSPIRV.h b/llvm/include/llvm/MC/MCSectionSPIRV.h
index 2b3e931..6850965 100644
--- a/llvm/include/llvm/MC/MCSectionSPIRV.h
+++ b/llvm/include/llvm/MC/MCSectionSPIRV.h
@@ -18,8 +18,6 @@
namespace llvm {
-class MCSymbol;
-
class MCSectionSPIRV final : public MCSection {
friend class MCContext;
@@ -27,12 +25,6 @@ class MCSectionSPIRV final : public MCSection {
: 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 {}
};
} // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCSectionWasm.h b/llvm/include/llvm/MC/MCSectionWasm.h
index 86f1418..5ec01ed 100644
--- a/llvm/include/llvm/MC/MCSectionWasm.h
+++ b/llvm/include/llvm/MC/MCSectionWasm.h
@@ -49,6 +49,7 @@ class MCSectionWasm final : public MCSection {
// The storage of Name is owned by MCContext's WasmUniquingMap.
friend class MCContext;
+ friend class MCAsmInfoWasm;
MCSectionWasm(StringRef Name, SectionKind K, unsigned SegmentFlags,
const MCSymbolWasm *Group, unsigned UniqueID, MCSymbol *Begin)
: MCSection(Name, K.isText(), /*IsVirtual=*/false, Begin),
@@ -57,17 +58,9 @@ class MCSectionWasm final : public MCSection {
IsMetadata(K.isMetadata()), SegmentFlags(SegmentFlags) {}
public:
- /// Decides whether a '.section' directive should be printed before the
- /// section name
- bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
-
const MCSymbolWasm *getGroup() const { return Group; }
unsigned getSegmentFlags() const { return SegmentFlags; }
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) const override;
-
bool isWasmData() const { return IsWasmData; }
bool isMetadata() const { return IsMetadata; }
diff --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h
index ca0946c..0571f95 100644
--- a/llvm/include/llvm/MC/MCSectionXCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionXCOFF.h
@@ -31,6 +31,7 @@ namespace llvm {
// implemented yet.
class MCSectionXCOFF final : public MCSection {
friend class MCContext;
+ friend class MCAsmInfoXCOFF;
std::optional<XCOFF::CsectProperties> CsectProp;
MCSymbolXCOFF *const QualName;
@@ -111,9 +112,6 @@ public:
}
MCSymbolXCOFF *getQualNameSymbol() const { return QualName; }
- void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
- raw_ostream &OS,
- uint32_t Subsection) 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/MCSymbolELF.h b/llvm/include/llvm/MC/MCSymbolELF.h
index eba9964..7c271e7 100644
--- a/llvm/include/llvm/MC/MCSymbolELF.h
+++ b/llvm/include/llvm/MC/MCSymbolELF.h
@@ -13,6 +13,7 @@
namespace llvm {
class MCSymbolELF : public MCSymbol {
+ friend class MCAsmInfoELF;
/// An expression describing how to calculate the size of a symbol. If a
/// symbol has no size this field will be NULL.
const MCExpr *SymbolSize = nullptr;
diff --git a/llvm/include/llvm/Support/Debug.h b/llvm/include/llvm/Support/Debug.h
index 924d7b2..5542089 100644
--- a/llvm/include/llvm/Support/Debug.h
+++ b/llvm/include/llvm/Support/Debug.h
@@ -39,13 +39,19 @@ class raw_ostream;
/// isCurrentDebugType - Return true if the specified string is the debug type
/// specified on the command line, or if none was specified on the command line
/// with the -debug-only=X option.
-///
-bool isCurrentDebugType(const char *Type);
+/// An optional level can be provided to control the verbosity of the output.
+/// If the provided level is not 0 and user specified a level below the provided
+/// level, return false.
+bool isCurrentDebugType(const char *Type, int Level = 0);
/// setCurrentDebugType - Set the current debug type, as if the -debug-only=X
/// option were specified. Note that DebugFlag also needs to be set to true for
/// debug output to be produced.
-///
+/// The debug type format is "type[:level]", where the level is an optional
+/// integer. If a level is provided, the debug output is enabled only if the
+/// user specified a level at least as high as the provided level.
+/// 0 is a special level that acts as an opt-out for this specific debug type
+/// without affecting the other debug output.
void setCurrentDebugType(const char *Type);
/// setCurrentDebugTypes - Set the current debug type, as if the
diff --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h
index b1b17e3..8fca2d5 100644
--- a/llvm/include/llvm/Support/DebugLog.h
+++ b/llvm/include/llvm/Support/DebugLog.h
@@ -19,67 +19,154 @@
namespace llvm {
#ifndef NDEBUG
-// Output with given inputs and trailing newline. E.g.,
+// LDBG() is a macro that can be used as a raw_ostream for debugging.
+// It will stream the output to the dbgs() stream, with a prefix of the
+// debug type and the file and line number. A trailing newline is added to the
+// output automatically. If the streamed content contains a newline, the prefix
+// is added to each beginning of a new line. Nothing is printed if the debug
+// output is not enabled or the debug type does not match.
+//
+// E.g.,
// LDBG() << "Bitset contains: " << Bitset;
-// is equivalent to
-// LLVM_DEBUG(dbgs() << DEBUG_TYPE << " [" << __FILE__ << ":" << __LINE__
-// << "] " << "Bitset contains: " << Bitset << "\n");
-#define LDBG() DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), DEBUG_TYPE)
+// is somehow equivalent to
+// LLVM_DEBUG(dbgs() << "[" << DEBUG_TYPE << "] " << __FILE__ << ":" <<
+// __LINE__ << " "
+// << "Bitset contains: " << Bitset << "\n");
+//
+// An optional `level` argument can be provided to control the verbosity of the
+// output. The default level is 1, and is in increasing level of verbosity.
+//
+// The `level` argument can be a literal integer, or a macro that evaluates to
+// an integer.
+//
+#define LDBG(...) _GET_LDBG_MACRO(__VA_ARGS__)(__VA_ARGS__)
+
+// Helper macros to choose the correct macro based on the number of arguments.
+#define LDBG_FUNC_CHOOSER(_f1, _f2, ...) _f2
+#define LDBG_FUNC_RECOMPOSER(argsWithParentheses) \
+ LDBG_FUNC_CHOOSER argsWithParentheses
+#define LDBG_CHOOSE_FROM_ARG_COUNT(...) \
+ LDBG_FUNC_RECOMPOSER((__VA_ARGS__, LDBG_LOG_LEVEL, ))
+#define LDBG_NO_ARG_EXPANDER() , LDBG_LOG_LEVEL_1
+#define _GET_LDBG_MACRO(...) \
+ LDBG_CHOOSE_FROM_ARG_COUNT(LDBG_NO_ARG_EXPANDER __VA_ARGS__())
+
+// Dispatch macros to support the `level` argument or none (default to 1)
+#define LDBG_LOG_LEVEL(LEVEL) \
+ DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), LEVEL, DEBUG_TYPE)
+#define LDBG_LOG_LEVEL_1() LDBG_LOG_LEVEL(1)
+#define DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL, TYPE, FILE, \
+ LINE) \
+ for (bool _c = \
+ (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE, LEVEL)); \
+ _c; _c = false) \
+ ::llvm::impl::raw_ldbg_ostream{ \
+ ::llvm::impl::computePrefix(TYPE, FILE, LINE, LEVEL), (STREAM)} \
+ .asLvalue()
+
+#define DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL, TYPE, FILE) \
+ DEBUGLOG_WITH_STREAM_TYPE_FILE_AND_LINE(STREAM, LEVEL, TYPE, FILE, __LINE__)
+// When __SHORT_FILE__ is not defined, the File is the full path,
+// otherwise __SHORT_FILE__ is defined in CMake to provide the file name
+// without the path prefix.
#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))
+#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, LEVEL, TYPE) \
+ DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL, TYPE, __SHORT_FILE__)
#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))
+#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, LEVEL, TYPE) \
+ DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, LEVEL, TYPE, \
+ ::llvm::impl::getShortFileName(__FILE__))
#endif
namespace impl {
-class LogWithNewline {
-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 << " ";
+
+/// A raw_ostream that tracks `\n` and print the prefix.
+class LLVM_ABI raw_ldbg_ostream final : public raw_ostream {
+ std::string Prefix;
+ raw_ostream &Os;
+ bool HasPendingNewline = true;
+
+ /// Split the line on newlines and insert the prefix before each newline.
+ /// Forward everything to the underlying stream.
+ void write_impl(const char *Ptr, size_t Size) final {
+ auto Str = StringRef(Ptr, Size);
+ // Handle the initial prefix.
+ if (!Str.empty())
+ writeWithPrefix(StringRef());
+
+ auto Eol = Str.find('\n');
+ while (Eol != StringRef::npos) {
+ StringRef Line = Str.take_front(Eol + 1);
+ if (!Line.empty())
+ writeWithPrefix(Line);
+ HasPendingNewline = true;
+ Str = Str.drop_front(Eol + 1);
+ Eol = Str.find('\n');
+ }
+ if (!Str.empty())
+ writeWithPrefix(Str);
}
- ~LogWithNewline() { os << '\n'; }
- template <typename T> raw_ostream &operator<<(const T &t) && {
- return os << t;
+ void emitPrefix() { Os.write(Prefix.c_str(), Prefix.size()); }
+ void writeWithPrefix(StringRef Str) {
+ if (HasPendingNewline) {
+ emitPrefix();
+ HasPendingNewline = false;
+ }
+ Os.write(Str.data(), Str.size());
}
- // Prevent copying, as this class manages newline responsibility and is
- // intended for use as a temporary.
- 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;
- }
+public:
+ explicit raw_ldbg_ostream(std::string Prefix, raw_ostream &Os)
+ : Prefix(std::move(Prefix)), Os(Os) {
+ SetUnbuffered();
+ }
+ ~raw_ldbg_ostream() final {
+ flushEol();
+ Os << '\n';
+ }
+ void flushEol() {
+ if (HasPendingNewline) {
+ emitPrefix();
+ HasPendingNewline = false;
}
- return filename;
}
-private:
- raw_ostream &os;
+ /// Forward the current_pos method to the underlying stream.
+ uint64_t current_pos() const final { return Os.tell(); }
+
+ /// Some of the `<<` operators expect an lvalue, so we trick the type system.
+ raw_ldbg_ostream &asLvalue() { return *this; }
};
+
+/// Remove the path prefix from the file name.
+static LLVM_ATTRIBUTE_UNUSED constexpr const char *
+getShortFileName(const char *path) {
+ const char *filename = path;
+ for (const char *p = path; *p != '\0'; ++p) {
+ if (*p == '/' || *p == '\\')
+ filename = p + 1;
+ }
+ return filename;
+}
+
+/// Compute the prefix for the debug log in the form of:
+/// "[DebugType] File:Line "
+/// Where the File is the file name without the path prefix.
+static LLVM_ATTRIBUTE_UNUSED std::string
+computePrefix(const char *DebugType, const char *File, int Line, int Level) {
+ std::string Prefix;
+ raw_string_ostream OsPrefix(Prefix);
+ if (DebugType)
+ OsPrefix << "[" << DebugType << ":" << Level << "] ";
+ OsPrefix << File << ":" << Line << " ";
+ return OsPrefix.str();
+}
} // end namespace impl
#else
// As others in Debug, When compiling without assertions, the -debug-* options
// and all inputs too LDBG() are ignored.
-#define LDBG() \
+#define LDBG(...) \
for (bool _c = false; _c; _c = false) \
::llvm::nulls()
#endif
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 9272760..c26681c 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -149,10 +149,6 @@ public:
/// number of threads!
unsigned getMaxConcurrency() const override { return MaxThreadCount; }
- // TODO: Remove, misleading legacy name warning!
- LLVM_DEPRECATED("Use getMaxConcurrency instead", "getMaxConcurrency")
- unsigned getThreadCount() const { return MaxThreadCount; }
-
/// Returns true if the current thread is a worker thread of this thread pool.
bool isWorkerThread() const;
@@ -233,10 +229,6 @@ public:
/// Returns always 1: there is no concurrency.
unsigned getMaxConcurrency() const override { return 1; }
- // TODO: Remove, misleading legacy name warning!
- LLVM_DEPRECATED("Use getMaxConcurrency instead", "getMaxConcurrency")
- unsigned getThreadCount() const { return 1; }
-
/// Returns true if the current thread is a worker thread of this thread pool.
bool isWorkerThread() const;
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index f420798..db90f2e 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -133,10 +133,11 @@ public:
EmitStackSizeSection(false), EnableMachineOutliner(false),
EnableMachineFunctionSplitter(false),
EnableStaticDataPartitioning(false), SupportsDefaultOutlining(false),
- EmitAddrsig(false), BBAddrMap(false), EmitCallSiteInfo(false),
- SupportsDebugEntryValues(false), EnableDebugEntryValues(false),
- ValueTrackingVariableLocations(false), ForceDwarfFrameSection(false),
- XRayFunctionIndex(true), DebugStrictDwarf(false), Hotpatch(false),
+ EmitAddrsig(false), BBAddrMap(false), EmitCallGraphSection(false),
+ EmitCallSiteInfo(false), SupportsDebugEntryValues(false),
+ EnableDebugEntryValues(false), ValueTrackingVariableLocations(false),
+ ForceDwarfFrameSection(false), XRayFunctionIndex(true),
+ DebugStrictDwarf(false), Hotpatch(false),
PPCGenScalarMASSEntries(false), JMCInstrument(false),
EnableCFIFixup(false), MisExpect(false), XCOFFReadOnlyPointers(false),
VerifyArgABICompliance(true),
@@ -319,6 +320,9 @@ public:
/// to selectively generate basic block sections.
std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
+ /// Emit section containing call graph metadata.
+ unsigned EmitCallGraphSection : 1;
+
/// The flag enables call site info production. It is used only for debug
/// info, and it is restricted only to optimized code. This can be used for
/// something else, so that should be controlled in the frontend.
diff --git a/llvm/include/llvm/Target/TargetSelectionDAG.td b/llvm/include/llvm/Target/TargetSelectionDAG.td
index 8ec8697..a4ed62b 100644
--- a/llvm/include/llvm/Target/TargetSelectionDAG.td
+++ b/llvm/include/llvm/Target/TargetSelectionDAG.td
@@ -1147,6 +1147,9 @@ def fadd_contract : PatFrag<(ops node:$a, node:$b), (fadd node:$a, node:$b),[{
return N->getFlags().hasAllowContract();
}]>;
+def fsub_contract : PatFrag<(ops node:$a, node:$b), (fsub node:$a, node:$b),[{
+ return N->getFlags().hasAllowContract();
+}]>;
def not : PatFrag<(ops node:$in), (xor node:$in, -1)>;
def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>;
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 670a632..ede9797 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -199,7 +199,8 @@ public:
SUSE,
OpenEmbedded,
Intel,
- LastVendorType = Intel
+ Meta,
+ LastVendorType = Meta
};
enum OSType {
UnknownOS,
@@ -307,8 +308,8 @@ public:
Mlibc,
PAuthTest,
-
- LastEnvironmentType = PAuthTest
+ MTIA,
+ LastEnvironmentType = MTIA
};
enum ObjectFormatType {
UnknownObjectFormat,
diff --git a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
index 20850ba..a9a370b 100644
--- a/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
+++ b/llvm/include/llvm/Transforms/HipStdPar/HipStdPar.h
@@ -41,6 +41,13 @@ public:
static bool isRequired() { return true; }
};
+class HipStdParMathFixupPass : public PassInfoMixin<HipStdParMathFixupPass> {
+public:
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+
+ static bool isRequired() { return true; }
+};
+
} // namespace llvm
#endif // LLVM_TRANSFORMS_HIPSTDPAR_HIPSTDPAR_H