[llvm-exegesis] Validate that address annotations are aligned (#75554)
commitceb196d9903f4db7250bbc6c8da13eeae1b85886
authorAiden Grossman <agrossman154@yahoo.com>
Fri, 15 Dec 2023 17:45:30 +0000 (15 09:45 -0800)
committerGitHub <noreply@github.com>
Fri, 15 Dec 2023 17:45:30 +0000 (15 09:45 -0800)
treeadcdf32489b0107ac387cad84d076b464391ff09
parent9277ef12c03932d864104d4079a2f3c8d87d4864
[llvm-exegesis] Validate that address annotations are aligned (#75554)

This patch adds in validation at two different levels that address
annotations are page aligned. This is necessary as otherwise the mmap
calls will fail as MAP_FIXED/MAP_FIXED_NOREPLACE require page aligned
addresses. This happens silently in the subprocess. This patch adds
validation at snippet parsing time to give feedback to the user and also
adds asserts at code generation/address usage time to ensure that other
users of the Exegesis APIs conform to the same requirements.
llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-alignment-page-boundary.s [new file with mode: 0644]
llvm/test/tools/llvm-exegesis/X86/latency/memory-annotations-snippet-alignment-page-boundary.s [new file with mode: 0644]
llvm/tools/llvm-exegesis/lib/Assembler.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
llvm/tools/llvm-exegesis/lib/SnippetFile.cpp