--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * llvmjit_wrap.cpp
+ * Parts of the LLVM interface not (yet) exposed to C.
+ *
+ * Copyright (c) 2016-2018, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * src/backend/lib/llvmjit_wrap.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+extern "C"
+{
+#include "postgres.h"
+}
+
+#include <llvm/MC/SubtargetFeature.h>
+#include <llvm/Support/Host.h>
+
+#include "jit/llvmjit.h"
+
+
+/*
+ * C-API extensions.
+ */
+#if defined(HAVE_DECL_LLVMGETHOSTCPUNAME) && !HAVE_LLVMGETHOSTCPUNAME
+char *LLVMGetHostCPUName(void) {
+ return strdup(llvm::sys::getHostCPUName().data());
+}
+#endif
+
+
+char *LLVMGetHostCPUFeatures(void) {
+ llvm::SubtargetFeatures Features;
+ llvm::StringMap<bool> HostFeatures;
+
+ if (llvm::sys::getHostCPUFeatures(HostFeatures))
+ for (auto &F : HostFeatures)
+ Features.AddFeature(F.first(), F.second);
+
+ return strdup(Features.getString().c_str());
+}
extern LLVMJitContext *llvm_create_context(int jitFlags);
+
+/*
+ ****************************************************************************
+ * Extensions / Backward compatibility section of the LLVM C API
+ * Error handling related functions.
+ ****************************************************************************
+ */
+#if defined(HAVE_DECL_LLVMGETHOSTCPUNAME) && !HAVE_LLVMGETHOSTCPUNAME
+/** Get the host CPU as a string. The result needs to be disposed with
+ LLVMDisposeMessage. */
+char *LLVMGetHostCPUName(void);
+#endif
+
+/** Get the host CPU features as a string. The result needs to be disposed
+ with LLVMDisposeMessage. */
+extern char *LLVMGetHostCPUFeatures(void);
+
#ifdef __cplusplus
} /* extern "C" */
#endif