[llvm-exegesis] Provide a way to handle memory instructions.

Summary:
And implement memory instructions on X86.

This fixes PR36906.

Reviewers: gchatelet

Reviewed By: gchatelet

Subscribers: lebedev.ri, filcab, mgorny, tschuett, RKSimon, llvm-commits

Differential Revision: https://reviews.llvm.org/D48935

llvm-svn: 338567
diff --git a/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
new file mode 100644
index 0000000..05b36a3
--- /dev/null
+++ b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp
@@ -0,0 +1,31 @@
+//===-- BenchmarkRunnerTest.cpp ---------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "BenchmarkRunner.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+namespace exegesis {
+
+namespace {
+
+TEST(ScratchSpaceTest, Works) {
+  BenchmarkRunner::ScratchSpace Space;
+  EXPECT_EQ(reinterpret_cast<intptr_t>(Space.ptr()) %
+                BenchmarkRunner::ScratchSpace::kAlignment,
+            0u);
+  Space.ptr()[0] = 42;
+  Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1] = 43;
+  Space.clear();
+  EXPECT_EQ(Space.ptr()[0], 0);
+  EXPECT_EQ(Space.ptr()[BenchmarkRunner::ScratchSpace::kSize - 1], 0);
+}
+
+} // namespace
+} // namespace exegesis