aboutsummaryrefslogtreecommitdiff
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/ADT/BitmaskEnum.h1
-rw-r--r--llvm/include/llvm/ADT/ConcurrentHashtable.h1
-rw-r--r--llvm/include/llvm/ADT/PointerSumType.h1
-rw-r--r--llvm/include/llvm/ADT/SetVector.h1
-rw-r--r--llvm/include/llvm/ADT/TinyPtrVector.h1
-rw-r--r--llvm/include/llvm/Analysis/DominanceFrontier.h1
-rw-r--r--llvm/include/llvm/Analysis/DominanceFrontierImpl.h1
-rw-r--r--llvm/include/llvm/CodeGen/AsmPrinter.h6
-rw-r--r--llvm/include/llvm/CodeGen/BasicTTIImpl.h7
-rw-r--r--llvm/include/llvm/CodeGen/TargetInstrInfo.h25
-rw-r--r--llvm/include/llvm/CodeGen/TargetLowering.h1
-rw-r--r--llvm/include/llvm/DWARFLinker/IndexedValuesMap.h1
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/CodeView.h1
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h1
-rw-r--r--llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h39
-rw-r--r--llvm/include/llvm/ExecutionEngine/JITLink/systemz.h924
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h1
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h1
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/Speculation.h1
-rw-r--r--llvm/include/llvm/Frontend/OpenMP/ClauseT.h6
-rw-r--r--llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h363
-rw-r--r--llvm/include/llvm/IR/DiagnosticInfo.h1
-rw-r--r--llvm/include/llvm/IR/PassInstrumentation.h1
-rw-r--r--llvm/include/llvm/IR/PassManager.h1
-rw-r--r--llvm/include/llvm/MC/MCParser/AsmLexer.h1
-rw-r--r--llvm/include/llvm/Passes/CodeGenPassBuilder.h1
-rw-r--r--llvm/include/llvm/ProfileData/HashKeyMap.h1
-rw-r--r--llvm/include/llvm/Support/CFGDiff.h1
-rw-r--r--llvm/include/llvm/Support/CodeGen.h8
-rw-r--r--llvm/include/llvm/Support/GenericDomTree.h1
-rw-r--r--llvm/include/llvm/Support/SpecialCaseList.h103
-rw-r--r--llvm/include/llvm/Support/type_traits.h1
-rw-r--r--llvm/include/llvm/TargetParser/Triple.h14
-rw-r--r--llvm/include/llvm/Telemetry/Telemetry.h1
-rw-r--r--llvm/include/llvm/XRay/YAMLXRayRecord.h2
35 files changed, 1196 insertions, 325 deletions
diff --git a/llvm/include/llvm/ADT/BitmaskEnum.h b/llvm/include/llvm/ADT/BitmaskEnum.h
index 9555fad..c10a38c 100644
--- a/llvm/include/llvm/ADT/BitmaskEnum.h
+++ b/llvm/include/llvm/ADT/BitmaskEnum.h
@@ -11,7 +11,6 @@
#include <cassert>
#include <type_traits>
-#include <utility>
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/bit.h"
diff --git a/llvm/include/llvm/ADT/ConcurrentHashtable.h b/llvm/include/llvm/ADT/ConcurrentHashtable.h
index 0cc03cf..9ee5f59 100644
--- a/llvm/include/llvm/ADT/ConcurrentHashtable.h
+++ b/llvm/include/llvm/ADT/ConcurrentHashtable.h
@@ -24,7 +24,6 @@
#include <iomanip>
#include <mutex>
#include <sstream>
-#include <type_traits>
namespace llvm {
diff --git a/llvm/include/llvm/ADT/PointerSumType.h b/llvm/include/llvm/ADT/PointerSumType.h
index c4971bf..c8e6cff 100644
--- a/llvm/include/llvm/ADT/PointerSumType.h
+++ b/llvm/include/llvm/ADT/PointerSumType.h
@@ -15,7 +15,6 @@
#include <algorithm>
#include <cassert>
#include <cstdint>
-#include <type_traits>
namespace llvm {
diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index c129f3a..0fde141 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -28,7 +28,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h"
#include <cassert>
-#include <iterator>
namespace llvm {
diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h
index 8d7a07b..ed08ec8 100644
--- a/llvm/include/llvm/ADT/TinyPtrVector.h
+++ b/llvm/include/llvm/ADT/TinyPtrVector.h
@@ -15,7 +15,6 @@
#include <cassert>
#include <cstddef>
#include <iterator>
-#include <type_traits>
namespace llvm {
diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h
index 68ddcf7..7877935 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontier.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontier.h
@@ -24,7 +24,6 @@
#include "llvm/Pass.h"
#include "llvm/Support/GenericDomTree.h"
#include <cassert>
-#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
index 871dd95..1483588 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
@@ -24,7 +24,6 @@
#include "llvm/Support/GenericDomTree.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
-#include <utility>
#include <vector>
namespace llvm {
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 9ace255..311f7df 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -18,7 +18,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/MapVector.h"
-#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/StaticDataProfileInfo.h"
@@ -207,9 +207,9 @@ private:
using CGTypeId = uint64_t;
/// Unique target type IDs.
- SmallSet<CGTypeId, 4> IndirectCalleeTypeIDs;
+ SmallSetVector<CGTypeId, 4> IndirectCalleeTypeIDs;
/// Unique direct callees.
- SmallSet<MCSymbol *, 4> DirectCallees;
+ SmallSetVector<MCSymbol *, 4> DirectCallees;
};
enum CallGraphSectionFormatVersion : uint8_t {
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 1c167af..a52ad41 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -334,7 +334,12 @@ private:
break;
case Intrinsic::sincos:
- LC = RTLIB::getSINCOS(ScalarVT);
+ LC = RTLIB::getSINCOS(VT);
+ if (LC == RTLIB::UNKNOWN_LIBCALL)
+ LC = RTLIB::getSINCOS(ScalarVT);
+ else if (VT.isVector())
+ IsVectorCall = true;
+
break;
default:
return std::nullopt;
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
index 02cd925..43f28ed 100644
--- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -159,9 +159,8 @@ public:
/// Given a machine instruction descriptor, returns the register
/// class constraint for OpNum, or NULL.
- virtual const TargetRegisterClass *
- getRegClass(const MCInstrDesc &MCID, unsigned OpNum,
- const TargetRegisterInfo *TRI) const;
+ virtual const TargetRegisterClass *getRegClass(const MCInstrDesc &MCID,
+ unsigned OpNum) const;
/// Returns true if MI is an instruction we are unable to reason about
/// (like a call or something with unmodeled side effects).
@@ -464,8 +463,7 @@ public:
/// SubIdx.
virtual void reMaterialize(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI, Register DestReg,
- unsigned SubIdx, const MachineInstr &Orig,
- const TargetRegisterInfo &TRI) const;
+ unsigned SubIdx, const MachineInstr &Orig) const;
/// Clones instruction or the whole instruction bundle \p Orig and
/// insert into \p MBB before \p InsertBefore. The target may update operands
@@ -1198,8 +1196,7 @@ public:
/// register spill instruction, part of prologue, during the frame lowering.
virtual void storeRegToStackSlot(
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg,
- bool isKill, int FrameIndex, const TargetRegisterClass *RC,
- const TargetRegisterInfo *TRI, Register VReg,
+ bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,
MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const {
llvm_unreachable("Target didn't implement "
"TargetInstrInfo::storeRegToStackSlot!");
@@ -1217,8 +1214,7 @@ public:
/// register reload instruction, part of epilogue, during the frame lowering.
virtual void loadRegFromStackSlot(
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg,
- int FrameIndex, const TargetRegisterClass *RC,
- const TargetRegisterInfo *TRI, Register VReg,
+ int FrameIndex, const TargetRegisterClass *RC, Register VReg,
MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const {
llvm_unreachable("Target didn't implement "
"TargetInstrInfo::loadRegFromStackSlot!");
@@ -1769,17 +1765,6 @@ public:
return true;
}
- /// Return true if it's safe to move a machine instruction.
- /// This allows the backend to prevent certain special instruction
- /// sequences from being broken by instruction motion in optimization
- /// passes.
- /// By default, this returns true for every instruction.
- virtual bool isSafeToMove(const MachineInstr &MI,
- const MachineBasicBlock *MBB,
- const MachineFunction &MF) const {
- return true;
- }
-
/// Test if the given instruction should be considered a scheduling boundary.
/// This primarily includes labels and terminators.
virtual bool isSchedulingBoundary(const MachineInstr &MI,
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 98565f4..4d5d1fc 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -58,7 +58,6 @@
#include <cassert>
#include <climits>
#include <cstdint>
-#include <iterator>
#include <map>
#include <string>
#include <utility>
diff --git a/llvm/include/llvm/DWARFLinker/IndexedValuesMap.h b/llvm/include/llvm/DWARFLinker/IndexedValuesMap.h
index 5e07791..8fde15d 100644
--- a/llvm/include/llvm/DWARFLinker/IndexedValuesMap.h
+++ b/llvm/include/llvm/DWARFLinker/IndexedValuesMap.h
@@ -12,7 +12,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include <cstdint>
-#include <utility>
namespace llvm {
namespace dwarf_linker {
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
index b769e53..7a10086 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeView.h
@@ -15,7 +15,6 @@
#include "llvm/Support/Compiler.h"
#include <cinttypes>
-#include <type_traits>
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/Support/Endian.h"
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h b/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
index 76a019d..17b5bfa 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/FormatUtil.h
@@ -19,7 +19,6 @@
#include "llvm/Support/FormatVariadic.h"
#include <string>
-#include <type_traits>
namespace llvm {
namespace pdb {
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h
new file mode 100644
index 0000000..a996dfd
--- /dev/null
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/ELF_systemz.h
@@ -0,0 +1,39 @@
+//===--- ELF_systemz.h - JIT link functions for ELF/systemz --*- C++ -*----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+//===----------------------------------------------------------------------===//
+//
+// jit-link functions for ELF/systemz.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_EXECUTIONENGINE_JITLINK_ELF_SYSTEMZ_H
+#define LLVM_EXECUTIONENGINE_JITLINK_ELF_SYSTEMZ_H
+
+#include "llvm/ExecutionEngine/JITLink/JITLink.h"
+
+namespace llvm {
+namespace jitlink {
+
+/// Create a LinkGraph from an ELF/systemz relocatable object
+///
+/// Note: The graph does not take ownership of the underlying buffer, nor copy
+/// its contents. The caller is responsible for ensuring that the object buffer
+/// outlives the graph.
+Expected<std::unique_ptr<LinkGraph>> createLinkGraphFromELFObject_systemz(
+ MemoryBufferRef ObjectBuffer, std::shared_ptr<orc::SymbolStringPool> SSP);
+
+/// jit-link the given object buffer, which must be a ELF systemz relocatable
+/// object file.
+void link_ELF_systemz(std::unique_ptr<LinkGraph> G,
+ std::unique_ptr<JITLinkContext> Ctx);
+
+} // end namespace jitlink
+} // end namespace llvm
+
+#endif // LLVM_EXECUTIONENGINE_JITLINK_ELF_SYSTEMZ_H
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h b/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h
new file mode 100644
index 0000000..dde3448
--- /dev/null
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/systemz.h
@@ -0,0 +1,924 @@
+//=== systemz.h - Generic JITLink systemz edge kinds, utilities -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Generic utilities for graphs representing systemz objects.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_EXECUTIONENGINE_JITLINK_SYSTEMZ_H
+#define LLVM_EXECUTIONENGINE_JITLINK_SYSTEMZ_H
+
+#include "TableManager.h"
+#include "llvm/ExecutionEngine/JITLink/JITLink.h"
+
+using namespace llvm::support::endian;
+
+namespace llvm {
+namespace jitlink {
+namespace systemz {
+
+/// Represents systemz fixups and other systemz-specific edge kinds.
+enum EdgeKind_systemz : Edge::Kind {
+
+ /// A plain 64-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint64
+ ///
+ Pointer64 = Edge::FirstRelocation,
+
+ /// A plain 32-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint32
+ ///
+ /// Errors:
+ /// - The target must reside in the low 32-bits of the address space,
+ /// otherwise an out-of-range error will be returned.
+ ///
+ Pointer32,
+
+ /// A plain 20-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint20
+ ///
+ /// Errors:
+ /// - The target must reside in the low 20-bits of the address space,
+ /// otherwise an out-of-range error will be returned.
+ ///
+ Pointer20,
+
+ /// A plain 16-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint16
+ ///
+ /// Errors:
+ /// - The target must reside in the low 16-bits of the address space,
+ /// otherwise an out-of-range error will be returned.
+ ///
+ Pointer16,
+
+ /// A plain 12-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint12
+ ///
+ /// Errors:
+ /// - The target must reside in the low 12-bits of the address space,
+ /// otherwise an out-of-range error will be returned.
+ ///
+ Pointer12,
+
+ /// A plain 8-bit pointer value relocation.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target + Addend : uint8
+ ///
+ /// Errors:
+ /// - The target must reside in the low 8-bits of the address space,
+ /// otherwise an out-of-range error will be returned.
+ ///
+ Pointer8,
+
+ /// A 64-bit delta.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - Fixup + Addend : int64
+ ///
+ Delta64,
+
+ /// A 32-bit delta.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - Fixup + Addend : int32
+ ///
+ /// Errors:
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta32,
+
+ /// A 16-bit delta.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - Fixup + Addend : int16
+ ///
+ /// Errors:
+ /// - The result of the fixup expression must fit into an int16, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta16,
+
+ /// A 32-bit delta shifted by 1.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int32
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int33, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ Delta32dbl,
+
+ /// A 24-bit delta shifted by 1.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int24
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int25, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ Delta24dbl,
+
+ /// A 16-bit delta shifted by 1.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int16
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int17, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ Delta16dbl,
+
+ /// A 12-bit delta shifted by 1.
+ ///
+ /// Delta from the fixup to the target.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int12
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int13, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ Delta12dbl,
+
+ /// A 64-bit negative delta.
+ ///
+ /// Delta from target back to the fixup.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Fixup - Target + Addend : int64
+ ///
+ NegDelta64,
+
+ /// A 32-bit negative delta.
+ ///
+ /// Delta from the target back to the fixup.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Fixup - Target + Addend : int32
+ ///
+ /// Errors:
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ NegDelta32,
+
+ /// A 32-bit Delta shifted by 1.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int32
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int33, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ DeltaPLT32dbl,
+
+ /// A 24-bit Delta shifted by 1.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int24
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int25, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ DeltaPLT24dbl,
+
+ /// A 16-bit Delta shifted by 1.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int16
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int17, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ DeltaPLT16dbl,
+
+ /// A 12-bit Delta shifted by 1.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (Target - Fixup + Addend) >> 1 : int12
+ ///
+ /// Errors:
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int13, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ DeltaPLT12dbl,
+
+ /// A 64-bit Delta.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - Fixup + Addend : int64
+ ///
+ DeltaPLT64,
+
+ /// A 32-bit Delta.
+ ///
+ /// Delta from the fixup to the PLT slot for the target. This will lead to
+ /// creation of a PLT stub.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - Fixup + Addend : int32
+ ///
+ /// Errors:
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ DeltaPLT32,
+
+ /// A 64-bit offset from GOT to PLT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int64
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ ///
+ Delta64PLTFromGOT,
+
+ /// A 32-bit offset from GOT to PLT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int32
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta32PLTFromGOT,
+
+ /// A 16-bit offset from GOT to PLT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int16
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int16, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta16PLTFromGOT,
+
+ /// A 64-bit offset from GOT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int64
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ ///
+ Delta64FromGOT,
+
+ /// A 32-bit offset from GOT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int32
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta32FromGOT,
+
+ /// A 16-bit offset from GOT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int16
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int16, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta16FromGOT,
+
+ /// A 20-bit offset from GOT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int20
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int16, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta20FromGOT,
+
+ /// A 12-bit offset from GOT.
+ ///
+ /// Fixup expression:
+ /// Fixup <- Target - GOTBase + Addend : int12
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int16, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta12FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta64FromGOT pointing
+ /// at the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta64FromGOT
+ /// targeting the GOT entry for the edge's current target, maintaining the
+ /// same addend. A GOT entry for the target should be created if one does
+ /// not already exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ ///
+ RequestGOTAndTransformToDelta64FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta32FromGOT pointing
+ /// at the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta32FromGOT
+ /// targeting the GOT entry for the edge's current target, maintaining the
+ /// same addend. A GOT entry for the target should be created if one does
+ /// not already exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ ///
+ RequestGOTAndTransformToDelta32FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta20FromGOT pointing
+ /// at the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta20FromGOT
+ /// targeting the GOT entry for the edge's current target, maintaining the
+ /// same addend. A GOT entry for the target should be created if one does
+ /// not already exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ ///
+ RequestGOTAndTransformToDelta20FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta16FromGOT pointing
+ /// at the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta16FromGOT
+ /// targeting the GOT entry for the edge's current target, maintaining the
+ /// same addend. A GOT entry for the target should be created if one does
+ /// not already exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ ///
+ RequestGOTAndTransformToDelta16FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta12FromGOT pointing
+ /// at the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta12FromGOT
+ /// targeting the GOT entry for the edge's current target, maintaining the
+ /// same addend. A GOT entry for the target should be created if one does
+ /// not already exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ /// phase will result in an assert/unreachable during the fixup phase.
+ ///
+ RequestGOTAndTransformToDelta12FromGOT,
+
+ /// A GOT entry getter/constructor, transformed to Delta32dbl pointing at
+ /// the GOT entry for the original target.
+ ///
+ /// Indicates that this edge should be transformed into a Delta32dbl targeting
+ /// the GOT entry for the edge's current target, maintaining the same addend.
+ /// A GOT entry for the target should be created if one does not already
+ /// exist.
+ ///
+ /// Edges of this kind are usually handled by a GOT builder pass inserted by
+ /// default.
+ ///
+ /// Fixup expression:
+ /// NONE
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
+ /// phase will result in an assert/unreachable during the fixup phase.
+ ///
+ RequestGOTAndTransformToDelta32dbl,
+
+ /// A 32-bit Delta to GOT base.
+ ///
+ /// Fixup expression:
+ /// Fixup <- GOTBase - Fixup + Addend : int32
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression must fit into an int32, otherwise
+ /// an out-of-range error will be returned.
+ ///
+ Delta32GOTBase,
+
+ /// A 32-bit Delta to GOT base shifted by 1.
+ ///
+ /// Fixup expression:
+ /// Fixup <- (GOTBase - Fixup + Addend) >> 1 : int32
+ ///
+ /// Errors:
+ /// - *ASSERTION* Failure to a null pointer GOTSymbol, which the GOT section
+ /// symbol was not been defined.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// fit into an int33, otherwise an out-of-range error will be returned.
+ /// - The result of the fixup expression before shifting right by 1 must
+ /// be multiple of 2, otherwise an alignment error will be returned.
+ ///
+ Delta32dblGOTBase,
+
+};
+
+/// Returns a string name for the given systemz edge. For debugging purposes
+/// only
+const char *getEdgeKindName(Edge::Kind K);
+
+/// Apply fixup expression for edge to block content.
+inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
+ const Symbol *GOTSymbol) {
+ using namespace support;
+
+ char *BlockWorkingMem = B.getAlreadyMutableContent().data();
+ char *FixupPtr = BlockWorkingMem + E.getOffset();
+ orc::ExecutorAddr FixupAddress = B.getAddress() + E.getOffset();
+ int64_t S = E.getTarget().getAddress().getValue();
+ int64_t A = E.getAddend();
+ int64_t P = FixupAddress.getValue();
+ int64_t GOTBase = GOTSymbol ? GOTSymbol->getAddress().getValue() : 0;
+ Edge::Kind K = E.getKind();
+
+ DEBUG_WITH_TYPE("jitlink", {
+ dbgs() << " Applying fixup on " << G.getEdgeKindName(K)
+ << " edge, (S, A, P, .GOT.) = (" << formatv("{0:x}", S) << ", "
+ << formatv("{0:x}", A) << ", " << formatv("{0:x}", P) << ", "
+ << formatv("{0:x}", GOTBase) << ")\n";
+ });
+
+ const auto isAlignmentCorrect = [](uint64_t Value, int N) {
+ return (Value & (N - 1)) ? false : true;
+ };
+
+ switch (K) {
+ case Pointer64: {
+ uint64_t Value = S + A;
+ write64be(FixupPtr, Value);
+ break;
+ }
+ case Pointer32: {
+ uint64_t Value = S + A;
+ if (!LLVM_UNLIKELY(isUInt<32>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, Value);
+ break;
+ }
+ case Pointer20: {
+ uint64_t Value = S + A;
+ if (!LLVM_UNLIKELY(isInt<20>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, (read32be(FixupPtr) & 0xF00000FF) |
+ ((Value & 0xFFF) << 16) | ((Value & 0xFF000) >> 4));
+ break;
+ }
+ case Pointer16: {
+ uint64_t Value = S + A;
+ if (!LLVM_UNLIKELY(isUInt<16>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write16be(FixupPtr, Value);
+ break;
+ }
+ case Pointer12: {
+ uint64_t Value = S + A;
+ if (!LLVM_UNLIKELY(isUInt<12>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write16be(FixupPtr, (read16be(FixupPtr) & 0xF000) | Value);
+ break;
+ }
+ case Pointer8: {
+ uint64_t Value = S + A;
+ if (!LLVM_UNLIKELY(isUInt<8>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ *(uint8_t *)FixupPtr = Value;
+ break;
+ }
+ case Delta64:
+ case DeltaPLT64: {
+ int64_t Value = S + A - P;
+ write64be(FixupPtr, Value);
+ break;
+ }
+ case Delta32:
+ case DeltaPLT32: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<32>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, Value);
+ break;
+ }
+ case Delta16: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<16>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write16be(FixupPtr, Value);
+ break;
+ }
+ case NegDelta32: {
+ int64_t Value = P + A - S;
+ if (!LLVM_UNLIKELY(isInt<32>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, Value);
+ break;
+ }
+ case Delta32dbl:
+ case DeltaPLT32dbl: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<33>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
+ return makeAlignmentError(FixupAddress, Value, 2, E);
+ write32be(FixupPtr, Value >> 1);
+ break;
+ }
+ case Delta24dbl:
+ case DeltaPLT24dbl: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<25>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
+ return makeAlignmentError(FixupAddress, Value, 2, E);
+ FixupPtr[0] = Value >> 17;
+ FixupPtr[1] = Value >> 9;
+ FixupPtr[2] = Value >> 1;
+ break;
+ }
+ case Delta16dbl:
+ case DeltaPLT16dbl: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<17>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
+ return makeAlignmentError(FixupAddress, Value, 2, E);
+ write16be(FixupPtr, Value >> 1);
+ break;
+ }
+ case Delta12dbl:
+ case DeltaPLT12dbl: {
+ int64_t Value = S + A - P;
+ if (!LLVM_UNLIKELY(isInt<13>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
+ return makeAlignmentError(FixupAddress, Value, 2, E);
+ write16be(FixupPtr,
+ (read16be(FixupPtr) & 0xF000) | ((Value >> 1) & 0x0FFF));
+ break;
+ }
+ case Delta32GOTBase: {
+ assert(GOTSymbol && "No GOT section symbol");
+ int64_t Value = GOTBase + A - P;
+ if (!LLVM_UNLIKELY(isInt<32>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, Value);
+ break;
+ }
+ case Delta32dblGOTBase: {
+ assert(GOTSymbol && "No GOT section symbol");
+ int64_t Value = GOTBase + A - P;
+ if (!LLVM_UNLIKELY(isInt<33>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
+ return makeAlignmentError(FixupAddress, Value, 2, E);
+ write32be(FixupPtr, Value >> 1);
+ break;
+ }
+ case Delta64PLTFromGOT:
+ case Delta64FromGOT: {
+ assert(GOTSymbol && "No GOT section symbol");
+ int64_t Value = S + A - GOTBase;
+ write64be(FixupPtr, Value);
+ break;
+ }
+ case Delta32PLTFromGOT:
+ case Delta32FromGOT: {
+ assert(GOTSymbol && "No GOT section symbol");
+ int64_t Value = S + A - GOTBase;
+ if (!LLVM_UNLIKELY(isInt<32>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, Value);
+ break;
+ }
+ case Delta16PLTFromGOT:
+ case Delta16FromGOT: {
+ assert(GOTSymbol && "No GOT section symbol");
+ int64_t Value = S + A - GOTBase;
+ if (!LLVM_UNLIKELY(isInt<16>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write16be(FixupPtr, Value);
+ break;
+ }
+ case Delta20FromGOT: {
+ assert(GOTSymbol && "No GOT section symbol");
+ uint64_t Value = S - GOTBase + A;
+ if (!LLVM_UNLIKELY(isInt<20>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write32be(FixupPtr, (read32be(FixupPtr) & 0xF00000FF) |
+ ((Value & 0xFFF) << 16) | ((Value & 0xFF000) >> 4));
+ break;
+ }
+ case Delta12FromGOT: {
+ assert(GOTSymbol && "No GOT section symbol");
+ uint64_t Value = S - GOTBase + A;
+ if (!LLVM_UNLIKELY(isUInt<12>(Value)))
+ return makeTargetOutOfRangeError(G, B, E);
+ write16be(FixupPtr, (read16be(FixupPtr) & 0xF000) | Value);
+ break;
+ }
+ default:
+ return make_error<JITLinkError>(
+ "In graph " + G.getName() + ", section " + B.getSection().getName() +
+ " unsupported edge kind " + getEdgeKindName(E.getKind()));
+ }
+
+ return Error::success();
+}
+
+/// SystemZ null pointer content.
+extern const char NullPointerContent[8];
+inline ArrayRef<char> getGOTEntryBlockContent(LinkGraph &G) {
+ return {reinterpret_cast<const char *>(NullPointerContent),
+ G.getPointerSize()};
+}
+
+/// SystemZ pointer jump stub content.
+///
+/// Contains the instruction sequence for an indirect jump via an in-memory
+/// pointer:
+/// lgrl %r1, ptr
+/// j %r1
+constexpr size_t StubEntrySize = 8;
+extern const char Pointer64JumpStubContent[StubEntrySize];
+inline ArrayRef<char> getStubBlockContent(LinkGraph &G) {
+ auto StubContent = Pointer64JumpStubContent;
+ return {reinterpret_cast<const char *>(StubContent), StubEntrySize};
+}
+
+/// Creates a new pointer block in the given section and returns an
+/// Anonymous symbol pointing to it.
+///
+/// If InitialTarget is given then an Pointer64 relocation will be added to the
+/// block pointing at InitialTarget.
+inline Symbol &createAnonymousPointer(LinkGraph &G, Section &PointerSection,
+ Symbol *InitialTarget = nullptr,
+ uint64_t InitialAddend = 0) {
+ auto &B = G.createContentBlock(PointerSection, getGOTEntryBlockContent(G),
+ orc::ExecutorAddr(), G.getPointerSize(), 0);
+ if (InitialTarget)
+ B.addEdge(Pointer64, 0, *InitialTarget, InitialAddend);
+ return G.addAnonymousSymbol(B, 0, G.getPointerSize(), false, false);
+}
+
+/// Create a jump stub block that jumps via the pointer at the given symbol.
+///
+/// The stub block will have the following default values:
+/// alignment: 16-bit
+/// alignment-offset: 0
+inline Block &createPointerJumpStubBlock(LinkGraph &G, Section &StubSection,
+ Symbol &PointerSymbol) {
+ auto &B = G.createContentBlock(StubSection, getStubBlockContent(G),
+ orc::ExecutorAddr(), 16, 0);
+ B.addEdge(Delta32dbl, 2, PointerSymbol, 2);
+ return B;
+}
+
+/// Create a jump stub that jumps via the pointer at the given symbol and
+/// an anonymous symbol pointing to it. Return the anonymous symbol.
+///
+/// The stub block will be created by createPointerJumpStubBlock.
+inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
+ Section &StubSection,
+ Symbol &PointerSymbol) {
+ return G.addAnonymousSymbol(
+ createPointerJumpStubBlock(G, StubSection, PointerSymbol), 0,
+ StubEntrySize, true, false);
+}
+
+/// Global Offset Table Builder.
+class GOTTableManager : public TableManager<GOTTableManager> {
+public:
+ static StringRef getSectionName() { return "$__GOT"; }
+
+ bool visitEdge(LinkGraph &G, Block *B, Edge &E) {
+ if (E.getTarget().isDefined())
+ return false;
+ Edge::Kind KindToSet = Edge::Invalid;
+ switch (E.getKind()) {
+ case systemz::RequestGOTAndTransformToDelta12FromGOT:
+ KindToSet = systemz::Delta12FromGOT;
+ break;
+ case systemz::RequestGOTAndTransformToDelta16FromGOT:
+ KindToSet = systemz::Delta16FromGOT;
+ break;
+ case systemz::RequestGOTAndTransformToDelta20FromGOT:
+ KindToSet = systemz::Delta20FromGOT;
+ break;
+ case systemz::RequestGOTAndTransformToDelta32FromGOT:
+ KindToSet = systemz::Delta32FromGOT;
+ break;
+ case systemz::RequestGOTAndTransformToDelta64FromGOT:
+ KindToSet = systemz::Delta64FromGOT;
+ break;
+ case systemz::RequestGOTAndTransformToDelta32dbl:
+ KindToSet = systemz::DeltaPLT32dbl;
+ break;
+ default:
+ return false;
+ }
+ assert(KindToSet != Edge::Invalid &&
+ "Fell through switch, but no new kind to set");
+ DEBUG_WITH_TYPE("jitlink", {
+ dbgs() << " Fixing " << G.getEdgeKindName(E.getKind()) << " edge at "
+ << B->getFixupAddress(E) << " (" << B->getAddress() << " + "
+ << formatv("{0:x}", E.getOffset()) << ")\n";
+ });
+ E.setKind(KindToSet);
+ E.setTarget(getEntryForTarget(G, E.getTarget()));
+ return true;
+ }
+
+ Symbol &createEntry(LinkGraph &G, Symbol &Target) {
+ return createAnonymousPointer(G, getGOTSection(G), &Target);
+ }
+
+private:
+ Section &getGOTSection(LinkGraph &G) {
+ if (!GOTSection)
+ GOTSection = &G.createSection(getSectionName(),
+ orc::MemProt::Read | orc::MemProt::Exec);
+ return *GOTSection;
+ }
+
+ Section *GOTSection = nullptr;
+};
+
+/// Procedure Linkage Table Builder.
+class PLTTableManager : public TableManager<PLTTableManager> {
+public:
+ PLTTableManager(GOTTableManager &GOT) : GOT(GOT) {}
+
+ static StringRef getSectionName() { return "$__STUBS"; }
+
+ bool visitEdge(LinkGraph &G, Block *B, Edge &E) {
+ if (E.getTarget().isDefined())
+ return false;
+
+ switch (E.getKind()) {
+ case systemz::DeltaPLT32:
+ case systemz::DeltaPLT64:
+ case systemz::DeltaPLT12dbl:
+ case systemz::DeltaPLT16dbl:
+ case systemz::DeltaPLT24dbl:
+ case systemz::DeltaPLT32dbl:
+ case systemz::Delta16PLTFromGOT:
+ case systemz::Delta32PLTFromGOT:
+ case systemz::Delta64PLTFromGOT:
+ break;
+ default:
+ return false;
+ }
+ DEBUG_WITH_TYPE("jitlink", {
+ dbgs() << " Fixing " << G.getEdgeKindName(E.getKind()) << " edge at "
+ << B->getFixupAddress(E) << " (" << B->getAddress() << " + "
+ << formatv("{0:x}", E.getOffset()) << ")\n";
+ });
+ E.setTarget(getEntryForTarget(G, E.getTarget()));
+ return true;
+ }
+
+ Symbol &createEntry(LinkGraph &G, Symbol &Target) {
+ return createAnonymousPointerJumpStub(G, getStubsSection(G),
+ GOT.getEntryForTarget(G, Target));
+ }
+
+public:
+ Section &getStubsSection(LinkGraph &G) {
+ if (!StubsSection)
+ StubsSection = &G.createSection(getSectionName(),
+ orc::MemProt::Read | orc::MemProt::Exec);
+ return *StubsSection;
+ }
+
+ GOTTableManager &GOT;
+ Section *StubsSection = nullptr;
+};
+
+} // namespace systemz
+} // namespace jitlink
+} // namespace llvm
+
+#endif // LLVM_EXECUTIONENGINE_JITLINK_SYSTEMZ_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
index fc01afc..01e9cf9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
@@ -43,7 +43,6 @@
#include <algorithm>
#include <cassert>
#include <functional>
-#include <iterator>
#include <memory>
#include <utility>
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h
index 5170893..81c6a0b 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h
@@ -12,7 +12,6 @@
#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h"
#include <cmath>
-#include <type_traits>
#include <vector>
namespace llvm {
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
index ef0fed4..e605861 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
@@ -20,7 +20,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <mutex>
-#include <type_traits>
#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
index 12dfb6c..67ebafc 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ClauseT.h
@@ -241,7 +241,7 @@ ENUM(MotionExpectation, Present);
// V5.2: [15.9.1] `task-dependence-type` modifier
ENUM(DependenceType, Depobj, In, Inout, Inoutset, Mutexinoutset, Out, Sink,
Source);
-ENUM(Prescriptiveness, Strict, Fallback);
+ENUM(Prescriptiveness, Strict);
template <typename I, typename E> //
struct LoopIterationT {
@@ -591,10 +591,10 @@ struct DynamicAllocatorsT {
template <typename T, typename I, typename E> //
struct DynGroupprivateT {
ENUM(AccessGroup, Cgroup);
- using Prescriptiveness = type::Prescriptiveness;
+ ENUM(Fallback, Abort, Default_Mem, Null);
using Size = E;
using TupleTrait = std::true_type;
- std::tuple<OPT(AccessGroup), OPT(Prescriptiveness), Size> t;
+ std::tuple<OPT(AccessGroup), OPT(Fallback), Size> t;
};
// V5.2: [5.8.4] `enter` clause
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 6d6eb5cd..d702273 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -207,40 +207,40 @@ private:
template <typename Clause>
bool applyClause(Clause &&clause, const ClauseTy *node);
+ bool applyClause(const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *);
bool applyClause(const tomp::clause::CollapseT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::PrivateT<TypeTy, IdTy, ExprTy> &clause,
+ bool applyClause(const tomp::clause::DefaultT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
bool
applyClause(const tomp::clause::FirstprivateT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
+ bool applyClause(const tomp::clause::IfT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *);
bool
applyClause(const tomp::clause::LastprivateT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::SharedT<TypeTy, IdTy, ExprTy> &clause,
+ bool applyClause(const tomp::clause::LinearT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::DefaultT<TypeTy, IdTy, ExprTy> &clause,
+ bool applyClause(const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
bool
- applyClause(const tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy> &clause,
+ applyClause(const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
+ bool applyClause(const tomp::clause::OmpxBareT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *);
bool applyClause(const tomp::clause::OrderT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
+ bool applyClause(const tomp::clause::PrivateT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
bool applyClause(const tomp::clause::ReductionT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::IfT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *);
- bool applyClause(const tomp::clause::LinearT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *);
- bool applyClause(const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
+ bool applyClause(const tomp::clause::SharedT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
bool
- applyClause(const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
+ applyClause(const tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *);
- bool applyClause(const tomp::clause::OmpxBareT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *);
uint32_t version;
llvm::omp::Directive construct;
@@ -458,6 +458,34 @@ bool ConstructDecompositionT<C, H>::applyClause(Specific &&specific,
return false;
}
+// --- Specific clauses -----------------------------------------------
+
+// ALLOCATE
+// [5.2:178:7-9]
+// Directives: allocators, distribute, do, for, parallel, scope, sections,
+// single, target, task, taskgroup, taskloop, teams
+//
+// [5.2:340:33-35]
+// (33) The effect of the allocate clause is as if it is applied to all leaf
+// constructs that permit the clause and to which a data-sharing attribute
+// clause that may create a private copy of the same list item is applied.
+template <typename C, typename H>
+bool ConstructDecompositionT<C, H>::applyClause(
+ const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *node) {
+ // This one needs to be applied at the end, once we know which clauses are
+ // assigned to which leaf constructs.
+
+ // [5.2:340:33]
+ bool applied = applyIf(node, [&](const auto &leaf) {
+ return llvm::any_of(leaf.clauses, [&](const ClauseTy *n) {
+ return llvm::omp::isPrivatizingClause(n->id);
+ });
+ });
+
+ return applied;
+}
+
// COLLAPSE
// [5.2:93:20-21]
// Directives: distribute, do, for, loop, simd, taskloop
@@ -483,19 +511,19 @@ bool ConstructDecompositionT<C, H>::applyClause(
return false;
}
-// PRIVATE
-// [5.2:111:5-7]
-// Directives: distribute, do, for, loop, parallel, scope, sections, simd,
-// single, target, task, taskloop, teams
+// DEFAULT
+// [5.2:109:5-6]
+// Directives: parallel, task, taskloop, teams
//
-// [5.2:340:1-2]
-// (1) The effect of the 1 private clause is as if it is applied only to the
-// innermost leaf construct that permits it.
+// [5.2:340:31-32]
+// (31) The effect of the shared, default, thread_limit, or order clause is as
+// if it is applied to all leaf constructs that permit the clause.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::PrivateT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::DefaultT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- return applyToInnermost(node);
+ // [5.2:340:31]
+ return applyToAll(node);
}
// FIRSTPRIVATE
@@ -626,6 +654,44 @@ bool ConstructDecompositionT<C, H>::applyClause(
return applied;
}
+// IF
+// [5.2:72:7-9]
+// Directives: cancel, parallel, simd, target, target data, target enter data,
+// target exit data, target update, task, taskloop
+//
+// [5.2:72:15-18]
+// (15) For combined or composite constructs, the if clause only applies to the
+// semantics of the construct named in the directive-name-modifier.
+// (16) For a combined or composite construct, if no directive-name-modifier is
+// specified then the if clause applies to all constituent constructs to which
+// an if clause can apply.
+template <typename C, typename H>
+bool ConstructDecompositionT<C, H>::applyClause(
+ const tomp::clause::IfT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *node) {
+ using DirectiveNameModifier =
+ typename clause::IfT<TypeTy, IdTy, ExprTy>::DirectiveNameModifier;
+ using IfExpression = typename clause::IfT<TypeTy, IdTy, ExprTy>::IfExpression;
+ auto &modifier = std::get<std::optional<DirectiveNameModifier>>(clause.t);
+
+ if (modifier) {
+ llvm::omp::Directive dirId = *modifier;
+ auto *unmodified =
+ makeClause(llvm::omp::Clause::OMPC_if,
+ tomp::clause::IfT<TypeTy, IdTy, ExprTy>{
+ {/*DirectiveNameModifier=*/std::nullopt,
+ /*IfExpression=*/std::get<IfExpression>(clause.t)}});
+
+ if (auto *hasDir = findDirective(dirId)) {
+ hasDir->clauses.push_back(unmodified);
+ return true;
+ }
+ return false;
+ }
+
+ return applyToAll(node);
+}
+
// LASTPRIVATE
// [5.2:115:7-8]
// Directives: distribute, do, for, loop, sections, simd, taskloop
@@ -720,51 +786,94 @@ bool ConstructDecompositionT<C, H>::applyClause(
return applied;
}
-// SHARED
-// [5.2:110:5-6]
-// Directives: parallel, task, taskloop, teams
+// LINEAR
+// [5.2:118:1-2]
+// Directives: declare simd, do, for, simd
//
-// [5.2:340:31-32]
-// (31) The effect of the shared, default, thread_limit, or order clause is as
-// if it is applied to all leaf constructs that permit the clause.
+// [5.2:341:15-22]
+// (15.1) The effect of the linear clause is as if it is applied to the
+// innermost leaf construct.
+// (15.2) Additionally, if the list item is not the iteration variable of a simd
+// or worksharing-loop SIMD construct, the effect on the outer leaf constructs
+// is as if the list item was specified in firstprivate and lastprivate clauses
+// on the combined or composite construct, with the rules specified above
+// applied.
+// (19) If a list item of the linear clause is the iteration variable of a simd
+// or worksharing-loop SIMD construct and it is not declared in the construct,
+// the effect on the outer leaf constructs is as if the list item was specified
+// in a lastprivate clause on the combined or composite construct with the rules
+// specified above applied.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::SharedT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::LinearT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- // [5.2:340:31]
- return applyToAll(node);
+ // [5.2:341:15.1]
+ if (!applyToInnermost(node))
+ return false;
+
+ // [5.2:341:15.2], [5.2:341:19]
+ auto dirSimd = findDirective(llvm::omp::Directive::OMPD_simd);
+ std::optional<ObjectTy> iterVar = helper.getLoopIterVar();
+ const auto &objects = std::get<tomp::ObjectListT<IdTy, ExprTy>>(clause.t);
+
+ // Lists of objects that will be used to construct "firstprivate" and
+ // "lastprivate" clauses.
+ tomp::ObjectListT<IdTy, ExprTy> first, last;
+
+ for (const ObjectTy &object : objects) {
+ last.push_back(object);
+ if (!dirSimd || !iterVar || object.id() != iterVar->id())
+ first.push_back(object);
+ }
+
+ if (!first.empty()) {
+ auto *firstp = makeClause(
+ llvm::omp::Clause::OMPC_firstprivate,
+ tomp::clause::FirstprivateT<TypeTy, IdTy, ExprTy>{/*List=*/first});
+ nodes.push_back(firstp); // Appending to the main clause list.
+ }
+ if (!last.empty()) {
+ auto *lastp =
+ makeClause(llvm::omp::Clause::OMPC_lastprivate,
+ tomp::clause::LastprivateT<TypeTy, IdTy, ExprTy>{
+ {/*LastprivateModifier=*/std::nullopt, /*List=*/last}});
+ nodes.push_back(lastp); // Appending to the main clause list.
+ }
+ return true;
}
-// DEFAULT
-// [5.2:109:5-6]
-// Directives: parallel, task, taskloop, teams
+// NOWAIT
+// [5.2:308:11-13]
+// Directives: dispatch, do, for, interop, scope, sections, single, target,
+// target enter data, target exit data, target update, taskwait, workshare
//
-// [5.2:340:31-32]
-// (31) The effect of the shared, default, thread_limit, or order clause is as
-// if it is applied to all leaf constructs that permit the clause.
+// [5.2:341:23]
+// (23) The effect of the nowait clause is as if it is applied to the outermost
+// leaf construct that permits it.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::DefaultT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- // [5.2:340:31]
- return applyToAll(node);
+ return applyToOutermost(node);
}
-// THREAD_LIMIT
-// [5.2:277:14-15]
-// Directives: target, teams
-//
-// [5.2:340:31-32]
-// (31) The effect of the shared, default, thread_limit, or order clause is as
-// if it is applied to all leaf constructs that permit the clause.
+// OMPX_ATTRIBUTE
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- // [5.2:340:31]
+ // ERROR: no leaf that allows clause
return applyToAll(node);
}
+// OMPX_BARE
+template <typename C, typename H>
+bool ConstructDecompositionT<C, H>::applyClause(
+ const tomp::clause::OmpxBareT<TypeTy, IdTy, ExprTy> &clause,
+ const ClauseTy *node) {
+ return applyToOutermost(node);
+}
+
// ORDER
// [5.2:234:3-4]
// Directives: distribute, do, for, loop, simd
@@ -780,30 +889,19 @@ bool ConstructDecompositionT<C, H>::applyClause(
return applyToAll(node);
}
-// ALLOCATE
-// [5.2:178:7-9]
-// Directives: allocators, distribute, do, for, parallel, scope, sections,
-// single, target, task, taskgroup, taskloop, teams
+// PRIVATE
+// [5.2:111:5-7]
+// Directives: distribute, do, for, loop, parallel, scope, sections, simd,
+// single, target, task, taskloop, teams
//
-// [5.2:340:33-35]
-// (33) The effect of the allocate clause is as if it is applied to all leaf
-// constructs that permit the clause and to which a data-sharing attribute
-// clause that may create a private copy of the same list item is applied.
+// [5.2:340:1-2]
+// (1) The effect of the 1 private clause is as if it is applied only to the
+// innermost leaf construct that permits it.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::PrivateT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- // This one needs to be applied at the end, once we know which clauses are
- // assigned to which leaf constructs.
-
- // [5.2:340:33]
- bool applied = applyIf(node, [&](const auto &leaf) {
- return llvm::any_of(leaf.clauses, [&](const ClauseTy *n) {
- return llvm::omp::isPrivatizingClause(n->id);
- });
- });
-
- return applied;
+ return applyToInnermost(node);
}
// REDUCTION
@@ -983,129 +1081,38 @@ bool ConstructDecompositionT<C, H>::applyClause(
return applied;
}
-// IF
-// [5.2:72:7-9]
-// Directives: cancel, parallel, simd, target, target data, target enter data,
-// target exit data, target update, task, taskloop
+// SHARED
+// [5.2:110:5-6]
+// Directives: parallel, task, taskloop, teams
//
-// [5.2:72:15-18]
-// (15) For combined or composite constructs, the if clause only applies to the
-// semantics of the construct named in the directive-name-modifier.
-// (16) For a combined or composite construct, if no directive-name-modifier is
-// specified then the if clause applies to all constituent constructs to which
-// an if clause can apply.
+// [5.2:340:31-32]
+// (31) The effect of the shared, default, thread_limit, or order clause is as
+// if it is applied to all leaf constructs that permit the clause.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::IfT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::SharedT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
- using DirectiveNameModifier =
- typename clause::IfT<TypeTy, IdTy, ExprTy>::DirectiveNameModifier;
- using IfExpression = typename clause::IfT<TypeTy, IdTy, ExprTy>::IfExpression;
- auto &modifier = std::get<std::optional<DirectiveNameModifier>>(clause.t);
-
- if (modifier) {
- llvm::omp::Directive dirId = *modifier;
- auto *unmodified =
- makeClause(llvm::omp::Clause::OMPC_if,
- tomp::clause::IfT<TypeTy, IdTy, ExprTy>{
- {/*DirectiveNameModifier=*/std::nullopt,
- /*IfExpression=*/std::get<IfExpression>(clause.t)}});
-
- if (auto *hasDir = findDirective(dirId)) {
- hasDir->clauses.push_back(unmodified);
- return true;
- }
- return false;
- }
-
+ // [5.2:340:31]
return applyToAll(node);
}
-// LINEAR
-// [5.2:118:1-2]
-// Directives: declare simd, do, for, simd
-//
-// [5.2:341:15-22]
-// (15.1) The effect of the linear clause is as if it is applied to the
-// innermost leaf construct.
-// (15.2) Additionally, if the list item is not the iteration variable of a simd
-// or worksharing-loop SIMD construct, the effect on the outer leaf constructs
-// is as if the list item was specified in firstprivate and lastprivate clauses
-// on the combined or composite construct, with the rules specified above
-// applied.
-// (19) If a list item of the linear clause is the iteration variable of a simd
-// or worksharing-loop SIMD construct and it is not declared in the construct,
-// the effect on the outer leaf constructs is as if the list item was specified
-// in a lastprivate clause on the combined or composite construct with the rules
-// specified above applied.
-template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::LinearT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *node) {
- // [5.2:341:15.1]
- if (!applyToInnermost(node))
- return false;
-
- // [5.2:341:15.2], [5.2:341:19]
- auto dirSimd = findDirective(llvm::omp::Directive::OMPD_simd);
- std::optional<ObjectTy> iterVar = helper.getLoopIterVar();
- const auto &objects = std::get<tomp::ObjectListT<IdTy, ExprTy>>(clause.t);
-
- // Lists of objects that will be used to construct "firstprivate" and
- // "lastprivate" clauses.
- tomp::ObjectListT<IdTy, ExprTy> first, last;
-
- for (const ObjectTy &object : objects) {
- last.push_back(object);
- if (!dirSimd || !iterVar || object.id() != iterVar->id())
- first.push_back(object);
- }
-
- if (!first.empty()) {
- auto *firstp = makeClause(
- llvm::omp::Clause::OMPC_firstprivate,
- tomp::clause::FirstprivateT<TypeTy, IdTy, ExprTy>{/*List=*/first});
- nodes.push_back(firstp); // Appending to the main clause list.
- }
- if (!last.empty()) {
- auto *lastp =
- makeClause(llvm::omp::Clause::OMPC_lastprivate,
- tomp::clause::LastprivateT<TypeTy, IdTy, ExprTy>{
- {/*LastprivateModifier=*/std::nullopt, /*List=*/last}});
- nodes.push_back(lastp); // Appending to the main clause list.
- }
- return true;
-}
-
-// NOWAIT
-// [5.2:308:11-13]
-// Directives: dispatch, do, for, interop, scope, sections, single, target,
-// target enter data, target exit data, target update, taskwait, workshare
+// THREAD_LIMIT
+// [5.2:277:14-15]
+// Directives: target, teams
//
-// [5.2:341:23]
-// (23) The effect of the nowait clause is as if it is applied to the outermost
-// leaf construct that permits it.
-template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *node) {
- return applyToOutermost(node);
-}
-
-template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::OmpxBareT<TypeTy, IdTy, ExprTy> &clause,
- const ClauseTy *node) {
- return applyToOutermost(node);
-}
-
+// [5.2:340:31-32]
+// (31) The effect of the shared, default, thread_limit, or order clause is as
+// if it is applied to all leaf constructs that permit the clause.
template <typename C, typename H>
bool ConstructDecompositionT<C, H>::applyClause(
- const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
+ const tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy> &clause,
const ClauseTy *node) {
+ // [5.2:340:31]
return applyToAll(node);
}
+// --- Splitting ------------------------------------------------------
+
template <typename C, typename H> bool ConstructDecompositionT<C, H>::split() {
bool success = true;
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index 1c86d18..8f6fb4d 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -28,7 +28,6 @@
#include "llvm/Support/TypeSize.h"
#include <cstdint>
#include <functional>
-#include <iterator>
#include <optional>
#include <string>
#include <utility>
diff --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h
index 33eda5a..c25e289 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -55,7 +55,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/Compiler.h"
-#include <type_traits>
#include <vector>
namespace llvm {
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index acb17a8..4354551 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -47,7 +47,6 @@
#include "llvm/Support/TypeName.h"
#include <cassert>
#include <cstring>
-#include <iterator>
#include <list>
#include <memory>
#include <tuple>
diff --git a/llvm/include/llvm/MC/MCParser/AsmLexer.h b/llvm/include/llvm/MC/MCParser/AsmLexer.h
index 11d32fb..c514b76 100644
--- a/llvm/include/llvm/MC/MCParser/AsmLexer.h
+++ b/llvm/include/llvm/MC/MCParser/AsmLexer.h
@@ -21,7 +21,6 @@
#include <cassert>
#include <cstddef>
#include <string>
-#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index bd7cd39..03777c7 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -128,7 +128,6 @@
#include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
#include "llvm/Transforms/Utils/LowerInvoke.h"
#include <cassert>
-#include <type_traits>
#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/ProfileData/HashKeyMap.h b/llvm/include/llvm/ProfileData/HashKeyMap.h
index b2f1bf2..fceb951 100644
--- a/llvm/include/llvm/ProfileData/HashKeyMap.h
+++ b/llvm/include/llvm/ProfileData/HashKeyMap.h
@@ -16,7 +16,6 @@
#define LLVM_PROFILEDATA_HASHKEYMAP_H
#include "llvm/ADT/Hashing.h"
-#include <iterator>
#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/Support/CFGDiff.h b/llvm/include/llvm/Support/CFGDiff.h
index 41004d7..88f4fe5 100644
--- a/llvm/include/llvm/Support/CFGDiff.h
+++ b/llvm/include/llvm/Support/CFGDiff.h
@@ -21,7 +21,6 @@
#include "llvm/Support/type_traits.h"
#include <cassert>
#include <cstddef>
-#include <iterator>
// Two booleans are used to define orders in graphs:
// InverseGraph defines when we need to reverse the whole graph and is as such
diff --git a/llvm/include/llvm/Support/CodeGen.h b/llvm/include/llvm/Support/CodeGen.h
index cd1f916..15df265 100644
--- a/llvm/include/llvm/Support/CodeGen.h
+++ b/llvm/include/llvm/Support/CodeGen.h
@@ -115,7 +115,13 @@ namespace llvm {
};
// Specify what functions should keep the frame pointer.
- enum class FramePointerKind { None, NonLeaf, All, Reserved };
+ enum class FramePointerKind {
+ None,
+ NonLeaf,
+ All,
+ Reserved,
+ NonLeafNoReserve
+ };
// Specify what type of zeroing callee-used registers.
namespace ZeroCallUsedRegs {
diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h
index af542ba..b6aae9f 100644
--- a/llvm/include/llvm/Support/GenericDomTree.h
+++ b/llvm/include/llvm/Support/GenericDomTree.h
@@ -35,7 +35,6 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
-#include <iterator>
#include <memory>
#include <type_traits>
#include <utility>
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index dee4db5..5a012cf 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -12,19 +12,11 @@
#ifndef LLVM_SUPPORT_SPECIALCASELIST_H
#define LLVM_SUPPORT_SPECIALCASELIST_H
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/RadixTree.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Allocator.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/GlobPattern.h"
-#include "llvm/Support/Regex.h"
+#include "llvm/Support/Error.h"
#include <memory>
#include <string>
#include <utility>
-#include <variant>
#include <vector>
namespace llvm {
@@ -125,91 +117,19 @@ protected:
SpecialCaseList(SpecialCaseList const &) = delete;
SpecialCaseList &operator=(SpecialCaseList const &) = delete;
-private:
- using Match = std::pair<StringRef, unsigned>;
- static constexpr Match NotMatched = {"", 0};
-
- // Lagacy v1 matcher.
- class RegexMatcher {
- public:
- LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber);
- LLVM_ABI void preprocess(bool BySize);
-
- LLVM_ABI Match match(StringRef Query) const;
-
- struct Reg {
- Reg(StringRef Name, unsigned LineNo, Regex &&Rg)
- : Name(Name), LineNo(LineNo), Rg(std::move(Rg)) {}
- StringRef Name;
- unsigned LineNo;
- Regex Rg;
- };
-
- std::vector<Reg> RegExes;
- };
-
- class GlobMatcher {
- public:
- LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber);
- LLVM_ABI void preprocess(bool BySize);
-
- LLVM_ABI Match match(StringRef Query) const;
-
- struct Glob {
- Glob(StringRef Name, unsigned LineNo, GlobPattern &&Pattern)
- : Name(Name), LineNo(LineNo), Pattern(std::move(Pattern)) {}
- StringRef Name;
- unsigned LineNo;
- GlobPattern Pattern;
- };
-
- std::vector<GlobMatcher::Glob> Globs;
-
- RadixTree<iterator_range<StringRef::const_iterator>,
- RadixTree<iterator_range<StringRef::const_reverse_iterator>,
- SmallVector<int, 1>>>
- PrefixSuffixToGlob;
-
- RadixTree<iterator_range<StringRef::const_iterator>, SmallVector<int, 1>>
- SubstrToGlob;
- };
-
- /// Represents a set of patterns and their line numbers
- class Matcher {
- public:
- LLVM_ABI Matcher(bool UseGlobs, bool RemoveDotSlash);
-
- LLVM_ABI Error insert(StringRef Pattern, unsigned LineNumber);
- LLVM_ABI void preprocess(bool BySize);
-
- LLVM_ABI Match match(StringRef Query) const;
-
- LLVM_ABI bool matchAny(StringRef Query) const {
- return match(Query) != NotMatched;
- }
-
- std::variant<RegexMatcher, GlobMatcher> M;
- bool RemoveDotSlash;
- };
-
- using SectionEntries = StringMap<StringMap<Matcher>>;
-
-protected:
class Section {
public:
- Section(StringRef Str, unsigned FileIdx, bool UseGlobs)
- : SectionMatcher(UseGlobs, /*RemoveDotSlash=*/false), SectionStr(Str),
- FileIdx(FileIdx) {}
-
- Section(Section &&) = default;
+ LLVM_ABI Section(StringRef Name, unsigned FileIdx, bool UseGlobs);
+ LLVM_ABI Section(Section &&);
+ LLVM_ABI ~Section();
- // Return name of the section, its entire string in [].
- StringRef name() const { return SectionStr; }
+ // Returns name of the section, its entire string in [].
+ StringRef name() const { return Name; }
// Returns true if string 'Name' matches section name interpreted as a glob.
LLVM_ABI bool matchName(StringRef Name) const;
- // Return sequence number of the file where this section is defined.
+ // Returns sequence number of the file where this section is defined.
unsigned fileIndex() const { return FileIdx; }
// Helper method to search by Prefix, Query, and Category. Returns
@@ -227,14 +147,11 @@ protected:
private:
friend class SpecialCaseList;
- LLVM_ABI void preprocess(bool OrderBySize);
- LLVM_ABI const SpecialCaseList::Matcher *
- findMatcher(StringRef Prefix, StringRef Category) const;
+ class SectionImpl;
- Matcher SectionMatcher;
- std::string SectionStr;
- SectionEntries Entries;
+ StringRef Name;
unsigned FileIdx;
+ std::unique_ptr<SectionImpl> Impl;
};
ArrayRef<const Section> sections() const { return Sections; }
diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
index a96125c..d037132 100644
--- a/llvm/include/llvm/Support/type_traits.h
+++ b/llvm/include/llvm/Support/type_traits.h
@@ -15,7 +15,6 @@
#include "llvm/Support/Compiler.h"
#include <type_traits>
-#include <utility>
namespace llvm {
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 0e82dd2..11b76cd 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -554,15 +554,29 @@ public:
return getOSVersion() < VersionTuple(Major, Minor, Micro);
}
+ bool isOSVersionGE(unsigned Major, unsigned Minor = 0,
+ unsigned Micro = 0) const {
+ return !isOSVersionLT(Major, Minor, Micro);
+ }
+
bool isOSVersionLT(const Triple &Other) const {
return getOSVersion() < Other.getOSVersion();
}
+ bool isOSVersionGE(const Triple &Other) const {
+ return getOSVersion() >= Other.getOSVersion();
+ }
+
/// Comparison function for checking OS X version compatibility, which handles
/// supporting skewed version numbering schemes used by the "darwin" triples.
LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
unsigned Micro = 0) const;
+ bool isMacOSXVersionGE(unsigned Major, unsigned Minor = 0,
+ unsigned Micro = 0) const {
+ return !isMacOSXVersionLT(Major, Minor, Micro);
+ }
+
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
/// and "osx" as OS X triples.
bool isMacOSX() const {
diff --git a/llvm/include/llvm/Telemetry/Telemetry.h b/llvm/include/llvm/Telemetry/Telemetry.h
index b20c7e2..9b607f1 100644
--- a/llvm/include/llvm/Telemetry/Telemetry.h
+++ b/llvm/include/llvm/Telemetry/Telemetry.h
@@ -22,7 +22,6 @@
#include <memory>
#include <optional>
#include <string>
-#include <type_traits>
#include <vector>
namespace llvm {
diff --git a/llvm/include/llvm/XRay/YAMLXRayRecord.h b/llvm/include/llvm/XRay/YAMLXRayRecord.h
index 6bf4f1d..8de5698 100644
--- a/llvm/include/llvm/XRay/YAMLXRayRecord.h
+++ b/llvm/include/llvm/XRay/YAMLXRayRecord.h
@@ -12,8 +12,6 @@
#ifndef LLVM_XRAY_YAMLXRAYRECORD_H
#define LLVM_XRAY_YAMLXRAYRECORD_H
-#include <type_traits>
-
#include "llvm/Support/YAMLTraits.h"
#include "llvm/XRay/XRayRecord.h"