Go to the documentation of this file.
13 #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
14 #define LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
23 #include <type_traits>
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;
219 return OS <<
formatv(
"{0:x}", A.getValue());
223 return OS <<
formatv(
"{0:x} -- {1:x}", R.Start.getValue(), R.End.getValue());
298 #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_EXECUTORADDRESS_H
Represents an address in the executor process.
friend bool operator<=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
Merges a tag into the raw address value: P' = P | (TagValue << TagOffset).
raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPtr &Sym)
Render a SymbolStringPtr.
static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap=UnwrapFn())
Create an ExecutorAddr from the given pointer.
This is an optimization pass for GlobalISel generic memory operations.
SPS tag type for sequences.
constexpr T * operator()(T *P)
Specialize to describe how to serialize/deserialize to/from the given concrete type.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Output char buffer with overflow check.
uint64_t getValue() const
ExecutorAddrRange()=default
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddr &EA)
static size_t size(const ExecutorAddr &EA)
friend bool operator>(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr operator+(const ExecutorAddr &LHS, const ExecutorAddrDiff &RHS)
Adding an offset and an address yields an address.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
An information struct used to provide DenseMap with the various necessary components for a given valu...
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.
constexpr Untag(uintptr_t TagLen, uintptr_t TagOffset)
ExecutorAddrDiff operator-(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
Subtracting two addresses yields an offset.
constexpr T * operator()(T *P)
uint64_t ExecutorAddrDiff
This class implements an extremely fast bulk output stream that can only output to a stream.
Represents an address range in the exceutor process.
void setValue(uint64_t Addr)
static bool isEqual(const orc::ExecutorAddr &LHS, const orc::ExecutorAddr &RHS)
Strips a tag of the given length from the given offset within the pointer: P' = P & ~(((1 << TagLen) ...
ExecutorAddr & operator--()
static bool serialize(SPSOutputBuffer &BOB, const ExecutorAddrRange &Value)
ExecutorAddrDiff size() const
static size_t size(const ExecutorAddrRange &Value)
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
static unsigned getHashValue(const orc::ExecutorAddr &Addr)
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddr &EA)
ExecutorAddr & operator++()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ExecutorAddr & operator+=(const ExecutorAddrDiff &Delta)
bool overlaps(const ExecutorAddrRange &Other)
constexpr ExecutorAddr(uint64_t Addr)
Create an ExecutorAddr from the given value.
friend bool operator!=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr operator++(int)
constexpr Tag(uintptr_t TagValue, uintptr_t TagOffset)
static bool deserialize(SPSInputBuffer &BIB, ExecutorAddrRange &Value)
friend bool operator==(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
ExecutorAddr operator--(int)
friend bool operator!=(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
static orc::ExecutorAddr getTombstoneKey()
ExecutorAddr & operator-=(const ExecutorAddrDiff &Delta)
friend bool operator<(const ExecutorAddr &LHS, const ExecutorAddr &RHS)
static bool isEqual(const Function &Caller, const Function &Callee)
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.
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddrDiff Size)
std::optional< std::vector< StOtherPiece > > Other
ExecutorAddrDiff operator%(const ExecutorAddr &LHS, const ExecutorAddrDiff &RHS)
Taking the modulus of an address and a diff yields a diff.
friend bool operator==(const ExecutorAddrRange &LHS, const ExecutorAddrRange &RHS)
static orc::ExecutorAddr getEmptyKey()
LLVM Value Representation.
A utility class for serializing to a blob from a variadic list.
bool contains(ExecutorAddr Addr) const
friend bool operator>=(const ExecutorAddr &LHS, const ExecutorAddr &RHS)