[compiler-rt] 4c43483 - [ORC-RT] Make ExecutorAddrDiff an alias for uint64_t.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 19:20:59 PDT 2022
Author: Lang Hames
Date: 2022-09-15T19:11:51-07:00
New Revision: 4c434831865f0ce95bc396e8de786a0d21bbfa7a
URL: https://github.com/llvm/llvm-project/commit/4c434831865f0ce95bc396e8de786a0d21bbfa7a
DIFF: https://github.com/llvm/llvm-project/commit/4c434831865f0ce95bc396e8de786a0d21bbfa7a.diff
LOG: [ORC-RT] Make ExecutorAddrDiff an alias for uint64_t.
Unlike ExecutorAddr, there's limited value to having a distinct type for
ExecutorAddrDiff, and it's occasionally awkward to work with. The corresponding
LLVM type (llvm::orc::ExecutorAddrDiff) was already made a type-alias in
9e2cfb061a882.
Added:
Modified:
compiler-rt/lib/orc/executor_address.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/executor_address.h b/compiler-rt/lib/orc/executor_address.h
index fcdbe5e1edda..1542ee96bd92 100644
--- a/compiler-rt/lib/orc/executor_address.h
+++ b/compiler-rt/lib/orc/executor_address.h
@@ -24,17 +24,7 @@
namespace __orc_rt {
-/// Represents the
diff erence between two addresses in the executor process.
-class ExecutorAddrDiff {
-public:
- ExecutorAddrDiff() = default;
- explicit ExecutorAddrDiff(uint64_t Value) : Value(Value) {}
-
- uint64_t getValue() const { return Value; }
-
-private:
- int64_t Value = 0;
-};
+using ExecutorAddrDiff = uint64_t;
/// Represents an address in the executor process.
class ExecutorAddr {
@@ -148,12 +138,12 @@ class ExecutorAddr {
ExecutorAddr operator--(int) { return ExecutorAddr(Addr++); }
ExecutorAddr &operator+=(const ExecutorAddrDiff Delta) {
- Addr += Delta.getValue();
+ Addr += Delta;
return *this;
}
ExecutorAddr &operator-=(const ExecutorAddrDiff Delta) {
- Addr -= Delta.getValue();
+ Addr -= Delta;
return *this;
}
@@ -170,13 +160,13 @@ inline ExecutorAddrDiff operator-(const ExecutorAddr &LHS,
/// Adding an offset and an address yields an address.
inline ExecutorAddr operator+(const ExecutorAddr &LHS,
const ExecutorAddrDiff &RHS) {
- return ExecutorAddr(LHS.getValue() + RHS.getValue());
+ return ExecutorAddr(LHS.getValue() + RHS);
}
/// Adding an address and an offset yields an address.
inline ExecutorAddr operator+(const ExecutorAddrDiff &LHS,
const ExecutorAddr &RHS) {
- return ExecutorAddr(LHS.getValue() + RHS.getValue());
+ return ExecutorAddr(LHS + RHS.getValue());
}
/// Represents an address range in the exceutor process.
@@ -204,9 +194,9 @@ struct ExecutorAddrRange {
}
template <typename T> span<T> toSpan() const {
- assert(size().getValue() % sizeof(T) == 0 &&
+ assert(size() % sizeof(T) == 0 &&
"AddressRange is not a multiple of sizeof(T)");
- return span<T>(Start.toPtr<T *>(), size().getValue() / sizeof(T));
+ return span<T>(Start.toPtr<T *>(), size() / sizeof(T));
}
ExecutorAddr Start;
More information about the llvm-commits
mailing list