A32/coprocessor: Remove boost from public interface
Removes a boost header from the public includes in favor of using the standard-provided std::variant. The use of boost in public interfaces is often a dealbreaker for some people. Given we use std::optional in the header already, we can transition over to std::variant from boost::variant. With this removal, this makes all of our dependencies internal to the library itself.
This commit is contained in:
parent
c6e1fd1416
commit
92daae9513
3 changed files with 21 additions and 23 deletions
|
@ -8,8 +8,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <variant>
|
||||||
#include <boost/variant.hpp>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/coprocessor_util.h>
|
#include <dynarmic/A32/coprocessor_util.h>
|
||||||
|
|
||||||
|
@ -36,18 +35,18 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* boost::blank: coprocessor exception will be compiled
|
* std::monostate: coprocessor exception will be compiled
|
||||||
* Callback: a call to the Callback will be compiled
|
* Callback: a call to the Callback will be compiled
|
||||||
* std::uint32_t*: a write/read to that memory address will be compiled
|
* std::uint32_t*: a write/read to that memory address will be compiled
|
||||||
*/
|
*/
|
||||||
using CallbackOrAccessOneWord = boost::variant<boost::blank, Callback, std::uint32_t*>;
|
using CallbackOrAccessOneWord = std::variant<std::monostate, Callback, std::uint32_t*>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* boost::blank: coprocessor exception will be compiled
|
* std::monostate: coprocessor exception will be compiled
|
||||||
* Callback: a call to the Callback will be compiled
|
* Callback: a call to the Callback will be compiled
|
||||||
* std::array<std::uint32_t*, 2>: a write/read to those memory addresses will be compiled
|
* std::array<std::uint32_t*, 2>: a write/read to those memory addresses will be compiled
|
||||||
*/
|
*/
|
||||||
using CallbackOrAccessTwoWords = boost::variant<boost::blank, Callback, std::array<std::uint32_t*, 2>>;
|
using CallbackOrAccessTwoWords = std::variant<std::monostate, Callback, std::array<std::uint32_t*, 2>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when compiling CDP or CDP2 for this coprocessor.
|
* Called when compiling CDP or CDP2 for this coprocessor.
|
||||||
|
@ -58,7 +57,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when compiling MCR or MCR2 for this coprocessor.
|
* Called when compiling MCR or MCR2 for this coprocessor.
|
||||||
* A return value of boost::blank will cause a coprocessor exception to be compiled.
|
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
||||||
* arg0 of the callback will contain the word sent to the coprocessor.
|
* arg0 of the callback will contain the word sent to the coprocessor.
|
||||||
* arg1 and return value of the callback are ignored.
|
* arg1 and return value of the callback are ignored.
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +73,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when compiling MRC or MRC2 for this coprocessor.
|
* Called when compiling MRC or MRC2 for this coprocessor.
|
||||||
* A return value of boost::blank will cause a coprocessor exception to be compiled.
|
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
||||||
* The return value of the callback should contain word from coprocessor.
|
* The return value of the callback should contain word from coprocessor.
|
||||||
* The low word of the return value will be stored in Rt.
|
* The low word of the return value will be stored in Rt.
|
||||||
* arg0 and arg1 of the callback are ignored.
|
* arg0 and arg1 of the callback are ignored.
|
||||||
|
@ -83,7 +82,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when compiling MRRC or MRRC2 for this coprocessor.
|
* Called when compiling MRRC or MRRC2 for this coprocessor.
|
||||||
* A return value of boost::blank will cause a coprocessor exception to be compiled.
|
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
||||||
* The return value of the callback should contain words from coprocessor.
|
* The return value of the callback should contain words from coprocessor.
|
||||||
* The low word of the return value will be stored in Rt.
|
* The low word of the return value will be stored in Rt.
|
||||||
* The high word of the return value will be stored in Rt2.
|
* The high word of the return value will be stored in Rt2.
|
||||||
|
|
|
@ -279,9 +279,8 @@ target_include_directories(dynarmic
|
||||||
PRIVATE .)
|
PRIVATE .)
|
||||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||||
target_link_libraries(dynarmic
|
target_link_libraries(dynarmic
|
||||||
PUBLIC
|
|
||||||
boost
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
boost
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
xbyak
|
xbyak
|
||||||
$<$<BOOL:DYNARMIC_USE_LLVM>:${llvm_libs}>
|
$<$<BOOL:DYNARMIC_USE_LLVM>:${llvm_libs}>
|
||||||
|
|
|
@ -1018,15 +1018,15 @@ void A32EmitX64::EmitA32CoprocSendOneWord(A32EmitContext& ctx, IR::Inst* inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto action = coproc->CompileSendOneWord(two, opc1, CRn, CRm, opc2);
|
const auto action = coproc->CompileSendOneWord(two, opc1, CRn, CRm, opc2);
|
||||||
switch (action.which()) {
|
switch (action.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
EmitCoprocessorException();
|
EmitCoprocessorException();
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, boost::get<A32::Coprocessor::Callback>(action), nullptr, args[1]);
|
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, std::get<A32::Coprocessor::Callback>(action), nullptr, args[1]);
|
||||||
return;
|
return;
|
||||||
case 2: {
|
case 2: {
|
||||||
const u32* const destination_ptr = boost::get<u32*>(action);
|
const u32* const destination_ptr = std::get<u32*>(action);
|
||||||
|
|
||||||
const Xbyak::Reg32 reg_word = ctx.reg_alloc.UseGpr(args[1]).cvt32();
|
const Xbyak::Reg32 reg_word = ctx.reg_alloc.UseGpr(args[1]).cvt32();
|
||||||
const Xbyak::Reg64 reg_destination_addr = ctx.reg_alloc.ScratchGpr();
|
const Xbyak::Reg64 reg_destination_addr = ctx.reg_alloc.ScratchGpr();
|
||||||
|
@ -1057,15 +1057,15 @@ void A32EmitX64::EmitA32CoprocSendTwoWords(A32EmitContext& ctx, IR::Inst* inst)
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto action = coproc->CompileSendTwoWords(two, opc, CRm);
|
const auto action = coproc->CompileSendTwoWords(two, opc, CRm);
|
||||||
switch (action.which()) {
|
switch (action.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
EmitCoprocessorException();
|
EmitCoprocessorException();
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, boost::get<A32::Coprocessor::Callback>(action), nullptr, args[1], args[2]);
|
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, std::get<A32::Coprocessor::Callback>(action), nullptr, args[1], args[2]);
|
||||||
return;
|
return;
|
||||||
case 2: {
|
case 2: {
|
||||||
const auto destination_ptrs = boost::get<std::array<u32*, 2>>(action);
|
const auto destination_ptrs = std::get<std::array<u32*, 2>>(action);
|
||||||
|
|
||||||
const Xbyak::Reg32 reg_word1 = ctx.reg_alloc.UseGpr(args[1]).cvt32();
|
const Xbyak::Reg32 reg_word1 = ctx.reg_alloc.UseGpr(args[1]).cvt32();
|
||||||
const Xbyak::Reg32 reg_word2 = ctx.reg_alloc.UseGpr(args[2]).cvt32();
|
const Xbyak::Reg32 reg_word2 = ctx.reg_alloc.UseGpr(args[2]).cvt32();
|
||||||
|
@ -1100,15 +1100,15 @@ void A32EmitX64::EmitA32CoprocGetOneWord(A32EmitContext& ctx, IR::Inst* inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto action = coproc->CompileGetOneWord(two, opc1, CRn, CRm, opc2);
|
const auto action = coproc->CompileGetOneWord(two, opc1, CRn, CRm, opc2);
|
||||||
switch (action.which()) {
|
switch (action.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
EmitCoprocessorException();
|
EmitCoprocessorException();
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, boost::get<A32::Coprocessor::Callback>(action), inst);
|
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, std::get<A32::Coprocessor::Callback>(action), inst);
|
||||||
return;
|
return;
|
||||||
case 2: {
|
case 2: {
|
||||||
const u32* const source_ptr = boost::get<u32*>(action);
|
const u32* const source_ptr = std::get<u32*>(action);
|
||||||
|
|
||||||
const Xbyak::Reg32 reg_word = ctx.reg_alloc.ScratchGpr().cvt32();
|
const Xbyak::Reg32 reg_word = ctx.reg_alloc.ScratchGpr().cvt32();
|
||||||
const Xbyak::Reg64 reg_source_addr = ctx.reg_alloc.ScratchGpr();
|
const Xbyak::Reg64 reg_source_addr = ctx.reg_alloc.ScratchGpr();
|
||||||
|
@ -1139,15 +1139,15 @@ void A32EmitX64::EmitA32CoprocGetTwoWords(A32EmitContext& ctx, IR::Inst* inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto action = coproc->CompileGetTwoWords(two, opc, CRm);
|
auto action = coproc->CompileGetTwoWords(two, opc, CRm);
|
||||||
switch (action.which()) {
|
switch (action.index()) {
|
||||||
case 0:
|
case 0:
|
||||||
EmitCoprocessorException();
|
EmitCoprocessorException();
|
||||||
return;
|
return;
|
||||||
case 1:
|
case 1:
|
||||||
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, boost::get<A32::Coprocessor::Callback>(action), inst);
|
CallCoprocCallback(code, ctx.reg_alloc, jit_interface, std::get<A32::Coprocessor::Callback>(action), inst);
|
||||||
return;
|
return;
|
||||||
case 2: {
|
case 2: {
|
||||||
const auto source_ptrs = boost::get<std::array<u32*, 2>>(action);
|
const auto source_ptrs = std::get<std::array<u32*, 2>>(action);
|
||||||
|
|
||||||
const Xbyak::Reg64 reg_result = ctx.reg_alloc.ScratchGpr();
|
const Xbyak::Reg64 reg_result = ctx.reg_alloc.ScratchGpr();
|
||||||
const Xbyak::Reg64 reg_destination_addr = ctx.reg_alloc.ScratchGpr();
|
const Xbyak::Reg64 reg_destination_addr = ctx.reg_alloc.ScratchGpr();
|
||||||
|
|
Loading…
Reference in a new issue