13#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
14#define LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
46 constexpr Tag(uintptr_t TagValue, uintptr_t TagOffset)
47 : TagMask(TagValue << TagOffset) {}
50 return reinterpret_cast<T *
>(
reinterpret_cast<uintptr_t
>(
P) | TagMask);
61 constexpr Untag(uintptr_t TagLen, uintptr_t TagOffset)
62 : UntagMask(~(((uintptr_t(1) << TagLen) - 1) << TagOffset)) {}
65 return reinterpret_cast<T *
>(
reinterpret_cast<uintptr_t
>(
P) & UntagMask);
79 template <
typename T,
typename UnwrapFn = defaultUnwrap<T>>
82 static_cast<uint64_t>(
reinterpret_cast<uintptr_t
>(Unwrap(
Ptr))));
87 template <
typename T,
typename WrapFn = defaultWrap<std::remove_po
inter_t<T>>>
88 std::enable_if_t<std::is_pointer<T>::value,
T>
89 toPtr(WrapFn &&Wrap = WrapFn())
const {
90 uintptr_t IntPtr =
static_cast<uintptr_t
>(Addr);
91 assert(IntPtr == Addr &&
"ExecutorAddr value out of range for uintptr_t");
92 return Wrap(
reinterpret_cast<T>(IntPtr));
97 template <
typename T,
typename WrapFn = defaultWrap<T>>
98 std::enable_if_t<std::is_function<T>::value,
T *>
99 toPtr(WrapFn &&Wrap = WrapFn())
const {
100 uintptr_t IntPtr =
static_cast<uintptr_t
>(Addr);
101 assert(IntPtr == Addr &&
"ExecutorAddr value out of range for uintptr_t");
102 return Wrap(
reinterpret_cast<T *
>(IntPtr));
107 bool isNull()
const {
return Addr == 0; }
109 explicit operator bool()
const {
return Addr != 0; }
112 return LHS.Addr ==
RHS.Addr;
116 return LHS.Addr !=
RHS.Addr;
120 return LHS.Addr <
RHS.Addr;
124 return LHS.Addr <=
RHS.Addr;
128 return LHS.Addr >
RHS.Addr;
132 return LHS.Addr >=
RHS.Addr;
211 return LHS.Start <
RHS.Start ||
216 return LHS.Start <
RHS.Start ||
221 return LHS.Start >
RHS.Start ||
226 return LHS.Start >
RHS.Start ||
244 return OS <<
formatv(
"{0:x} -- {1:x}", R.Start.getValue(), R.End.getValue());
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines DenseMapInfo traits for DenseMap.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Merges a tag into the raw address value: P' = P | (TagValue << TagOffset).
constexpr Tag(uintptr_t TagValue, uintptr_t TagOffset)
constexpr T * operator()(T *P)
Strips a tag of the given length from the given offset within the pointer: P' = P & ~(((1 << TagLen) ...
constexpr Untag(uintptr_t TagLen, uintptr_t TagOffset)
constexpr T * operator()(T *P)
Represents an address in the executor process.
ExecutorAddr & operator++()
friend bool operator==(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr operator--(int)
ExecutorAddr & operator-=(const ExecutorAddrDiff &Delta)
uint64_t getValue() const
void setValue(uint64_t Addr)
std::enable_if_t< std::is_function< T >::value, T * > toPtr(WrapFn &&Wrap=WrapFn()) const
Cast this ExecutorAddr to a pointer of the given function type.
ExecutorAddr operator++(int)
friend bool operator>(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap=UnwrapFn())
Create an ExecutorAddr from the given pointer.
friend bool operator>=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr & operator--()
constexpr ExecutorAddr(uint64_t Addr)
Create an ExecutorAddr from the given value.
friend bool operator<=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
friend bool operator<(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr & operator+=(const ExecutorAddrDiff &Delta)
friend bool operator!=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
std::enable_if_t< std::is_pointer< T >::value, T > toPtr(WrapFn &&Wrap=WrapFn()) const
Cast this ExecutorAddr to a pointer of the given type.
A utility class for serializing to a blob from a variadic list.
Output char buffer with overflow check.
SPS tag type for sequences.
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddrRange &Value)
static size_t size(const ExecutorAddrRange &Value)
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddrRange &Value)
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddr &EA)
static size_t size(const ExecutorAddr &EA)
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddr &EA)
Specialize to describe how to serialize/deserialize to/from the given concrete type.
This class implements an extremely fast bulk output stream that can only output to a stream.
ExecutorAddrDiff operator%(const ExecutorAddr &LHS, const ExecutorAddrDiff &RHS)
Taking the modulus of an address and a diff yields a diff.
ExecutorAddr operator+(const ExecutorAddr &LHS, const ExecutorAddrDiff &RHS)
Adding an offset and an address yields an address.
uint64_t ExecutorAddrDiff
ExecutorAddrDiff operator-(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
Subtracting two addresses yields an offset.
raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPtr &Sym)
Render a SymbolStringPtr.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>
static unsigned getHashValue(const orc::ExecutorAddr &Addr)
static bool isEqual(const orc::ExecutorAddr &LHS, const orc::ExecutorAddr &RHS)
static orc::ExecutorAddr getTombstoneKey()
static orc::ExecutorAddr getEmptyKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
Represents an address range in the exceutor process.
friend bool operator==(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
bool overlaps(const ExecutorAddrRange &Other)
friend bool operator>=(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
friend bool operator!=(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
friend bool operator<(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddrDiff Size)
ExecutorAddrRange()=default
ExecutorAddrDiff size() const
friend bool operator<=(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
bool contains(ExecutorAddr Addr) const
friend bool operator>(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)