Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Feb 2018 01:33:26 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r460955 - in branches/2018Q1/emulators/rpcs3: . files
Message-ID:  <201802050133.w151XQVg086712@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Mon Feb  5 01:33:26 2018
New Revision: 460955
URL: https://svnweb.freebsd.org/changeset/ports/460955

Log:
  MFH: r460866
  
  emulators/rpcs3: switch to llvm50
  
  LLVM PPU is still unstable on FreeBSD, so allow users to play with
  different versions of it. By default use the same version as Mesa.
  
  Approved by:	ports-secteam (feld)

Added:
  branches/2018Q1/emulators/rpcs3/files/patch-llvm6
     - copied unchanged from r460866, head/emulators/rpcs3/files/patch-llvm6
Modified:
  branches/2018Q1/emulators/rpcs3/Makefile
Directory Properties:
  branches/2018Q1/   (props changed)

Modified: branches/2018Q1/emulators/rpcs3/Makefile
==============================================================================
--- branches/2018Q1/emulators/rpcs3/Makefile	Sun Feb  4 23:37:26 2018	(r460954)
+++ branches/2018Q1/emulators/rpcs3/Makefile	Mon Feb  5 01:33:26 2018	(r460955)
@@ -4,6 +4,7 @@ PORTNAME=	rpcs3
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.0.4-293
 DISTVERSIONSUFFIX=	-g70fe0cc22
+PORTREVISION=	1
 CATEGORIES=	emulators
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -44,6 +45,7 @@ CMAKE_ARGS+=	-DCMAKE_SKIP_RPATH=on -DUSE_SYSTEM_LIBPNG
 CXXFLAGS+=	-D_GLIBCXX_USE_C99 # XXX ports/193528
 CXXFLAGS+=	-Wno-macro-redefined # __STDC_*_MACROS sys/cdefs.h vs. llvm-config
 LDFLAGS+=	-Wl,--as-needed # GLU
+MESA_LLVM_VER?=	50
 
 OPTIONS_DEFINE=	ALSA EVDEV GDB LLVM PULSEAUDIO VULKAN
 OPTIONS_DEFAULT=ALSA LLVM VULKAN
@@ -63,7 +65,8 @@ GDB_DESC=		GDB remote stub (powerpc64 target)
 GDB_CMAKE_BOOL=		WITH_GDB
 
 LLVM_DESC=		LLVM-based PPU recompiler
-LLVM_BUILD_DEPENDS=	llvm40>0:devel/llvm40
+LLVM_BUILD_DEPENDS=	llvm${MESA_LLVM_VER}>0:devel/llvm${MESA_LLVM_VER}
+LLVM_CMAKE_ON=		-DLLVM_DIR:PATH=${LOCALBASE}/llvm${MESA_LLVM_VER}/lib/cmake/llvm
 LLVM_CMAKE_BOOL_OFF=	WITHOUT_LLVM
 
 PULSEAUDIO_LIB_DEPENDS=	libpulse-simple.so:audio/pulseaudio

Copied: branches/2018Q1/emulators/rpcs3/files/patch-llvm6 (from r460866, head/emulators/rpcs3/files/patch-llvm6)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/emulators/rpcs3/files/patch-llvm6	Mon Feb  5 01:33:26 2018	(r460955, copy of r460866, head/emulators/rpcs3/files/patch-llvm6)
@@ -0,0 +1,125 @@
+Based on https://github.com/hcorion/rpcs3/commit/017958c93018
+
+--- Utilities/JIT.cpp.orig	2018-02-02 08:17:12 UTC
++++ Utilities/JIT.cpp
+@@ -71,7 +71,7 @@ static void* s_next = s_memory;
+ #ifdef _WIN32
+ static std::deque<std::vector<RUNTIME_FUNCTION>> s_unwater;
+ static std::vector<std::vector<RUNTIME_FUNCTION>> s_unwind; // .pdata
+-#else
++#elif LLVM_VERSION_MAJOR < 5
+ static std::deque<std::tuple<u8*, u64, std::size_t>> s_unfire;
+ #endif
+ 
+@@ -107,12 +107,16 @@ extern void jit_finalize()
+ 		}
+ 	} mem;
+ 
++#if LLVM_VERSION_MAJOR < 5
+ 	for (auto&& t : s_unfire)
+ 	{
+ 		mem.deregisterEHFrames(std::get<0>(t), std::get<1>(t), std::get<2>(t));
+ 	}
+ 
+ 	s_unfire.clear();
++#else
++	mem.deregisterEHFrames();
++#endif // LLVM_VERSION_MAJOR < 5
+ #endif
+ 
+ 	utils::memory_decommit(s_memory, s_memory_size);
+@@ -286,14 +290,18 @@ struct MemoryManager : llvm::RTDyldMemoryManager
+ 		{
+ 			s_unwind.emplace_back(std::move(pdata));
+ 		}
+-#else
++#elif LLVM_VERSION_MAJOR < 5
+ 		s_unfire.push_front(std::make_tuple(addr, load_addr, size));
+ #endif
+ 
+ 		return RTDyldMemoryManager::registerEHFrames(addr, load_addr, size);
+ 	}
+ 
++#if LLVM_VERSION_MAJOR < 5
+ 	void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
++#else
++	virtual void deregisterEHFrames() override
++#endif
+ 	{
+ 	}
+ };
+@@ -380,7 +388,11 @@ class ObjectCache final : public llvm::ObjectCache (pu
+ 	{
+ 		if (fs::file cached{path, fs::read})
+ 		{
++#if LLVM_VERSION_MAJOR < 6
+ 			auto buf = llvm::MemoryBuffer::getNewUninitMemBuffer(cached.size());
++#else
++			auto buf = llvm::WritableMemoryBuffer::getNewUninitMemBuffer(cached.size());
++#endif
+ 			cached.read(const_cast<char*>(buf->getBufferStart()), buf->getBufferSize());
+ 			return buf;
+ 		}
+--- rpcs3/CMakeLists.txt.orig	2018-02-02 08:17:12 UTC
++++ rpcs3/CMakeLists.txt
+@@ -173,7 +173,7 @@ set(CMAKE_MODULE_PATH "${RPCS3_SRC_DIR}/cmake_modules"
+ find_package(OpenGL REQUIRED)
+ find_package(OpenAL REQUIRED)
+ if(NOT WITHOUT_LLVM)
+-	find_package(LLVM 4.0 CONFIG)
++	find_package(LLVM CONFIG)
+ 	if(NOT LLVM_FOUND)
+ 		message("System LLVM was not found, LLVM will be built from the submodule.")
+ 
+--- rpcs3/Emu/Cell/PPUTranslator.cpp.orig	2018-02-02 08:17:12 UTC
++++ rpcs3/Emu/Cell/PPUTranslator.cpp
+@@ -16,7 +16,11 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Mod
+ 	, m_module(module)
+ 	, m_is_be(false)
+ 	, m_info(info)
++#if LLVM_VERSION_MAJOR < 5
+ 	, m_pure_attr(AttributeSet::get(m_context, AttributeSet::FunctionIndex, {Attribute::NoUnwind, Attribute::ReadNone}))
++#else
++	, m_pure_attr(AttributeList::get(m_context,AttributeList::FunctionIndex, AttrBuilder().addAttribute(Attribute::NoUnwind).addAttribute(Attribute::ReadNone)))
++#endif
+ {
+ 	// There is no weak linkage on JIT, so let's create variables with different names for each module part
+ 	const u32 gsuffix = m_info.name.empty() ? info.funcs[0].addr : info.funcs[0].addr - m_info.segs[0].addr;
+--- rpcs3/Emu/Cell/PPUTranslator.h.orig	2018-02-02 08:17:12 UTC
++++ rpcs3/Emu/Cell/PPUTranslator.h
+@@ -120,7 +120,11 @@ class PPUTranslator final //: public CPUTranslator
+ 	std::map<u64, const ppu_reloc*> m_relocs;
+ 
+ 	// Attributes for function calls which are "pure" and may be optimized away if their results are unused
++#if LLVM_VERSION_MAJOR < 5
+ 	const llvm::AttributeSet m_pure_attr;
++#else
++	const llvm::AttributeList m_pure_attr;
++#endif
+ 
+ 	// IR builder
+ 	llvm::IRBuilder<>* m_ir;
+@@ -404,7 +408,11 @@ class PPUTranslator final //: public CPUTranslator
+ 
+ 	// Call a function with attribute list
+ 	template<typename... Args>
++#if LLVM_VERSION_MAJOR < 5
+ 	llvm::CallInst* Call(llvm::Type* ret, llvm::AttributeSet attr, llvm::StringRef name, Args... args)
++#else
++	llvm::CallInst* Call(llvm::Type* ret, llvm::AttributeList attr, llvm::StringRef name, Args... args)
++#endif
+ 	{
+ 		// Call the function
+ 		return m_ir->CreateCall(m_module->getOrInsertFunction(name, llvm::FunctionType::get(ret, {args->getType()...}, false), attr), {args...});
+@@ -414,7 +422,11 @@ class PPUTranslator final //: public CPUTranslator
+ 	template<typename... Args>
+ 	llvm::CallInst* Call(llvm::Type* ret, llvm::StringRef name, Args... args)
+ 	{
++#if LLVM_VERSION_MAJOR < 5
+ 		return Call(ret, llvm::AttributeSet{}, name, args...);
++#else
++		return Call(ret, llvm::AttributeList{}, name, args...);
++#endif
+ 	}
+ 
+ 	// Handle compilation errors



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802050133.w151XQVg086712>