Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/docs/CommandGuide/llvm-exegesis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ properly.
* `LLVM-EXEGESIS-MEM-MAP <value name> <address>` - This annotation allows for
mapping previously defined memory definitions into the execution context of a
process. The value name refers to a previously defined memory definition and
the address is a decimal number that specifies the address the memory
the address is a hex value that specifies the address the memory
definition should start at. Note that a single memory definition can be
mapped multiple times. Using this annotation requires the subprocess
execution mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# ALLOW_RETRIES: 2

# LLVM-EXEGESIS-MEM-DEF test1 4096 2147483647
# LLVM-EXEGESIS-MEM-MAP test1 1048576
# LLVM-EXEGESIS-MEM-MAP test1 100000
# LLVM-EXEGESIS-LIVEIN R14

movq $1048576, %rax
movq $0x100000, %rax
movq %r14, (%rax)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# ALLOW_RETRIES: 2

# LLVM-EXEGESIS-MEM-DEF test1 4096 2147483647
# LLVM-EXEGESIS-MEM-MAP test1 1048576
# LLVM-EXEGESIS-MEM-MAP test1 100000

movq $1048576, %rax
movq $0x100000, %rax
movq (%rax), %rdi
2 changes: 1 addition & 1 deletion llvm/tools/llvm-exegesis/lib/SnippetFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class BenchmarkCodeStreamer : public MCStreamer, public AsmCommentConsumer {
}
MemoryMapping MemMap;
MemMap.MemoryValueName = Parts[0].trim().str();
MemMap.Address = std::stol(Parts[1].trim().str());
MemMap.Address = std::stol(Parts[1].trim().str(), nullptr, 16);
// validate that the annotation refers to an already existing memory
// definition
auto MemValIT = Result->Key.MemoryValues.find(Parts[0].trim().str());
Expand Down
22 changes: 11 additions & 11 deletions llvm/unittests/tools/llvm-exegesis/X86/SnippetFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ TEST_F(X86SnippetFileTest, NoAsmStreamer) {
TEST_F(X86SnippetFileTest, MemoryDefinitionTestSingleDef) {
auto Snippets = TestCommon(R"(
# LLVM-EXEGESIS-MEM-DEF test1 4096 ff
# LLVM-EXEGESIS-MEM-MAP test1 8192
# LLVM-EXEGESIS-MEM-MAP test1 16384
movq $8192, %r10
# LLVM-EXEGESIS-MEM-MAP test1 2000
# LLVM-EXEGESIS-MEM-MAP test1 4000
movq $0x2000, %r10
movq (%r10), %r11
)");
EXPECT_FALSE((bool)Snippets.takeError());
Expand All @@ -158,16 +158,16 @@ TEST_F(X86SnippetFileTest, MemoryDefinitionTestSingleDef) {
ASSERT_THAT(Snippet.Key.MemoryValues,
UnorderedElementsAre(MemoryDefinitionIs("test1", 255, 4096)));
ASSERT_THAT(Snippet.Key.MemoryMappings,
ElementsAre(MemoryMappingIs(8192, "test1"),
MemoryMappingIs(16384, "test1")));
ElementsAre(MemoryMappingIs(0x2000, "test1"),
MemoryMappingIs(0x4000, "test1")));
}

TEST_F(X86SnippetFileTest, MemoryDefinitionsTestTwoDef) {
auto Snippets = TestCommon(R"(
# LLVM-EXEGESIS-MEM-DEF test1 4096 ff
# LLVM-EXEGESIS-MEM-DEF test2 4096 100
# LLVM-EXEGESIS-MEM-MAP test1 8192
# LLVM-EXEGESIS-MEM-MAP test2 16384
# LLVM-EXEGESIS-MEM-MAP test1 2000
# LLVM-EXEGESIS-MEM-MAP test2 4000
movq $8192, %r10
movq (%r10), %r11
)");
Expand All @@ -178,8 +178,8 @@ TEST_F(X86SnippetFileTest, MemoryDefinitionsTestTwoDef) {
UnorderedElementsAre(MemoryDefinitionIs("test1", 255, 4096),
MemoryDefinitionIs("test2", 256, 4096)));
ASSERT_THAT(Snippet.Key.MemoryMappings,
ElementsAre(MemoryMappingIs(8192, "test1"),
MemoryMappingIs(16384, "test2")));
ElementsAre(MemoryMappingIs(0x2000, "test1"),
MemoryMappingIs(0x4000, "test2")));
}

TEST_F(X86SnippetFileTest, MemoryDefinitionMissingParameter) {
Expand All @@ -202,7 +202,7 @@ TEST_F(X86SnippetFileTest, MemoryMappingMissingParameters) {

TEST_F(X86SnippetFileTest, MemoryMappingNoDefinition) {
auto Error = TestCommon(R"(
# LLVM-EXEGESIS-MEM-MAP test1 4096
# LLVM-EXEGESIS-MEM-MAP test1 2000
)")
.takeError();
EXPECT_TRUE((bool)Error);
Expand All @@ -211,7 +211,7 @@ TEST_F(X86SnippetFileTest, MemoryMappingNoDefinition) {

TEST_F(X86SnippetFileTest, IncompatibleExecutorMode) {
auto Error = TestCommon(R"(
# LLVM-EXEGESIS-MEM-MAP test1 4096
# LLVM-EXEGESIS-MEM-MAP test1 2000
)")
.takeError();
EXPECT_TRUE((bool)Error);
Expand Down