[ORC] Make ExecutorAddrDiff an alias for uint64_t.
We don't need to restrict operations on ExecutorAddrDiff as carefully as we do for ExecutorAddr.
This commit is contained in:
@@ -21,17 +21,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace orc {
|
namespace orc {
|
||||||
|
|
||||||
/// Represents the difference between two addresses in the executor process.
|
using ExecutorAddrDiff = uint64_t;
|
||||||
class ExecutorAddrDiff {
|
|
||||||
public:
|
|
||||||
ExecutorAddrDiff() = default;
|
|
||||||
explicit ExecutorAddrDiff(uint64_t Value) : Value(Value) {}
|
|
||||||
|
|
||||||
uint64_t getValue() const { return Value; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t Value = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Represents an address in the executor process.
|
/// Represents an address in the executor process.
|
||||||
class ExecutorAddr {
|
class ExecutorAddr {
|
||||||
@@ -99,12 +89,12 @@ public:
|
|||||||
ExecutorAddr operator--(int) { return ExecutorAddr(Addr--); }
|
ExecutorAddr operator--(int) { return ExecutorAddr(Addr--); }
|
||||||
|
|
||||||
ExecutorAddr &operator+=(const ExecutorAddrDiff Delta) {
|
ExecutorAddr &operator+=(const ExecutorAddrDiff Delta) {
|
||||||
Addr += Delta.getValue();
|
Addr += Delta;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorAddr &operator-=(const ExecutorAddrDiff Delta) {
|
ExecutorAddr &operator-=(const ExecutorAddrDiff Delta) {
|
||||||
Addr -= Delta.getValue();
|
Addr -= Delta;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,13 +111,13 @@ inline ExecutorAddrDiff operator-(const ExecutorAddr &LHS,
|
|||||||
/// Adding an offset and an address yields an address.
|
/// Adding an offset and an address yields an address.
|
||||||
inline ExecutorAddr operator+(const ExecutorAddr &LHS,
|
inline ExecutorAddr operator+(const ExecutorAddr &LHS,
|
||||||
const ExecutorAddrDiff &RHS) {
|
const ExecutorAddrDiff &RHS) {
|
||||||
return ExecutorAddr(LHS.getValue() + RHS.getValue());
|
return ExecutorAddr(LHS.getValue() + RHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adding an address and an offset yields an address.
|
/// Adding an address and an offset yields an address.
|
||||||
inline ExecutorAddr operator+(const ExecutorAddrDiff &LHS,
|
inline ExecutorAddr operator+(const ExecutorAddrDiff &LHS,
|
||||||
const ExecutorAddr &RHS) {
|
const ExecutorAddr &RHS) {
|
||||||
return ExecutorAddr(LHS.getValue() + RHS.getValue());
|
return ExecutorAddr(LHS + RHS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an address range in the exceutor process.
|
/// Represents an address range in the exceutor process.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ struct WrapperFunctionCall {
|
|||||||
shared::CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
|
shared::CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
|
||||||
return shared::WrapperFunctionResult(
|
return shared::WrapperFunctionResult(
|
||||||
Func.toPtr<FnTy *>()(ArgData.Start.toPtr<const char *>(),
|
Func.toPtr<FnTy *>()(ArgData.Start.toPtr<const char *>(),
|
||||||
static_cast<size_t>(ArgData.size().getValue())));
|
static_cast<size_t>(ArgData.size())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run call and deserialize result using SPS.
|
/// Run call and deserialize result using SPS.
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size) {
|
|||||||
return WrapperFunction<void(SPSExecutorAddrRange)>::handle(
|
return WrapperFunction<void(SPSExecutorAddrRange)>::handle(
|
||||||
Data, Size,
|
Data, Size,
|
||||||
[](ExecutorAddrRange R) {
|
[](ExecutorAddrRange R) {
|
||||||
registerJITLoaderGDBImpl(R.Start.toPtr<char *>(),
|
registerJITLoaderGDBImpl(R.Start.toPtr<char *>(), R.size());
|
||||||
R.size().getValue());
|
|
||||||
})
|
})
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user