Re-land r335038 "[llvm-exegesis] A mechanism to add target-specific functionality.""

Fix typo: LLVM_NATIVE_ARCH -> LLVM_EXEGESIS_NATIVE_ARCH.

llvm-svn: 335041
diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
new file mode 100644
index 0000000..a37387b
--- /dev/null
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -0,0 +1,33 @@
+//===-- Target.cpp ----------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include "../Target.h"
+
+namespace exegesis {
+
+namespace {
+
+class ExegesisX86Target : public ExegesisTarget {
+private:
+  bool matchesArch(llvm::Triple::ArchType Arch) const override {
+    return Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::x86;
+  }
+};
+
+} // namespace
+
+static ExegesisTarget* getTheExegesisX86Target() {
+  static ExegesisX86Target Target;
+  return &Target;
+}
+
+void InitializeX86ExegesisTarget() {
+  ExegesisTarget::registerTarget(getTheExegesisX86Target());
+}
+
+}  // namespace exegesis