LLVM for m68k completed (but not merged)

John Paul Adrian Glaubitz <[email protected]>
Newsgroups gmane.os.netbsd.ports.amiga,gmane.os.netbsd.ports.m68k
Message-ID <[email protected]>
Hi!


I just received the news that the m68k backend for LLVM has been finished [1].

It has not been merged upstream yet (that will take some time), but it should
be usable now. I'm currently test-building it on Debian/m68k. Maybe some of
the folks here want to give it a try on NetBSD and report back any issues
you are seeing.

One issue I found is that CycleTimer has not been implemented. A quick fix is to
use the definition used by MIPS, i.e.:

diff --git a/llvm/utils/benchmark/src/cycleclock.h b/llvm/utils/benchmark/src/cycleclock.h
index 1b0f09359c9..88b7805faaf 100644
--- a/llvm/utils/benchmark/src/cycleclock.h
+++ b/llvm/utils/benchmark/src/cycleclock.h
@@ -161,7 +161,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
   struct timeval tv;
   gettimeofday(&tv, nullptr);
   return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
-#elif defined(__mips__)
+#elif defined(__mips__) || defined(__m68k__)
   // mips apparently only allows rdtsc for superusers, so we fall
   // back to gettimeofday.  It's possible clock_gettime would be better.
   struct timeval tv;

Adrian

> [1] https://github.com/M680x0/M680x0-mono-repo

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - [email protected]
`. `'   Freie Universitaet Berlin - [email protected]
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.