[llvm] 37f1b7a - [ORC] Allow construction of an ExecutorAddrRange from an addr and a size.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 24 14:35:54 PDT 2021
Author: Lang Hames
Date: 2021-09-24T14:35:50-07:00
New Revision: 37f1b7a3f35fd9edbb110a3845e79d46224ea79b
URL: https://github.com/llvm/llvm-project/commit/37f1b7a3f35fd9edbb110a3845e79d46224ea79b
DIFF: https://github.com/llvm/llvm-project/commit/37f1b7a3f35fd9edbb110a3845e79d46224ea79b.diff
LOG: [ORC] Allow construction of an ExecutorAddrRange from an addr and a size.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
index 01cc963036c3..ddbb702545a9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
@@ -135,6 +135,8 @@ struct ExecutorAddrRange {
ExecutorAddrRange() = default;
ExecutorAddrRange(ExecutorAddr Start, ExecutorAddr End)
: Start(Start), End(End) {}
+ ExecutorAddrRange(ExecutorAddr Start, ExecutorAddrDiff Size)
+ : Start(Start), End(Start + Size) {}
bool empty() const { return Start == End; }
ExecutorAddrDiff size() const { return End - Start; }
diff --git a/llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp
index f9ba8616810a..99099a0c5591 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ExecutorAddressTest.cpp
@@ -58,6 +58,7 @@ TEST(ExecutorAddrTest, AddrRanges) {
// R4: ## -- Overlaps R1 end
EXPECT_EQ(R1, ExecutorAddrRange(A1, A2));
+ EXPECT_EQ(R1, ExecutorAddrRange(A1, ExecutorAddrDiff(1)));
EXPECT_NE(R1, R2);
EXPECT_TRUE(R1.contains(A1));
More information about the llvm-commits
mailing list