mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 04:24:37 +03:00
[ABI] Reworked FuncSignature
This commit is contained in:
@@ -246,6 +246,12 @@ namespace asmjit {
|
|||||||
//! - Renamed `a64::Vec::ElementType` to `a64::VecElementType` and made it a typed enum. This enum was used mostly
|
//! - Renamed `a64::Vec::ElementType` to `a64::VecElementType` and made it a typed enum. This enum was used mostly
|
||||||
//! internally, but there is a public API using it, so it's a breaking change.
|
//! internally, but there is a public API using it, so it's a breaking change.
|
||||||
//!
|
//!
|
||||||
|
//! - Refactored `FuncSignature`, `FuncSignatureT`, and `FuncSignatureBuilder`. There is only `FuncSignature` now,
|
||||||
|
//! which acts as a function signature holder and builder. Replace `FuncSignatureBuilder` with `FuncSignature`
|
||||||
|
//! and use `FuncSignature::build<args>` instead of `FuncSignatureT<args>`. The old API has been deprecated.
|
||||||
|
//!
|
||||||
|
//! - The maximum number of function arguments was raised from 16 to 32.
|
||||||
|
//!
|
||||||
//! ### Changes committed at 2023-12-26
|
//! ### Changes committed at 2023-12-26
|
||||||
//!
|
//!
|
||||||
//! Core changes:
|
//! Core changes:
|
||||||
@@ -442,7 +448,7 @@ namespace asmjit {
|
|||||||
//! // Calling a function (Compiler) changed - use invoke() instead of call().
|
//! // Calling a function (Compiler) changed - use invoke() instead of call().
|
||||||
//! void functionInvocation(x86::Compiler& cc) {
|
//! void functionInvocation(x86::Compiler& cc) {
|
||||||
//! InvokeNode* invokeNode;
|
//! InvokeNode* invokeNode;
|
||||||
//! cc.invoke(&invokeNode, targetOperand, FuncSignatureT<...>(...));
|
//! cc.invoke(&invokeNode, targetOperand, FuncSignature::build<...>(...));
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
|||||||
@@ -425,17 +425,10 @@ namespace asmjit {
|
|||||||
//! Marks function, class, struct, enum, or anything else as deprecated.
|
//! Marks function, class, struct, enum, or anything else as deprecated.
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define ASMJIT_DEPRECATED(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
|
#define ASMJIT_DEPRECATED(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
|
||||||
#if defined(__clang__)
|
|
||||||
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
|
|
||||||
#else
|
|
||||||
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
|
|
||||||
#endif
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define ASMJIT_DEPRECATED(MESSAGE) __declspec(deprecated(MESSAGE))
|
#define ASMJIT_DEPRECATED(MESSAGE) __declspec(deprecated(MESSAGE))
|
||||||
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
|
|
||||||
#else
|
#else
|
||||||
#define ASMJIT_DEPRECATED(MESSAGE)
|
#define ASMJIT_DEPRECATED(MESSAGE)
|
||||||
#define ASMJIT_DEPRECATED_STRUCT(MESSAGE)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Utilities.
|
// Utilities.
|
||||||
|
|||||||
@@ -283,4 +283,18 @@ ASMJIT_FAVOR_SIZE Error FuncArgsAssignment::updateFuncFrame(FuncFrame& frame) co
|
|||||||
return kErrorOk;
|
return kErrorOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Func API - Tests
|
||||||
|
// ================
|
||||||
|
|
||||||
|
#if defined(ASMJIT_TEST)
|
||||||
|
UNIT(func_signature) {
|
||||||
|
FuncSignature signature;
|
||||||
|
signature.setRetT<int8_t>();
|
||||||
|
signature.addArgT<int16_t>();
|
||||||
|
signature.addArg(TypeId::kInt32);
|
||||||
|
|
||||||
|
EXPECT_EQ(signature, FuncSignature::build<int8_t, int16_t, int32_t>());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ASMJIT_END_NAMESPACE
|
ASMJIT_END_NAMESPACE
|
||||||
|
|||||||
@@ -377,36 +377,80 @@ struct FuncSignature {
|
|||||||
//! \{
|
//! \{
|
||||||
|
|
||||||
//! Calling convention id.
|
//! Calling convention id.
|
||||||
CallConvId _ccId;
|
CallConvId _ccId = CallConvId::kHost;
|
||||||
//! Count of arguments.
|
//! Count of arguments.
|
||||||
uint8_t _argCount;
|
uint8_t _argCount = 0;
|
||||||
//! Index of a first VA or `kNoVarArgs`.
|
//! Index of a first VA or `kNoVarArgs`.
|
||||||
uint8_t _vaIndex;
|
uint8_t _vaIndex = kNoVarArgs;
|
||||||
//! Return value TypeId.
|
//! Return value TypeId.
|
||||||
TypeId _ret;
|
TypeId _ret = TypeId::kVoid;
|
||||||
//! Function arguments TypeIds.
|
//! Reserved for future use.
|
||||||
const TypeId* _args;
|
uint8_t _reserved[4] {};
|
||||||
|
//! Function argument TypeIds.
|
||||||
|
TypeId _args[Globals::kMaxFuncArgs] {};
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
|
|
||||||
//! \name Initialization & Reset
|
//! \name Construction & Destruction
|
||||||
//! \{
|
//! \{
|
||||||
|
|
||||||
//! Initializes the function signature.
|
//! Default constructed function signature, initialized to \ref CallConvId::kHost, having no return value and no arguments.
|
||||||
inline void init(CallConvId ccId, uint32_t vaIndex, TypeId ret, const TypeId* args, uint32_t argCount) noexcept {
|
ASMJIT_FORCE_INLINE constexpr FuncSignature() = default;
|
||||||
ASMJIT_ASSERT(argCount <= 0xFF);
|
|
||||||
|
|
||||||
_ccId = ccId;
|
//! Copy constructor, which is initialized to the same function signature as `other`.
|
||||||
_argCount = uint8_t(argCount);
|
ASMJIT_FORCE_INLINE constexpr FuncSignature(const FuncSignature& other) = default;
|
||||||
_vaIndex = uint8_t(vaIndex);
|
|
||||||
_ret = ret;
|
//! Initializes the function signature with calling convention id `ccId` and variable argument's index `vaIndex`.
|
||||||
_args = args;
|
ASMJIT_FORCE_INLINE constexpr FuncSignature(CallConvId ccId, uint32_t vaIndex = kNoVarArgs) noexcept
|
||||||
|
: _ccId(ccId),
|
||||||
|
_vaIndex(uint8_t(vaIndex)) {}
|
||||||
|
|
||||||
|
//! Initializes the function signature with calling convention id `ccId`, `vaIndex`, return value, and function arguments.
|
||||||
|
template<typename... Args>
|
||||||
|
ASMJIT_FORCE_INLINE constexpr FuncSignature(CallConvId ccId, uint32_t vaIndex, TypeId ret, Args&&...args) noexcept
|
||||||
|
: _ccId(ccId),
|
||||||
|
_argCount(uint8_t(sizeof...(args))),
|
||||||
|
_vaIndex(uint8_t(vaIndex)),
|
||||||
|
_ret(ret),
|
||||||
|
_args{std::forward<Args>(args)...} {}
|
||||||
|
|
||||||
|
template<typename... RetValueAndArgs>
|
||||||
|
static ASMJIT_INLINE_NODEBUG constexpr FuncSignature build(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept {
|
||||||
|
return FuncSignature(ccId, vaIndex, (TypeId(TypeUtils::TypeIdOfT<RetValueAndArgs>::kTypeId))... );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \}
|
||||||
|
|
||||||
|
//! \name Overloaded Operators
|
||||||
|
//! \{
|
||||||
|
|
||||||
|
ASMJIT_FORCE_INLINE FuncSignature& operator=(const FuncSignature& other) noexcept = default;
|
||||||
|
|
||||||
|
ASMJIT_FORCE_INLINE bool operator==(const FuncSignature& other) const noexcept { return equals(other); }
|
||||||
|
ASMJIT_FORCE_INLINE bool operator!=(const FuncSignature& other) const noexcept { return !equals(other); }
|
||||||
|
|
||||||
|
//! \}
|
||||||
|
|
||||||
|
//! \name Init & Reset
|
||||||
|
//! \{
|
||||||
|
|
||||||
ASMJIT_INLINE_NODEBUG void reset() noexcept { *this = FuncSignature{}; }
|
ASMJIT_INLINE_NODEBUG void reset() noexcept { *this = FuncSignature{}; }
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
|
|
||||||
|
//! \name Equality & Comparison
|
||||||
|
//! \{
|
||||||
|
|
||||||
|
ASMJIT_INLINE_NODEBUG bool equals(const FuncSignature& other) const noexcept {
|
||||||
|
return _ccId == other._ccId &&
|
||||||
|
_argCount == other._argCount &&
|
||||||
|
_vaIndex == other._vaIndex &&
|
||||||
|
_ret == other._ret &&
|
||||||
|
memcmp(_args, other._args, sizeof(_args)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \}
|
||||||
|
|
||||||
//! \name Accessors
|
//! \name Accessors
|
||||||
//! \{
|
//! \{
|
||||||
|
|
||||||
@@ -415,6 +459,55 @@ struct FuncSignature {
|
|||||||
//! Sets the calling convention to `ccId`;
|
//! Sets the calling convention to `ccId`;
|
||||||
ASMJIT_INLINE_NODEBUG void setCallConvId(CallConvId ccId) noexcept { _ccId = ccId; }
|
ASMJIT_INLINE_NODEBUG void setCallConvId(CallConvId ccId) noexcept { _ccId = ccId; }
|
||||||
|
|
||||||
|
//! Tests whether the function signature has a return value.
|
||||||
|
ASMJIT_INLINE_NODEBUG bool hasRet() const noexcept { return _ret != TypeId::kVoid; }
|
||||||
|
//! Returns the type of the return value.
|
||||||
|
ASMJIT_INLINE_NODEBUG TypeId ret() const noexcept { return _ret; }
|
||||||
|
//! Sets the return type to `retType`.
|
||||||
|
ASMJIT_INLINE_NODEBUG void setRet(TypeId retType) noexcept { _ret = retType; }
|
||||||
|
//! Sets the return type based on `T`.
|
||||||
|
template<typename T>
|
||||||
|
ASMJIT_INLINE_NODEBUG void setRetT() noexcept { setRet(TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
||||||
|
|
||||||
|
|
||||||
|
//! Returns the array of function arguments' types.
|
||||||
|
ASMJIT_INLINE_NODEBUG const TypeId* args() const noexcept { return _args; }
|
||||||
|
//! Returns the number of function arguments.
|
||||||
|
ASMJIT_INLINE_NODEBUG uint32_t argCount() const noexcept { return _argCount; }
|
||||||
|
|
||||||
|
//! Returns the type of the argument at index `i`.
|
||||||
|
inline TypeId arg(uint32_t i) const noexcept {
|
||||||
|
ASMJIT_ASSERT(i < _argCount);
|
||||||
|
return _args[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Sets the argument at index `index` to `argType`.
|
||||||
|
inline void setArg(uint32_t index, TypeId argType) noexcept {
|
||||||
|
ASMJIT_ASSERT(index < _argCount);
|
||||||
|
_args[index] = argType;
|
||||||
|
}
|
||||||
|
//! Sets the argument at index `i` to the type based on `T`.
|
||||||
|
template<typename T>
|
||||||
|
inline void setArgT(uint32_t index) noexcept { setArg(index, TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
||||||
|
|
||||||
|
//! Tests whether an argument can be added to the signature, use before calling \ref addArg() and \ref addArgT().
|
||||||
|
//!
|
||||||
|
//! \note If you know that you are not adding more arguments than \ref Globals::kMaxFuncArgs then it's not necessary
|
||||||
|
//! to use this function. However, if you are adding arguments based on user input, for example, then either check
|
||||||
|
//! the number of arguments before using function signature or use \ref canAddArg() before actually adding them to
|
||||||
|
//! the function signature.
|
||||||
|
inline bool canAddArg() const noexcept { return _argCount < Globals::kMaxFuncArgs; }
|
||||||
|
|
||||||
|
//! Appends an argument of `type` to the function prototype.
|
||||||
|
inline void addArg(TypeId type) noexcept {
|
||||||
|
ASMJIT_ASSERT(_argCount < Globals::kMaxFuncArgs);
|
||||||
|
_args[_argCount++] = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Appends an argument of type based on `T` to the function prototype.
|
||||||
|
template<typename T>
|
||||||
|
inline void addArgT() noexcept { addArg(TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
||||||
|
|
||||||
//! Tests whether the function has variable number of arguments (...).
|
//! Tests whether the function has variable number of arguments (...).
|
||||||
ASMJIT_INLINE_NODEBUG bool hasVarArgs() const noexcept { return _vaIndex != kNoVarArgs; }
|
ASMJIT_INLINE_NODEBUG bool hasVarArgs() const noexcept { return _vaIndex != kNoVarArgs; }
|
||||||
//! Returns the variable arguments (...) index, `kNoVarArgs` if none.
|
//! Returns the variable arguments (...) index, `kNoVarArgs` if none.
|
||||||
@@ -424,76 +517,20 @@ struct FuncSignature {
|
|||||||
//! Resets the variable arguments index (making it a non-va function).
|
//! Resets the variable arguments index (making it a non-va function).
|
||||||
ASMJIT_INLINE_NODEBUG void resetVaIndex() noexcept { _vaIndex = kNoVarArgs; }
|
ASMJIT_INLINE_NODEBUG void resetVaIndex() noexcept { _vaIndex = kNoVarArgs; }
|
||||||
|
|
||||||
//! Returns the number of function arguments.
|
|
||||||
ASMJIT_INLINE_NODEBUG uint32_t argCount() const noexcept { return _argCount; }
|
|
||||||
|
|
||||||
ASMJIT_INLINE_NODEBUG bool hasRet() const noexcept { return _ret != TypeId::kVoid; }
|
|
||||||
//! Returns the return value type.
|
|
||||||
ASMJIT_INLINE_NODEBUG TypeId ret() const noexcept { return _ret; }
|
|
||||||
|
|
||||||
//! Returns the type of the argument at index `i`.
|
|
||||||
inline TypeId arg(uint32_t i) const noexcept {
|
|
||||||
ASMJIT_ASSERT(i < _argCount);
|
|
||||||
return _args[i];
|
|
||||||
}
|
|
||||||
//! Returns the array of function arguments' types.
|
|
||||||
ASMJIT_INLINE_NODEBUG const TypeId* args() const noexcept { return _args; }
|
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... RET_ARGS>
|
#if !defined(ASMJIT_NO_DEPRECATED)
|
||||||
class FuncSignatureT : public FuncSignature {
|
template<typename... RetValueAndArgs>
|
||||||
|
class ASMJIT_DEPRECATED("Use FuncSignature::build<RetValueAndArgs>() instead") FuncSignatureT : public FuncSignature {
|
||||||
public:
|
public:
|
||||||
ASMJIT_INLINE_NODEBUG FuncSignatureT(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept {
|
ASMJIT_INLINE_NODEBUG constexpr FuncSignatureT(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept
|
||||||
static constexpr TypeId ret_args[] = { (TypeId(TypeUtils::TypeIdOfT<RET_ARGS>::kTypeId))... };
|
: FuncSignature(ccId, vaIndex, (TypeId(TypeUtils::TypeIdOfT<RetValueAndArgs>::kTypeId))... ) {}
|
||||||
init(ccId, vaIndex, ret_args[0], ret_args + 1, uint32_t(ASMJIT_ARRAY_SIZE(ret_args) - 1));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Function signature builder.
|
ASMJIT_DEPRECATED("Use FuncSignature instead of FuncSignatureBuilder")
|
||||||
class FuncSignatureBuilder : public FuncSignature {
|
typedef FuncSignature FuncSignatureBuilder;
|
||||||
public:
|
#endif // ASMJIT_NO_DEPRECATED
|
||||||
TypeId _builderArgList[Globals::kMaxFuncArgs];
|
|
||||||
|
|
||||||
//! \name Initialization & Reset
|
|
||||||
//! \{
|
|
||||||
|
|
||||||
ASMJIT_INLINE_NODEBUG FuncSignatureBuilder(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept {
|
|
||||||
init(ccId, vaIndex, TypeId::kVoid, _builderArgList, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \}
|
|
||||||
|
|
||||||
//! \name Accessors
|
|
||||||
//! \{
|
|
||||||
|
|
||||||
//! Sets the return type to `retType`.
|
|
||||||
ASMJIT_INLINE_NODEBUG void setRet(TypeId retType) noexcept { _ret = retType; }
|
|
||||||
//! Sets the return type based on `T`.
|
|
||||||
template<typename T>
|
|
||||||
ASMJIT_INLINE_NODEBUG void setRetT() noexcept { setRet(TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
|
||||||
|
|
||||||
//! Sets the argument at index `index` to `argType`.
|
|
||||||
inline void setArg(uint32_t index, TypeId argType) noexcept {
|
|
||||||
ASMJIT_ASSERT(index < _argCount);
|
|
||||||
_builderArgList[index] = argType;
|
|
||||||
}
|
|
||||||
//! Sets the argument at index `i` to the type based on `T`.
|
|
||||||
template<typename T>
|
|
||||||
inline void setArgT(uint32_t index) noexcept { setArg(index, TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
|
||||||
|
|
||||||
//! Appends an argument of `type` to the function prototype.
|
|
||||||
inline void addArg(TypeId type) noexcept {
|
|
||||||
ASMJIT_ASSERT(_argCount < Globals::kMaxFuncArgs);
|
|
||||||
_builderArgList[_argCount++] = type;
|
|
||||||
}
|
|
||||||
//! Appends an argument of type based on `T` to the function prototype.
|
|
||||||
template<typename T>
|
|
||||||
inline void addArgT() noexcept { addArg(TypeId(TypeUtils::TypeIdOfT<T>::kTypeId)); }
|
|
||||||
|
|
||||||
//! \}
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Argument or return value (or its part) as defined by `FuncSignature`, but with register or stack address
|
//! Argument or return value (or its part) as defined by `FuncSignature`, but with register or stack address
|
||||||
//! (and other metadata) assigned.
|
//! (and other metadata) assigned.
|
||||||
@@ -758,10 +795,8 @@ public:
|
|||||||
//! \name Constants
|
//! \name Constants
|
||||||
//! \{
|
//! \{
|
||||||
|
|
||||||
enum : uint8_t {
|
//! Function doesn't have a variable number of arguments (`...`).
|
||||||
//! Doesn't have variable number of arguments (`...`).
|
static constexpr uint8_t kNoVarArgs = 0xFFu;
|
||||||
kNoVarArgs = 0xFFu
|
|
||||||
};
|
|
||||||
|
|
||||||
//! \}
|
//! \}
|
||||||
|
|
||||||
|
|||||||
@@ -96,10 +96,9 @@ static constexpr uint32_t kMaxTreeHeight = (ASMJIT_ARCH_BITS == 32 ? 30 : 61) +
|
|||||||
static constexpr uint32_t kMaxOpCount = 6;
|
static constexpr uint32_t kMaxOpCount = 6;
|
||||||
|
|
||||||
//! Maximum arguments of a function supported by the Compiler / Function API.
|
//! Maximum arguments of a function supported by the Compiler / Function API.
|
||||||
static constexpr uint32_t kMaxFuncArgs = 16;
|
static constexpr uint32_t kMaxFuncArgs = 32;
|
||||||
|
|
||||||
//! The number of values that can be assigned to a single function argument or
|
//! The number of values that can be assigned to a single function argument or return value.
|
||||||
//! return value.
|
|
||||||
static constexpr uint32_t kMaxValuePack = 4;
|
static constexpr uint32_t kMaxValuePack = 4;
|
||||||
|
|
||||||
//! Maximum number of physical registers AsmJit can use per register group.
|
//! Maximum number of physical registers AsmJit can use per register group.
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//!
|
//!
|
||||||
//! // Create/initialize FuncDetail and FuncFrame.
|
//! // Create/initialize FuncDetail and FuncFrame.
|
||||||
//! FuncDetail func;
|
//! FuncDetail func;
|
||||||
//! func.init(FuncSignatureT<void, int*, const int*, const int*>(CallConvId::kHost));
|
//! func.init(FuncSignature::build<void, int*, const int*, const int*>(CallConvId::kHost));
|
||||||
//!
|
//!
|
||||||
//! FuncFrame frame;
|
//! FuncFrame frame;
|
||||||
//! frame.init(func);
|
//! frame.init(func);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//!
|
//!
|
||||||
//! // Create and initialize `FuncDetail`.
|
//! // Create and initialize `FuncDetail`.
|
||||||
//! FuncDetail func;
|
//! FuncDetail func;
|
||||||
//! func.init(FuncSignatureT<void, int*, const int*, const int*>(CallConvId::kHost));
|
//! func.init(FuncSignature::build<void, int*, const int*, const int*>(CallConvId::kHost));
|
||||||
//!
|
//!
|
||||||
//! // Remember prolog insertion point.
|
//! // Remember prolog insertion point.
|
||||||
//! BaseNode* prologInsertionPoint = cb.cursor();
|
//! BaseNode* prologInsertionPoint = cb.cursor();
|
||||||
|
|||||||
@@ -35,32 +35,32 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! typedef int (*Func)(void);
|
//! typedef int (*Func)(void);
|
||||||
//!
|
//!
|
||||||
//! int main() {
|
//! int main() {
|
||||||
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
||||||
//! CodeHolder code; // Holds code and relocation information.
|
//! CodeHolder code; // Holds code and relocation information.
|
||||||
//!
|
//!
|
||||||
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
||||||
//! rt.cpuFeatures());
|
//! rt.cpuFeatures());
|
||||||
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
||||||
//!
|
//!
|
||||||
//! cc.addFunc(FuncSignatureT<int>());// Begin a function of `int fn(void)` signature.
|
//! cc.addFunc(FuncSignature::build<int>()); // Begin a function of `int fn(void)` signature.
|
||||||
//!
|
//!
|
||||||
//! x86::Gp vReg = cc.newGpd(); // Create a 32-bit general purpose register.
|
//! x86::Gp vReg = cc.newGpd(); // Create a 32-bit general purpose register.
|
||||||
//! cc.mov(vReg, 1); // Move one to our virtual register `vReg`.
|
//! cc.mov(vReg, 1); // Move one to our virtual register `vReg`.
|
||||||
//! cc.ret(vReg); // Return `vReg` from the function.
|
//! cc.ret(vReg); // Return `vReg` from the function.
|
||||||
//!
|
//!
|
||||||
//! cc.endFunc(); // End of the function body.
|
//! cc.endFunc(); // End of the function body.
|
||||||
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
||||||
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! Func fn;
|
//! Func fn;
|
||||||
//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
|
//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
|
||||||
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
||||||
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! int result = fn(); // Execute the generated code.
|
//! int result = fn(); // Execute the generated code.
|
||||||
//! printf("%d\n", result); // Print the resulting "1".
|
//! printf("%d\n", result); // Print the resulting "1".
|
||||||
//!
|
//!
|
||||||
//! rt.release(fn); // Explicitly remove the function from the runtime.
|
//! rt.release(fn); // Explicitly remove the function from the runtime.
|
||||||
//! return 0;
|
//! return 0;
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
@@ -80,49 +80,49 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! typedef void (*MemCpy32)(uint32_t* dst, const uint32_t* src, size_t count);
|
//! typedef void (*MemCpy32)(uint32_t* dst, const uint32_t* src, size_t count);
|
||||||
//!
|
//!
|
||||||
//! int main() {
|
//! int main() {
|
||||||
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
||||||
//! CodeHolder code; // Holds code and relocation information.
|
//! CodeHolder code; // Holds code and relocation information.
|
||||||
//!
|
//!
|
||||||
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
||||||
//! rt.cpuFeatures());
|
//! rt.cpuFeatures());
|
||||||
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
||||||
//!
|
//!
|
||||||
//! FuncNode* funcNode = cc.addFunc( // Begin the function of the following signature:
|
//! FuncNode* funcNode = cc.addFunc ( // Begin the function of the following signature:
|
||||||
//! FuncSignatureT<void, // Return value - void (no return value).
|
//! FuncSignature::build<void, // Return value - void (no return value).
|
||||||
//! uint32_t*, // 1st argument - uint32_t* (machine reg-size).
|
//! uint32_t*, // 1st argument - uint32_t* (machine reg-size).
|
||||||
//! const uint32_t*, // 2nd argument - uint32_t* (machine reg-size).
|
//! const uint32_t*, // 2nd argument - uint32_t* (machine reg-size).
|
||||||
//! size_t>()); // 3rd argument - size_t (machine reg-size).
|
//! size_t>()); // 3rd argument - size_t (machine reg-size).
|
||||||
//!
|
//!
|
||||||
//! Label L_Loop = cc.newLabel(); // Start of the loop.
|
//! Label L_Loop = cc.newLabel(); // Start of the loop.
|
||||||
//! Label L_Exit = cc.newLabel(); // Used to exit early.
|
//! Label L_Exit = cc.newLabel(); // Used to exit early.
|
||||||
//!
|
//!
|
||||||
//! x86::Gp dst = cc.newIntPtr("dst");// Create `dst` register (destination pointer).
|
//! x86::Gp dst = cc.newIntPtr("dst"); // Create `dst` register (destination pointer).
|
||||||
//! x86::Gp src = cc.newIntPtr("src");// Create `src` register (source pointer).
|
//! x86::Gp src = cc.newIntPtr("src"); // Create `src` register (source pointer).
|
||||||
//! x86::Gp i = cc.newUIntPtr("i"); // Create `i` register (loop counter).
|
//! x86::Gp i = cc.newUIntPtr("i"); // Create `i` register (loop counter).
|
||||||
//!
|
//!
|
||||||
//! funcNode->setArg(0, dst); // Assign `dst` argument.
|
//! funcNode->setArg(0, dst); // Assign `dst` argument.
|
||||||
//! funcNode->setArg(1, src); // Assign `src` argument.
|
//! funcNode->setArg(1, src); // Assign `src` argument.
|
||||||
//! funcNode->setArg(2, i); // Assign `i` argument.
|
//! funcNode->setArg(2, i); // Assign `i` argument.
|
||||||
//!
|
//!
|
||||||
//! cc.test(i, i); // Early exit if length is zero.
|
//! cc.test(i, i); // Early exit if length is zero.
|
||||||
//! cc.jz(L_Exit);
|
//! cc.jz(L_Exit);
|
||||||
//!
|
//!
|
||||||
//! cc.bind(L_Loop); // Bind the beginning of the loop here.
|
//! cc.bind(L_Loop); // Bind the beginning of the loop here.
|
||||||
//!
|
//!
|
||||||
//! x86::Gp tmp = cc.newInt32("tmp"); // Copy a single dword (4 bytes).
|
//! x86::Gp tmp = cc.newInt32("tmp"); // Copy a single dword (4 bytes).
|
||||||
//! cc.mov(tmp, x86::dword_ptr(src)); // Load DWORD from [src] address.
|
//! cc.mov(tmp, x86::dword_ptr(src)); // Load DWORD from [src] address.
|
||||||
//! cc.mov(x86::dword_ptr(dst), tmp); // Store DWORD to [dst] address.
|
//! cc.mov(x86::dword_ptr(dst), tmp); // Store DWORD to [dst] address.
|
||||||
//!
|
//!
|
||||||
//! cc.add(src, 4); // Increment `src`.
|
//! cc.add(src, 4); // Increment `src`.
|
||||||
//! cc.add(dst, 4); // Increment `dst`.
|
//! cc.add(dst, 4); // Increment `dst`.
|
||||||
//!
|
//!
|
||||||
//! cc.dec(i); // Loop until `i` is non-zero.
|
//! cc.dec(i); // Loop until `i` is non-zero.
|
||||||
//! cc.jnz(L_Loop);
|
//! cc.jnz(L_Loop);
|
||||||
//!
|
//!
|
||||||
//! cc.bind(L_Exit); // Label used by early exit.
|
//! cc.bind(L_Exit); // Label used by early exit.
|
||||||
//! cc.endFunc(); // End of the function body.
|
//! cc.endFunc(); // End of the function body.
|
||||||
//!
|
//!
|
||||||
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
||||||
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! // Add the generated code to the runtime.
|
//! // Add the generated code to the runtime.
|
||||||
@@ -163,14 +163,14 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! typedef void (*Func)(void*);
|
//! typedef void (*Func)(void*);
|
||||||
//!
|
//!
|
||||||
//! int main() {
|
//! int main() {
|
||||||
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
||||||
//! CodeHolder code; // Holds code and relocation information.
|
//! CodeHolder code; // Holds code and relocation information.
|
||||||
//!
|
//!
|
||||||
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
||||||
//! rt.cpuFeatures());
|
//! rt.cpuFeatures());
|
||||||
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
||||||
//!
|
//!
|
||||||
//! FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*>());
|
//! FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*>());
|
||||||
//!
|
//!
|
||||||
//! // Use the following to enable AVX and/or AVX-512.
|
//! // Use the following to enable AVX and/or AVX-512.
|
||||||
//! funcNode->frame().setAvxEnabled();
|
//! funcNode->frame().setAvxEnabled();
|
||||||
@@ -186,13 +186,13 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! cc.vpaddq(vreg, vreg, vreg);
|
//! cc.vpaddq(vreg, vreg, vreg);
|
||||||
//! cc.vmovdqu32(x86::ptr(addr), vreg);
|
//! cc.vmovdqu32(x86::ptr(addr), vreg);
|
||||||
//!
|
//!
|
||||||
//! cc.endFunc(); // End of the function body.
|
//! cc.endFunc(); // End of the function body.
|
||||||
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
||||||
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! Func fn;
|
//! Func fn;
|
||||||
//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
|
//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
|
||||||
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
||||||
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! // Execute the generated code and print some output.
|
//! // Execute the generated code and print some output.
|
||||||
@@ -200,7 +200,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! fn(data);
|
//! fn(data);
|
||||||
//! printf("%llu\n", (unsigned long long)data[0]);
|
//! printf("%llu\n", (unsigned long long)data[0]);
|
||||||
//!
|
//!
|
||||||
//! rt.release(fn); // Explicitly remove the function from the runtime.
|
//! rt.release(fn); // Explicitly remove the function from the runtime.
|
||||||
//! return 0;
|
//! return 0;
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
@@ -222,48 +222,48 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! typedef uint32_t (*Fibonacci)(uint32_t x);
|
//! typedef uint32_t (*Fibonacci)(uint32_t x);
|
||||||
//!
|
//!
|
||||||
//! int main() {
|
//! int main() {
|
||||||
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
||||||
//! CodeHolder code; // Holds code and relocation information.
|
//! CodeHolder code; // Holds code and relocation information.
|
||||||
//!
|
//!
|
||||||
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
||||||
//! rt.cpuFeatures());
|
//! rt.cpuFeatures());
|
||||||
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
||||||
//!
|
//!
|
||||||
//! FuncNode* funcNode = cc.addFunc( // Begin of the Fibonacci function, addFunc()
|
//! FuncNode* funcNode = cc.addFunc( // Begin of the Fibonacci function, addFunc()
|
||||||
//! FuncSignatureT<int, int>()); // Returns a pointer to the FuncNode node.
|
//! FuncSignature::build<int, int>()); // Returns a pointer to the FuncNode node.
|
||||||
//!
|
//!
|
||||||
//! Label L_Exit = cc.newLabel() // Exit label.
|
//! Label L_Exit = cc.newLabel(); // Exit label.
|
||||||
//! x86::Gp x = cc.newUInt32(); // Function x argument.
|
//! x86::Gp x = cc.newUInt32(); // Function x argument.
|
||||||
//! x86::Gp y = cc.newUInt32(); // Temporary.
|
//! x86::Gp y = cc.newUInt32(); // Temporary.
|
||||||
//!
|
//!
|
||||||
//! funcNode->setArg(0, x);
|
//! funcNode->setArg(0, x);
|
||||||
//!
|
//!
|
||||||
//! cc.cmp(x, 3); // Return x if less than 3.
|
//! cc.cmp(x, 3); // Return x if less than 3.
|
||||||
//! cc.jb(L_Exit);
|
//! cc.jb(L_Exit);
|
||||||
//!
|
//!
|
||||||
//! cc.mov(y, x); // Make copy of the original x.
|
//! cc.mov(y, x); // Make copy of the original x.
|
||||||
//! cc.dec(x); // Decrease x.
|
//! cc.dec(x); // Decrease x.
|
||||||
//!
|
//!
|
||||||
//! InvokeNode* invokeNode; // Function invocation:
|
//! InvokeNode* invokeNode; // Function invocation:
|
||||||
//! cc.invoke(&invokeNode, // - InvokeNode (output).
|
//! cc.invoke(&invokeNode, // - InvokeNode (output).
|
||||||
//! funcNode->label(), // - Function address or Label.
|
//! funcNode->label(), // - Function address or Label.
|
||||||
//! FuncSignatureT<int, int>()); // - Function signature.
|
//! FuncSignature::build<int, int>()); // - Function signature.
|
||||||
//!
|
//!
|
||||||
//! invokeNode->setArg(0, x); // Assign x as the first argument.
|
//! invokeNode->setArg(0, x); // Assign x as the first argument.
|
||||||
//! invokeNode->setRet(0, x); // Assign x as a return value as well.
|
//! invokeNode->setRet(0, x); // Assign x as a return value as well.
|
||||||
//!
|
//!
|
||||||
//! cc.add(x, y); // Combine the return value with y.
|
//! cc.add(x, y); // Combine the return value with y.
|
||||||
//!
|
//!
|
||||||
//! cc.bind(L_Exit);
|
//! cc.bind(L_Exit);
|
||||||
//! cc.ret(x); // Return x.
|
//! cc.ret(x); // Return x.
|
||||||
//! cc.endFunc(); // End of the function body.
|
//! cc.endFunc(); // End of the function body.
|
||||||
//!
|
//!
|
||||||
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
||||||
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! Fibonacci fib;
|
//! Fibonacci fib;
|
||||||
//! Error err = rt.add(&fib, &code); // Add the generated code to the runtime.
|
//! Error err = rt.add(&fib, &code); // Add the generated code to the runtime.
|
||||||
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
||||||
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! // Test the generated code.
|
//! // Test the generated code.
|
||||||
@@ -291,14 +291,14 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! typedef int (*Func)(void);
|
//! typedef int (*Func)(void);
|
||||||
//!
|
//!
|
||||||
//! int main() {
|
//! int main() {
|
||||||
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
//! JitRuntime rt; // Runtime specialized for JIT code execution.
|
||||||
//! CodeHolder code; // Holds code and relocation information.
|
//! CodeHolder code; // Holds code and relocation information.
|
||||||
//!
|
//!
|
||||||
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
//! code.init(rt.environment(), // Initialize code to match the JIT environment.
|
||||||
//! rt.cpuFeatures());
|
//! rt.cpuFeatures());
|
||||||
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
//! x86::Compiler cc(&code); // Create and attach x86::Compiler to code.
|
||||||
//!
|
//!
|
||||||
//! cc.addFunc(FuncSignatureT<int>());// Create a function that returns int.
|
//! cc.addFunc(FuncSignature::build<int>()); // Create a function that returns int.
|
||||||
//!
|
//!
|
||||||
//! x86::Gp p = cc.newIntPtr("p");
|
//! x86::Gp p = cc.newIntPtr("p");
|
||||||
//! x86::Gp i = cc.newIntPtr("i");
|
//! x86::Gp i = cc.newIntPtr("i");
|
||||||
@@ -306,9 +306,9 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! // Allocate 256 bytes on the stack aligned to 4 bytes.
|
//! // Allocate 256 bytes on the stack aligned to 4 bytes.
|
||||||
//! x86::Mem stack = cc.newStack(256, 4);
|
//! x86::Mem stack = cc.newStack(256, 4);
|
||||||
//!
|
//!
|
||||||
//! x86::Mem stackIdx(stack); // Copy of stack with i added.
|
//! x86::Mem stackIdx(stack); // Copy of stack with i added.
|
||||||
//! stackIdx.setIndex(i); // stackIdx <- stack[i].
|
//! stackIdx.setIndex(i); // stackIdx <- stack[i].
|
||||||
//! stackIdx.setSize(1); // stackIdx <- byte ptr stack[i].
|
//! stackIdx.setSize(1); // stackIdx <- byte ptr stack[i].
|
||||||
//!
|
//!
|
||||||
//! // Load a stack address to `p`. This step is purely optional and shows
|
//! // Load a stack address to `p`. This step is purely optional and shows
|
||||||
//! // that `lea` is useful to load a memory operands address (even absolute)
|
//! // that `lea` is useful to load a memory operands address (even absolute)
|
||||||
@@ -321,12 +321,12 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! Label L1 = cc.newLabel();
|
//! Label L1 = cc.newLabel();
|
||||||
//! Label L2 = cc.newLabel();
|
//! Label L2 = cc.newLabel();
|
||||||
//!
|
//!
|
||||||
//! cc.bind(L1); // First loop, fill the stack.
|
//! cc.bind(L1); // First loop, fill the stack.
|
||||||
//! cc.mov(stackIdx, i.r8()); // stack[i] = uint8_t(i).
|
//! cc.mov(stackIdx, i.r8()); // stack[i] = uint8_t(i).
|
||||||
//!
|
//!
|
||||||
//! cc.inc(i); // i++;
|
//! cc.inc(i); // i++;
|
||||||
//! cc.cmp(i, 256); // if (i < 256)
|
//! cc.cmp(i, 256); // if (i < 256)
|
||||||
//! cc.jb(L1); // goto L1;
|
//! cc.jb(L1); // goto L1;
|
||||||
//!
|
//!
|
||||||
//! // Second loop, sum all bytes stored in `stack`.
|
//! // Second loop, sum all bytes stored in `stack`.
|
||||||
//! x86::Gp sum = cc.newInt32("sum");
|
//! x86::Gp sum = cc.newInt32("sum");
|
||||||
@@ -337,25 +337,25 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//!
|
//!
|
||||||
//! cc.bind(L2);
|
//! cc.bind(L2);
|
||||||
//!
|
//!
|
||||||
//! cc.movzx(val, stackIdx); // val = uint32_t(stack[i]);
|
//! cc.movzx(val, stackIdx); // val = uint32_t(stack[i]);
|
||||||
//! cc.add(sum, val); // sum += val;
|
//! cc.add(sum, val); // sum += val;
|
||||||
//!
|
//!
|
||||||
//! cc.inc(i); // i++;
|
//! cc.inc(i); // i++;
|
||||||
//! cc.cmp(i, 256); // if (i < 256)
|
//! cc.cmp(i, 256); // if (i < 256)
|
||||||
//! cc.jb(L2); // goto L2;
|
//! cc.jb(L2); // goto L2;
|
||||||
//!
|
//!
|
||||||
//! cc.ret(sum); // Return the `sum` of all values.
|
//! cc.ret(sum); // Return the `sum` of all values.
|
||||||
//! cc.endFunc(); // End of the function body.
|
//! cc.endFunc(); // End of the function body.
|
||||||
//!
|
//!
|
||||||
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
//! cc.finalize(); // Translate and assemble the whole 'cc' content.
|
||||||
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
//! // ----> x86::Compiler is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! Func func;
|
//! Func func;
|
||||||
//! Error err = rt.add(&func, &code); // Add the generated code to the runtime.
|
//! Error err = rt.add(&func, &code); // Add the generated code to the runtime.
|
||||||
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
//! if (err) return 1; // Handle a possible error returned by AsmJit.
|
||||||
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
//! // ----> CodeHolder is no longer needed from here and can be destroyed <----
|
||||||
//!
|
//!
|
||||||
//! printf("Func() -> %d\n", func()); // Test the generated code.
|
//! printf("Func() -> %d\n", func()); // Test the generated code.
|
||||||
//!
|
//!
|
||||||
//! rt.release(func);
|
//! rt.release(func);
|
||||||
//! return 0;
|
//! return 0;
|
||||||
@@ -380,7 +380,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! using namespace asmjit;
|
//! using namespace asmjit;
|
||||||
//!
|
//!
|
||||||
//! static void exampleUseOfConstPool(x86::Compiler& cc) {
|
//! static void exampleUseOfConstPool(x86::Compiler& cc) {
|
||||||
//! cc.addFunc(FuncSignatureT<int>());
|
//! cc.addFunc(FuncSignature::build<int>());
|
||||||
//!
|
//!
|
||||||
//! x86::Gp v0 = cc.newGpd("v0");
|
//! x86::Gp v0 = cc.newGpd("v0");
|
||||||
//! x86::Gp v1 = cc.newGpd("v1");
|
//! x86::Gp v1 = cc.newGpd("v1");
|
||||||
@@ -414,7 +414,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86)
|
|||||||
//! using namespace asmjit;
|
//! using namespace asmjit;
|
||||||
//!
|
//!
|
||||||
//! static void exampleUseOfIndirectJump(x86::Compiler& cc) {
|
//! static void exampleUseOfIndirectJump(x86::Compiler& cc) {
|
||||||
//! FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float, uint32_t>(CallConvId::kHost));
|
//! FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float, uint32_t>(CallConvId::kHost));
|
||||||
//!
|
//!
|
||||||
//! // Function arguments
|
//! // Function arguments
|
||||||
//! x86::Xmm a = cc.newXmmSs("a");
|
//! x86::Xmm a = cc.newXmmSs("a");
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t argCount = _argCount;
|
uint32_t argCount = _argCount;
|
||||||
|
|
||||||
FuncSignatureBuilder signature;
|
FuncSignature signature;
|
||||||
signature.setRetT<int>();
|
signature.setRetT<int>();
|
||||||
for (i = 0; i < argCount; i++)
|
for (i = 0; i < argCount; i++)
|
||||||
signature.addArgT<int>();
|
signature.addArgT<int>();
|
||||||
@@ -201,7 +201,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, const void*, const void*>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, const void*, const void*>());
|
||||||
|
|
||||||
a64::Gp dst = cc.newUIntPtr("dst");
|
a64::Gp dst = cc.newUIntPtr("dst");
|
||||||
a64::Gp src1 = cc.newUIntPtr("src1");
|
a64::Gp src1 = cc.newUIntPtr("src1");
|
||||||
@@ -261,7 +261,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>());
|
cc.addFunc(FuncSignature::build<int>());
|
||||||
|
|
||||||
a64::Gp* regs = static_cast<a64::Gp*>(malloc(_regCount * sizeof(a64::Gp)));
|
a64::Gp* regs = static_cast<a64::Gp*>(malloc(_regCount * sizeof(a64::Gp)));
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>());
|
cc.addFunc(FuncSignature::build<int>());
|
||||||
|
|
||||||
a64::Gp addr = cc.newIntPtr("addr");
|
a64::Gp addr = cc.newIntPtr("addr");
|
||||||
a64::Gp val = cc.newIntPtr("val");
|
a64::Gp val = cc.newIntPtr("val");
|
||||||
@@ -355,7 +355,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, size_t>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, size_t>());
|
||||||
|
|
||||||
a64::Gp p = cc.newIntPtr("p");
|
a64::Gp p = cc.newIntPtr("p");
|
||||||
a64::Gp count = cc.newIntPtr("count");
|
a64::Gp count = cc.newIntPtr("count");
|
||||||
@@ -410,7 +410,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint32_t, uint32_t, uint32_t>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint32_t, uint32_t, uint32_t>());
|
||||||
|
|
||||||
a64::Gp x = cc.newUInt32("x");
|
a64::Gp x = cc.newUInt32("x");
|
||||||
a64::Gp y = cc.newUInt32("y");
|
a64::Gp y = cc.newUInt32("y");
|
||||||
@@ -423,7 +423,7 @@ public:
|
|||||||
cc.mov(fn, (uint64_t)calledFunc);
|
cc.mov(fn, (uint64_t)calledFunc);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, fn, FuncSignatureT<uint32_t, uint32_t, uint32_t>(CallConvId::kHost));
|
cc.invoke(&invokeNode, fn, FuncSignature::build<uint32_t, uint32_t, uint32_t>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, x);
|
invokeNode->setArg(0, x);
|
||||||
invokeNode->setArg(1, y);
|
invokeNode->setArg(1, y);
|
||||||
invokeNode->setRet(0, r);
|
invokeNode->setRet(0, r);
|
||||||
@@ -463,7 +463,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>());
|
||||||
|
|
||||||
a64::Vec x = cc.newVecD("x");
|
a64::Vec x = cc.newVecD("x");
|
||||||
a64::Vec y = cc.newVecD("y");
|
a64::Vec y = cc.newVecD("y");
|
||||||
@@ -475,7 +475,7 @@ public:
|
|||||||
cc.mov(fn, (uint64_t)calledFunc);
|
cc.mov(fn, (uint64_t)calledFunc);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, fn, FuncSignatureT<double, double, double>(CallConvId::kHost));
|
cc.invoke(&invokeNode, fn, FuncSignature::build<double, double, double>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, x);
|
invokeNode->setArg(0, x);
|
||||||
invokeNode->setArg(1, y);
|
invokeNode->setArg(1, y);
|
||||||
invokeNode->setRet(0, r);
|
invokeNode->setRet(0, r);
|
||||||
@@ -515,7 +515,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>());
|
||||||
|
|
||||||
a64::Vec x = cc.newVecD("x");
|
a64::Vec x = cc.newVecD("x");
|
||||||
a64::Vec y = cc.newVecD("y");
|
a64::Vec y = cc.newVecD("y");
|
||||||
@@ -527,7 +527,7 @@ public:
|
|||||||
cc.mov(fn, (uint64_t)calledFunc);
|
cc.mov(fn, (uint64_t)calledFunc);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, fn, FuncSignatureT<double, double, double>(CallConvId::kHost));
|
cc.invoke(&invokeNode, fn, FuncSignature::build<double, double, double>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, y);
|
invokeNode->setArg(0, y);
|
||||||
invokeNode->setArg(1, x);
|
invokeNode->setArg(1, x);
|
||||||
invokeNode->setRet(0, r);
|
invokeNode->setRet(0, r);
|
||||||
@@ -580,7 +580,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(a64::Compiler& cc) {
|
virtual void compile(a64::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float, uint32_t>());
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float, uint32_t>());
|
||||||
|
|
||||||
a64::Vec a = cc.newVecS("a");
|
a64::Vec a = cc.newVecS("a");
|
||||||
a64::Vec b = cc.newVecS("b");
|
a64::Vec b = cc.newVecS("b");
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t argCount = _argCount;
|
uint32_t argCount = _argCount;
|
||||||
|
|
||||||
FuncSignatureBuilder signature(CallConvId::kHost);
|
FuncSignature signature(CallConvId::kHost);
|
||||||
signature.setRetT<int>();
|
signature.setRetT<int>();
|
||||||
for (i = 0; i < argCount; i++)
|
for (i = 0; i < argCount; i++)
|
||||||
signature.addArgT<int>();
|
signature.addArgT<int>();
|
||||||
@@ -223,7 +223,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
cc.align(AlignMode::kCode, 0);
|
cc.align(AlignMode::kCode, 0);
|
||||||
cc.align(AlignMode::kCode, 1);
|
cc.align(AlignMode::kCode, 1);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
@@ -279,7 +279,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* func = cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
FuncNode* func = cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
func->addAttributes(FuncAttributes::kIndirectBranchProtection);
|
func->addAttributes(FuncAttributes::kIndirectBranchProtection);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,7 @@ public:
|
|||||||
x86::Gp dst = cc.newIntPtr("dst");
|
x86::Gp dst = cc.newIntPtr("dst");
|
||||||
x86::Gp val = cc.newInt32("val");
|
x86::Gp val = cc.newInt32("val");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int*, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int*, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, val);
|
funcNode->setArg(1, val);
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
|
|
||||||
Label L1 = cc.newLabel();
|
Label L1 = cc.newLabel();
|
||||||
Label L2 = cc.newLabel();
|
Label L2 = cc.newLabel();
|
||||||
@@ -413,7 +413,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
for (uint32_t i = 0; i < 1000; i++) {
|
for (uint32_t i = 0; i < 1000; i++) {
|
||||||
Label L = cc.newLabel();
|
Label L = cc.newLabel();
|
||||||
cc.jmp(L);
|
cc.jmp(L);
|
||||||
@@ -453,7 +453,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
|
|
||||||
Label L_1 = cc.newLabel();
|
Label L_1 = cc.newLabel();
|
||||||
Label L_2 = cc.newLabel();
|
Label L_2 = cc.newLabel();
|
||||||
@@ -515,7 +515,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
|
|
||||||
Label L_1 = cc.newLabel();
|
Label L_1 = cc.newLabel();
|
||||||
Label L_2 = cc.newLabel();
|
Label L_2 = cc.newLabel();
|
||||||
@@ -588,7 +588,7 @@ public:
|
|||||||
Label L_Div = cc.newLabel();
|
Label L_Div = cc.newLabel();
|
||||||
Label L_End = cc.newLabel();
|
Label L_End = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float, uint32_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float, uint32_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, a);
|
funcNode->setArg(0, a);
|
||||||
funcNode->setArg(1, b);
|
funcNode->setArg(1, b);
|
||||||
funcNode->setArg(2, op);
|
funcNode->setArg(2, op);
|
||||||
@@ -689,7 +689,7 @@ public:
|
|||||||
Label L_Case1 = cc.newLabel();
|
Label L_Case1 = cc.newLabel();
|
||||||
Label L_End = cc.newLabel();
|
Label L_End = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, value);
|
funcNode->setArg(0, value);
|
||||||
|
|
||||||
cc.bind(L_Begin);
|
cc.bind(L_Begin);
|
||||||
@@ -759,7 +759,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
Label L_Target = cc.newLabel();
|
Label L_Target = cc.newLabel();
|
||||||
x86::Gp target = cc.newUIntPtr("target");
|
x86::Gp target = cc.newUIntPtr("target");
|
||||||
@@ -807,7 +807,7 @@ public:
|
|||||||
x86::Gp result = cc.newUInt32("result");
|
x86::Gp result = cc.newUInt32("result");
|
||||||
x86::Gp condition = cc.newUInt32("condition");
|
x86::Gp condition = cc.newUInt32("condition");
|
||||||
|
|
||||||
FuncNode* func = cc.addFunc(FuncSignatureT<int, int>(CallConvId::kHost));
|
FuncNode* func = cc.addFunc(FuncSignature::build<int, int>(CallConvId::kHost));
|
||||||
func->setArg(0, condition);
|
func->setArg(0, condition);
|
||||||
|
|
||||||
Label L_NonZero = cc.newLabel();
|
Label L_NonZero = cc.newLabel();
|
||||||
@@ -878,7 +878,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp v0 = cc.newInt32("v0");
|
x86::Gp v0 = cc.newInt32("v0");
|
||||||
x86::Gp v1 = cc.newInt32("v1");
|
x86::Gp v1 = cc.newInt32("v1");
|
||||||
@@ -933,7 +933,7 @@ public:
|
|||||||
x86::Gp a0 = cc.newIntPtr("a0");
|
x86::Gp a0 = cc.newIntPtr("a0");
|
||||||
x86::Gp a1 = cc.newIntPtr("a1");
|
x86::Gp a1 = cc.newIntPtr("a1");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int*, int*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int*, int*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, a0);
|
funcNode->setArg(0, a0);
|
||||||
funcNode->setArg(1, a1);
|
funcNode->setArg(1, a1);
|
||||||
|
|
||||||
@@ -1001,7 +1001,7 @@ public:
|
|||||||
x86::Gp a = cc.newIntPtr("a");
|
x86::Gp a = cc.newIntPtr("a");
|
||||||
x86::Gp v[32];
|
x86::Gp v[32];
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, uint32_t*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, uint32_t*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, a);
|
funcNode->setArg(0, a);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ASMJIT_ARRAY_SIZE(v); i++) v[i] = cc.newInt32("v%d", i);
|
for (uint32_t i = 0; i < ASMJIT_ARRAY_SIZE(v); i++) v[i] = cc.newInt32("v%d", i);
|
||||||
@@ -1066,7 +1066,7 @@ public:
|
|||||||
x86::Gp vLo = cc.newInt32("vLo");
|
x86::Gp vLo = cc.newInt32("vLo");
|
||||||
x86::Gp src = cc.newInt32("src");
|
x86::Gp src = cc.newInt32("src");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int*, int*, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int*, int*, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dstHi);
|
funcNode->setArg(0, dstHi);
|
||||||
funcNode->setArg(1, dstLo);
|
funcNode->setArg(1, dstLo);
|
||||||
funcNode->setArg(2, vLo);
|
funcNode->setArg(2, vLo);
|
||||||
@@ -1115,7 +1115,7 @@ public:
|
|||||||
x86::Gp dst = cc.newIntPtr("dst");
|
x86::Gp dst = cc.newIntPtr("dst");
|
||||||
x86::Gp src = cc.newIntPtr("src");
|
x86::Gp src = cc.newIntPtr("src");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int*, const int*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int*, const int*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, src);
|
funcNode->setArg(1, src);
|
||||||
|
|
||||||
@@ -1168,7 +1168,7 @@ public:
|
|||||||
x86::Gp b = cc.newInt32("b");
|
x86::Gp b = cc.newInt32("b");
|
||||||
x86::Gp dummy = cc.newInt32("dummy");
|
x86::Gp dummy = cc.newInt32("dummy");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, a);
|
funcNode->setArg(0, a);
|
||||||
funcNode->setArg(1, b);
|
funcNode->setArg(1, b);
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ public:
|
|||||||
x86::Gp src1 = cc.newInt32("src1");
|
x86::Gp src1 = cc.newInt32("src1");
|
||||||
x86::Gp dst0 = cc.newIntPtr("dst0");
|
x86::Gp dst0 = cc.newIntPtr("dst0");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int, int, char*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int, int, char*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, src0);
|
funcNode->setArg(0, src0);
|
||||||
funcNode->setArg(1, src1);
|
funcNode->setArg(1, src1);
|
||||||
funcNode->setArg(2, dst0);
|
funcNode->setArg(2, dst0);
|
||||||
@@ -1262,7 +1262,7 @@ public:
|
|||||||
x86::Gp vShlParam = cc.newInt32("vShlParam");
|
x86::Gp vShlParam = cc.newInt32("vShlParam");
|
||||||
x86::Gp vRorParam = cc.newInt32("vRorParam");
|
x86::Gp vRorParam = cc.newInt32("vRorParam");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, int*, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, int*, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, var);
|
funcNode->setArg(1, var);
|
||||||
funcNode->setArg(2, vShlParam);
|
funcNode->setArg(2, vShlParam);
|
||||||
@@ -1310,7 +1310,7 @@ public:
|
|||||||
x86::Gp rSum = cc.newUInt32("rSum");
|
x86::Gp rSum = cc.newUInt32("rSum");
|
||||||
x86::Gp x[kCount];
|
x86::Gp x[kCount];
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint32_t, uint32_t*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint32_t, uint32_t*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, rPtr);
|
funcNode->setArg(0, rPtr);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < kCount; i++) {
|
for (uint32_t i = 0; i < kCount; i++) {
|
||||||
@@ -1391,7 +1391,7 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
x86::Gp v = cc.newUInt32("v");
|
x86::Gp v = cc.newUInt32("v");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint32_t, uint32_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint32_t, uint32_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v);
|
funcNode->setArg(0, v);
|
||||||
|
|
||||||
cc.mov(v.r8(), 0xFF);
|
cc.mov(v.r8(), 0xFF);
|
||||||
@@ -1429,7 +1429,7 @@ public:
|
|||||||
x86::Gp src = cc.newIntPtr("src");
|
x86::Gp src = cc.newIntPtr("src");
|
||||||
x86::Gp cnt = cc.newIntPtr("cnt");
|
x86::Gp cnt = cc.newIntPtr("cnt");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, void*, size_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, void*, size_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, src);
|
funcNode->setArg(1, src);
|
||||||
funcNode->setArg(2, cnt);
|
funcNode->setArg(2, cnt);
|
||||||
@@ -1471,7 +1471,7 @@ public:
|
|||||||
Label L_1 = cc.newLabel();
|
Label L_1 = cc.newLabel();
|
||||||
Label L_2 = cc.newLabel();
|
Label L_2 = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v1);
|
funcNode->setArg(0, v1);
|
||||||
funcNode->setArg(1, v2);
|
funcNode->setArg(1, v2);
|
||||||
|
|
||||||
@@ -1523,7 +1523,7 @@ public:
|
|||||||
Label L_3 = cc.newLabel();
|
Label L_3 = cc.newLabel();
|
||||||
Label L_4 = cc.newLabel();
|
Label L_4 = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v1);
|
funcNode->setArg(0, v1);
|
||||||
funcNode->setArg(1, v2);
|
funcNode->setArg(1, v2);
|
||||||
|
|
||||||
@@ -1582,7 +1582,7 @@ public:
|
|||||||
Label L_Loop = cc.newLabel();
|
Label L_Loop = cc.newLabel();
|
||||||
Label L_Exit = cc.newLabel();
|
Label L_Exit = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v1);
|
funcNode->setArg(0, v1);
|
||||||
funcNode->setArg(1, v2);
|
funcNode->setArg(1, v2);
|
||||||
|
|
||||||
@@ -1642,7 +1642,7 @@ public:
|
|||||||
Label L_Loop2 = cc.newLabel();
|
Label L_Loop2 = cc.newLabel();
|
||||||
Label L_Exit = cc.newLabel();
|
Label L_Exit = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v1);
|
funcNode->setArg(0, v1);
|
||||||
funcNode->setArg(1, v2);
|
funcNode->setArg(1, v2);
|
||||||
|
|
||||||
@@ -1699,7 +1699,7 @@ public:
|
|||||||
x86::Gp x = cc.newInt8("x");
|
x86::Gp x = cc.newInt8("x");
|
||||||
x86::Gp y = cc.newInt32("y");
|
x86::Gp y = cc.newInt32("y");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int8_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int8_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
|
|
||||||
cc.movsx(y, x);
|
cc.movsx(y, x);
|
||||||
@@ -1736,7 +1736,7 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
x86::Gp x = cc.newInt32("x");
|
x86::Gp x = cc.newInt32("x");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(2, x);
|
funcNode->setArg(2, x);
|
||||||
|
|
||||||
cc.ret(x);
|
cc.ret(x);
|
||||||
@@ -1769,7 +1769,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, void*, void*, void*, void*, void*, void*, void*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, void*, void*, void*, void*, void*, void*, void*>(CallConvId::kHost));
|
||||||
x86::Gp var[8];
|
x86::Gp var[8];
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 8; i++) {
|
for (uint32_t i = 0; i < 8; i++) {
|
||||||
@@ -1825,7 +1825,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, float, float, float, float, float, float, float, void*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, float, float, float, float, float, float, float, void*>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp p = cc.newIntPtr("p");
|
x86::Gp p = cc.newIntPtr("p");
|
||||||
x86::Xmm xv[7];
|
x86::Xmm xv[7];
|
||||||
@@ -1876,7 +1876,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, double, double, double, double, double, double, double, void*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, double, double, double, double, double, double, double, void*>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp p = cc.newIntPtr("p");
|
x86::Gp p = cc.newIntPtr("p");
|
||||||
x86::Xmm xv[7];
|
x86::Xmm xv[7];
|
||||||
@@ -1936,7 +1936,7 @@ public:
|
|||||||
x86::Xmm a = cc.newXmm("aXmm");
|
x86::Xmm a = cc.newXmm("aXmm");
|
||||||
x86::Xmm b = cc.newXmm("bXmm");
|
x86::Xmm b = cc.newXmm("bXmm");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<x86::Xmm, x86::Xmm, x86::Xmm>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<x86::Xmm, x86::Xmm, x86::Xmm>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, a);
|
funcNode->setArg(0, a);
|
||||||
funcNode->setArg(1, b);
|
funcNode->setArg(1, b);
|
||||||
|
|
||||||
@@ -1984,7 +1984,7 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
x86::Xmm x = cc.newXmmSs("x");
|
x86::Xmm x = cc.newXmmSs("x");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
|
|
||||||
cc.ret(x);
|
cc.ret(x);
|
||||||
@@ -2020,7 +2020,7 @@ public:
|
|||||||
x86::Xmm x = cc.newXmmSs("x");
|
x86::Xmm x = cc.newXmmSs("x");
|
||||||
x86::Xmm y = cc.newXmmSs("y");
|
x86::Xmm y = cc.newXmmSs("y");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
funcNode->setArg(1, y);
|
funcNode->setArg(1, y);
|
||||||
|
|
||||||
@@ -2058,7 +2058,7 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
x86::Xmm x = cc.newXmmSd("x");
|
x86::Xmm x = cc.newXmmSd("x");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
|
|
||||||
cc.ret(x);
|
cc.ret(x);
|
||||||
@@ -2094,7 +2094,7 @@ public:
|
|||||||
x86::Xmm x = cc.newXmmSd("x");
|
x86::Xmm x = cc.newXmmSd("x");
|
||||||
x86::Xmm y = cc.newXmmSd("y");
|
x86::Xmm y = cc.newXmmSd("y");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
funcNode->setArg(1, y);
|
funcNode->setArg(1, y);
|
||||||
|
|
||||||
@@ -2132,7 +2132,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Mem stack = cc.newStack(kSize, 1);
|
x86::Mem stack = cc.newStack(kSize, 1);
|
||||||
stack.setSize(1);
|
stack.setSize(1);
|
||||||
@@ -2206,7 +2206,7 @@ public:
|
|||||||
Label L_Loop = cc.newLabel(); // Create base labels we use
|
Label L_Loop = cc.newLabel(); // Create base labels we use
|
||||||
Label L_Exit = cc.newLabel(); // in our function.
|
Label L_Exit = cc.newLabel(); // in our function.
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, uint32_t*, const uint32_t*, size_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, uint32_t*, const uint32_t*, size_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, src);
|
funcNode->setArg(1, src);
|
||||||
funcNode->setArg(2, cnt);
|
funcNode->setArg(2, cnt);
|
||||||
@@ -2283,7 +2283,7 @@ public:
|
|||||||
x86::Gp a = cc.newInt32("a");
|
x86::Gp a = cc.newInt32("a");
|
||||||
x86::Gp b = cc.newInt32("b");
|
x86::Gp b = cc.newInt32("b");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, cond);
|
funcNode->setArg(0, cond);
|
||||||
funcNode->setArg(1, a);
|
funcNode->setArg(1, a);
|
||||||
funcNode->setArg(2, b);
|
funcNode->setArg(2, b);
|
||||||
@@ -2422,7 +2422,7 @@ public:
|
|||||||
x86::Gp v1 = cc.newInt32("v1");
|
x86::Gp v1 = cc.newInt32("v1");
|
||||||
x86::Gp v2 = cc.newInt32("v2");
|
x86::Gp v2 = cc.newInt32("v2");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, v0);
|
funcNode->setArg(0, v0);
|
||||||
funcNode->setArg(1, v1);
|
funcNode->setArg(1, v1);
|
||||||
funcNode->setArg(2, v2);
|
funcNode->setArg(2, v2);
|
||||||
@@ -2434,7 +2434,7 @@ public:
|
|||||||
|
|
||||||
// Call a function.
|
// Call a function.
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, v2);
|
invokeNode->setArg(0, v2);
|
||||||
invokeNode->setArg(1, v1);
|
invokeNode->setArg(1, v1);
|
||||||
invokeNode->setArg(2, v0);
|
invokeNode->setArg(2, v0);
|
||||||
@@ -2474,7 +2474,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
const int kTokenSize = 32;
|
const int kTokenSize = 32;
|
||||||
|
|
||||||
@@ -2494,19 +2494,19 @@ public:
|
|||||||
cc.lea(p2, s2);
|
cc.lea(p2, s2);
|
||||||
|
|
||||||
// Try to corrupt the stack if wrongly allocated.
|
// Try to corrupt the stack if wrongly allocated.
|
||||||
cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignatureT<void*, void*, void*, size_t>(CallConvId::kCDecl));
|
cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignature::build<void*, void*, void*, size_t>(CallConvId::kCDecl));
|
||||||
invokeNode->setArg(0, p1);
|
invokeNode->setArg(0, p1);
|
||||||
invokeNode->setArg(1, imm(token));
|
invokeNode->setArg(1, imm(token));
|
||||||
invokeNode->setArg(2, imm(kTokenSize));
|
invokeNode->setArg(2, imm(kTokenSize));
|
||||||
invokeNode->setRet(0, p1);
|
invokeNode->setRet(0, p1);
|
||||||
|
|
||||||
cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignatureT<void*, void*, void*, size_t>(CallConvId::kCDecl));
|
cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignature::build<void*, void*, void*, size_t>(CallConvId::kCDecl));
|
||||||
invokeNode->setArg(0, p2);
|
invokeNode->setArg(0, p2);
|
||||||
invokeNode->setArg(1, imm(token));
|
invokeNode->setArg(1, imm(token));
|
||||||
invokeNode->setArg(2, imm(kTokenSize));
|
invokeNode->setArg(2, imm(kTokenSize));
|
||||||
invokeNode->setRet(0, p2);
|
invokeNode->setRet(0, p2);
|
||||||
|
|
||||||
cc.invoke(&invokeNode, imm((void*)memcmp), FuncSignatureT<int, void*, void*, size_t>(CallConvId::kCDecl));
|
cc.invoke(&invokeNode, imm((void*)memcmp), FuncSignature::build<int, void*, void*, size_t>(CallConvId::kCDecl));
|
||||||
invokeNode->setArg(0, p1);
|
invokeNode->setArg(0, p1);
|
||||||
invokeNode->setArg(1, p2);
|
invokeNode->setArg(1, p2);
|
||||||
invokeNode->setArg(2, imm(kTokenSize));
|
invokeNode->setArg(2, imm(kTokenSize));
|
||||||
@@ -2557,7 +2557,7 @@ public:
|
|||||||
x86::Gp y = cc.newInt32("y");
|
x86::Gp y = cc.newInt32("y");
|
||||||
x86::Gp z = cc.newInt32("z");
|
x86::Gp z = cc.newInt32("z");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
funcNode->setArg(1, y);
|
funcNode->setArg(1, y);
|
||||||
funcNode->setArg(2, z);
|
funcNode->setArg(2, z);
|
||||||
@@ -2565,7 +2565,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, int, int, int>(CallConvId::kStdCall));
|
FuncSignature::build<int, int, int, int>(CallConvId::kStdCall));
|
||||||
invokeNode->setArg(0, x);
|
invokeNode->setArg(0, x);
|
||||||
invokeNode->setArg(1, y);
|
invokeNode->setArg(1, y);
|
||||||
invokeNode->setArg(2, z);
|
invokeNode->setArg(2, z);
|
||||||
@@ -2608,16 +2608,16 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
x86::Gp var = cc.newInt32("var");
|
x86::Gp var = cc.newInt32("var");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, var);
|
funcNode->setArg(0, var);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
|
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<int, int>(CallConvId::kFastCall));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<int, int>(CallConvId::kFastCall));
|
||||||
invokeNode->setArg(0, var);
|
invokeNode->setArg(0, var);
|
||||||
invokeNode->setRet(0, var);
|
invokeNode->setRet(0, var);
|
||||||
|
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<int, int>(CallConvId::kFastCall));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<int, int>(CallConvId::kFastCall));
|
||||||
invokeNode->setArg(0, var);
|
invokeNode->setArg(0, var);
|
||||||
invokeNode->setRet(0, var);
|
invokeNode->setRet(0, var);
|
||||||
|
|
||||||
@@ -2666,7 +2666,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, const void*, const void*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, const void*, const void*>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp resultPtr = cc.newIntPtr("resultPtr");
|
x86::Gp resultPtr = cc.newIntPtr("resultPtr");
|
||||||
x86::Gp aPtr = cc.newIntPtr("aPtr");
|
x86::Gp aPtr = cc.newIntPtr("aPtr");
|
||||||
@@ -2695,7 +2695,7 @@ public:
|
|||||||
cc.movdqu(bXmm, x86::ptr(bPtr));
|
cc.movdqu(bXmm, x86::ptr(bPtr));
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, pFn, FuncSignatureT<x86::Xmm, x86::Xmm, x86::Xmm>(ccId));
|
cc.invoke(&invokeNode, pFn, FuncSignature::build<x86::Xmm, x86::Xmm, x86::Xmm>(ccId));
|
||||||
|
|
||||||
invokeNode->setArg(0, aXmm);
|
invokeNode->setArg(0, aXmm);
|
||||||
invokeNode->setArg(1, bXmm);
|
invokeNode->setArg(1, bXmm);
|
||||||
@@ -2748,8 +2748,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncSignatureT<void, const void*, const void*, const void*, const void*, void*> f1Sig(CallConvId::kCDecl);
|
FuncSignature f1Sig = FuncSignature::build<void, const void*, const void*, const void*, const void*, void*>(CallConvId::kCDecl);
|
||||||
FuncSignatureT<x86::Xmm, x86::Xmm, x86::Xmm> f2Sig(CallConvId::kLightCall2);
|
FuncSignature f2Sig = FuncSignature::build<x86::Xmm, x86::Xmm, x86::Xmm>(CallConvId::kLightCall2);
|
||||||
|
|
||||||
FuncNode* f1Node = cc.newFunc(f1Sig);
|
FuncNode* f1Node = cc.newFunc(f1Sig);
|
||||||
FuncNode* f2Node = cc.newFunc(f2Sig);
|
FuncNode* f2Node = cc.newFunc(f2Sig);
|
||||||
@@ -2850,7 +2850,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
// Prepare.
|
// Prepare.
|
||||||
x86::Gp va = cc.newInt32("va");
|
x86::Gp va = cc.newInt32("va");
|
||||||
@@ -2879,7 +2879,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
FuncSignature::build<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, va);
|
invokeNode->setArg(0, va);
|
||||||
invokeNode->setArg(1, vb);
|
invokeNode->setArg(1, vb);
|
||||||
invokeNode->setArg(2, vc);
|
invokeNode->setArg(2, vc);
|
||||||
@@ -2926,7 +2926,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
// Prepare.
|
// Prepare.
|
||||||
x86::Gp a = cc.newInt32("a");
|
x86::Gp a = cc.newInt32("a");
|
||||||
@@ -2936,7 +2936,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
FuncSignature::build<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, a);
|
invokeNode->setArg(0, a);
|
||||||
invokeNode->setArg(1, a);
|
invokeNode->setArg(1, a);
|
||||||
invokeNode->setArg(2, a);
|
invokeNode->setArg(2, a);
|
||||||
@@ -2979,7 +2979,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
// Prepare.
|
// Prepare.
|
||||||
x86::Gp rv = cc.newInt32("rv");
|
x86::Gp rv = cc.newInt32("rv");
|
||||||
@@ -2988,7 +2988,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)X86Test_FuncCallManyArgs::calledFunc),
|
imm((void*)X86Test_FuncCallManyArgs::calledFunc),
|
||||||
FuncSignatureT<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
FuncSignature::build<int, int, int, int, int, int, int, int, int, int, int>(CallConvId::kHost));
|
||||||
|
|
||||||
invokeNode->setArg(0, imm(0x03));
|
invokeNode->setArg(0, imm(0x03));
|
||||||
invokeNode->setArg(1, imm(0x12));
|
invokeNode->setArg(1, imm(0x12));
|
||||||
@@ -3045,7 +3045,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
// Prepare.
|
// Prepare.
|
||||||
x86::Gp rv = cc.newInt32("rv");
|
x86::Gp rv = cc.newInt32("rv");
|
||||||
@@ -3054,7 +3054,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*>(CallConvId::kHost));
|
FuncSignature::build<int, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*>(CallConvId::kHost));
|
||||||
|
|
||||||
invokeNode->setArg(0, imm(0x01));
|
invokeNode->setArg(0, imm(0x01));
|
||||||
invokeNode->setArg(1, imm(0x02));
|
invokeNode->setArg(1, imm(0x02));
|
||||||
@@ -3106,7 +3106,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int&, int&, int&, int&>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int&, int&, int&, int&>(CallConvId::kHost));
|
||||||
|
|
||||||
// Prepare.
|
// Prepare.
|
||||||
x86::Gp arg1 = cc.newInt32();
|
x86::Gp arg1 = cc.newInt32();
|
||||||
@@ -3124,7 +3124,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, int&, int&, int&, int&>(CallConvId::kHost));
|
FuncSignature::build<int, int&, int&, int&, int&>(CallConvId::kHost));
|
||||||
|
|
||||||
invokeNode->setArg(0, arg1);
|
invokeNode->setArg(0, arg1);
|
||||||
invokeNode->setArg(1, arg2);
|
invokeNode->setArg(1, arg2);
|
||||||
@@ -3168,7 +3168,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Xmm a = cc.newXmmSs("a");
|
x86::Xmm a = cc.newXmmSs("a");
|
||||||
x86::Xmm b = cc.newXmmSs("b");
|
x86::Xmm b = cc.newXmmSs("b");
|
||||||
@@ -3179,7 +3179,7 @@ public:
|
|||||||
|
|
||||||
// Call function.
|
// Call function.
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<float, float, float>(CallConvId::kHost));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<float, float, float>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, a);
|
invokeNode->setArg(0, a);
|
||||||
invokeNode->setArg(1, b);
|
invokeNode->setArg(1, b);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
@@ -3218,7 +3218,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Xmm a = cc.newXmmSd("a");
|
x86::Xmm a = cc.newXmmSd("a");
|
||||||
x86::Xmm b = cc.newXmmSd("b");
|
x86::Xmm b = cc.newXmmSd("b");
|
||||||
@@ -3228,7 +3228,7 @@ public:
|
|||||||
funcNode->setArg(1, b);
|
funcNode->setArg(1, b);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<double, double, double>(CallConvId::kHost));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<double, double, double>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, a);
|
invokeNode->setArg(0, a);
|
||||||
invokeNode->setArg(1, b);
|
invokeNode->setArg(1, b);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
@@ -3270,7 +3270,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
x86::Gp result;
|
x86::Gp result;
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, x);
|
funcNode->setArg(0, x);
|
||||||
funcNode->setArg(1, y);
|
funcNode->setArg(1, y);
|
||||||
funcNode->setArg(2, op);
|
funcNode->setArg(2, op);
|
||||||
@@ -3290,7 +3290,7 @@ public:
|
|||||||
cc.bind(opAdd);
|
cc.bind(opAdd);
|
||||||
result = cc.newInt32("result_1");
|
result = cc.newInt32("result_1");
|
||||||
|
|
||||||
cc.invoke(&invokeNode, (uint64_t)calledFuncAdd, FuncSignatureT<int, int, int>(CallConvId::kHost));
|
cc.invoke(&invokeNode, (uint64_t)calledFuncAdd, FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, x);
|
invokeNode->setArg(0, x);
|
||||||
invokeNode->setArg(1, y);
|
invokeNode->setArg(1, y);
|
||||||
invokeNode->setRet(0, result);
|
invokeNode->setRet(0, result);
|
||||||
@@ -3299,7 +3299,7 @@ public:
|
|||||||
cc.bind(opMul);
|
cc.bind(opMul);
|
||||||
result = cc.newInt32("result_2");
|
result = cc.newInt32("result_2");
|
||||||
|
|
||||||
cc.invoke(&invokeNode, (uint64_t)calledFuncMul, FuncSignatureT<int, int, int>(CallConvId::kHost));
|
cc.invoke(&invokeNode, (uint64_t)calledFuncMul, FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, x);
|
invokeNode->setArg(0, x);
|
||||||
invokeNode->setArg(1, y);
|
invokeNode->setArg(1, y);
|
||||||
invokeNode->setRet(0, result);
|
invokeNode->setRet(0, result);
|
||||||
@@ -3353,7 +3353,7 @@ public:
|
|||||||
x86::Gp acc0 = cc.newInt32("acc0");
|
x86::Gp acc0 = cc.newInt32("acc0");
|
||||||
x86::Gp acc1 = cc.newInt32("acc1");
|
x86::Gp acc1 = cc.newInt32("acc1");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, buf);
|
funcNode->setArg(0, buf);
|
||||||
|
|
||||||
cc.mov(acc0, 0);
|
cc.mov(acc0, 0);
|
||||||
@@ -3368,7 +3368,7 @@ public:
|
|||||||
cc.mov(ptr, buf);
|
cc.mov(ptr, buf);
|
||||||
cc.mov(idx, int(i));
|
cc.mov(idx, int(i));
|
||||||
|
|
||||||
cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignatureT<int, int*, int>(CallConvId::kFastCall));
|
cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignature::build<int, int*, int>(CallConvId::kFastCall));
|
||||||
invokeNode->setArg(0, ptr);
|
invokeNode->setArg(0, ptr);
|
||||||
invokeNode->setArg(1, idx);
|
invokeNode->setArg(1, idx);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
@@ -3378,7 +3378,7 @@ public:
|
|||||||
cc.mov(ptr, buf);
|
cc.mov(ptr, buf);
|
||||||
cc.mov(idx, int(i));
|
cc.mov(idx, int(i));
|
||||||
|
|
||||||
cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignatureT<int, int*, int>(CallConvId::kFastCall));
|
cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignature::build<int, int*, int>(CallConvId::kFastCall));
|
||||||
invokeNode->setArg(0, ptr);
|
invokeNode->setArg(0, ptr);
|
||||||
invokeNode->setArg(1, idx);
|
invokeNode->setArg(1, idx);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
@@ -3422,7 +3422,7 @@ public:
|
|||||||
x86::Gp val = cc.newInt32("val");
|
x86::Gp val = cc.newInt32("val");
|
||||||
Label skip = cc.newLabel();
|
Label skip = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, val);
|
funcNode->setArg(0, val);
|
||||||
|
|
||||||
cc.cmp(val, 1);
|
cc.cmp(val, 1);
|
||||||
@@ -3434,7 +3434,7 @@ public:
|
|||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
|
|
||||||
cc.invoke(&invokeNode, funcNode->label(), FuncSignatureT<int, int>(CallConvId::kHost));
|
cc.invoke(&invokeNode, funcNode->label(), FuncSignature::build<int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, tmp);
|
invokeNode->setArg(0, tmp);
|
||||||
invokeNode->setRet(0, tmp);
|
invokeNode->setRet(0, tmp);
|
||||||
cc.mul(cc.newInt32(), val, tmp);
|
cc.mul(cc.newInt32(), val, tmp);
|
||||||
@@ -3470,7 +3470,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int, int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp a0 = cc.newInt32("a0");
|
x86::Gp a0 = cc.newInt32("a0");
|
||||||
x86::Gp a1 = cc.newInt32("a1");
|
x86::Gp a1 = cc.newInt32("a1");
|
||||||
@@ -3488,7 +3488,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<int, size_t, int, int, int, int>(CallConvId::kHost, 1));
|
FuncSignature::build<int, size_t, int, int, int, int>(CallConvId::kHost, 1));
|
||||||
invokeNode->setArg(0, imm(4));
|
invokeNode->setArg(0, imm(4));
|
||||||
invokeNode->setArg(1, a0);
|
invokeNode->setArg(1, a0);
|
||||||
invokeNode->setArg(2, a1);
|
invokeNode->setArg(2, a1);
|
||||||
@@ -3538,7 +3538,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double, double, double>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double, double, double>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Xmm a0 = cc.newXmmSd("a0");
|
x86::Xmm a0 = cc.newXmmSd("a0");
|
||||||
x86::Xmm a1 = cc.newXmmSd("a1");
|
x86::Xmm a1 = cc.newXmmSd("a1");
|
||||||
@@ -3556,7 +3556,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)calledFunc),
|
imm((void*)calledFunc),
|
||||||
FuncSignatureT<double, size_t, double, double, double, double>(CallConvId::kHost, 1));
|
FuncSignature::build<double, size_t, double, double, double, double>(CallConvId::kHost, 1));
|
||||||
invokeNode->setArg(0, imm(4));
|
invokeNode->setArg(0, imm(4));
|
||||||
invokeNode->setArg(1, a0);
|
invokeNode->setArg(1, a0);
|
||||||
invokeNode->setArg(2, a1);
|
invokeNode->setArg(2, a1);
|
||||||
@@ -3606,7 +3606,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint64_t, uint64_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint64_t, uint64_t>(CallConvId::kHost));
|
||||||
|
|
||||||
if (cc.is64Bit()) {
|
if (cc.is64Bit()) {
|
||||||
x86::Gp reg = cc.newUInt64();
|
x86::Gp reg = cc.newUInt64();
|
||||||
@@ -3669,7 +3669,7 @@ public:
|
|||||||
static void dummy(int, int) {}
|
static void dummy(int, int) {}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp a = cc.newInt32("a");
|
x86::Gp a = cc.newInt32("a");
|
||||||
x86::Gp b = cc.newInt32("b");
|
x86::Gp b = cc.newInt32("b");
|
||||||
@@ -3681,7 +3681,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)dummy),
|
imm((void*)dummy),
|
||||||
FuncSignatureT<void, int, int>(CallConvId::kHost));
|
FuncSignature::build<void, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, a);
|
invokeNode->setArg(0, a);
|
||||||
invokeNode->setArg(1, b);
|
invokeNode->setArg(1, b);
|
||||||
|
|
||||||
@@ -3717,7 +3717,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, const double*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, const double*>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp p = cc.newIntPtr("p");
|
x86::Gp p = cc.newIntPtr("p");
|
||||||
x86::Xmm arg = cc.newXmmSd("arg");
|
x86::Xmm arg = cc.newXmmSd("arg");
|
||||||
@@ -3729,7 +3729,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)op),
|
imm((void*)op),
|
||||||
FuncSignatureT<double, double>(CallConvId::kHost));
|
FuncSignature::build<double, double>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, arg);
|
invokeNode->setArg(0, arg);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
|
|
||||||
@@ -3767,7 +3767,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, const double*>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, const double*>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp p = cc.newIntPtr("p");
|
x86::Gp p = cc.newIntPtr("p");
|
||||||
x86::Xmm arg = cc.newXmmSd("arg");
|
x86::Xmm arg = cc.newXmmSd("arg");
|
||||||
@@ -3779,7 +3779,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
imm((void*)op),
|
imm((void*)op),
|
||||||
FuncSignatureT<double, double>(CallConvId::kHost));
|
FuncSignature::build<double, double>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, arg);
|
invokeNode->setArg(0, arg);
|
||||||
invokeNode->setRet(0, ret);
|
invokeNode->setRet(0, ret);
|
||||||
|
|
||||||
@@ -3822,12 +3822,12 @@ public:
|
|||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
|
|
||||||
FuncSignatureBuilder funcSignature;
|
FuncSignature funcSignature;
|
||||||
funcSignature.setCallConvId(CallConvId::kHost);
|
funcSignature.setCallConvId(CallConvId::kHost);
|
||||||
funcSignature.setRet(TypeId::kFloat64);
|
funcSignature.setRet(TypeId::kFloat64);
|
||||||
cc.addFunc(funcSignature);
|
cc.addFunc(funcSignature);
|
||||||
|
|
||||||
FuncSignatureBuilder invokeSignature;
|
FuncSignature invokeSignature;
|
||||||
invokeSignature.setCallConvId(CallConvId::kHost);
|
invokeSignature.setCallConvId(CallConvId::kHost);
|
||||||
invokeSignature.setRet(TypeId::kFloat64);
|
invokeSignature.setRet(TypeId::kFloat64);
|
||||||
|
|
||||||
@@ -3868,7 +3868,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp pFn = cc.newIntPtr("pFn");
|
x86::Gp pFn = cc.newIntPtr("pFn");
|
||||||
x86::Gp vars[16];
|
x86::Gp vars[16];
|
||||||
@@ -3887,7 +3887,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, pFn, FuncSignatureT<void>(CallConvId::kHost));
|
cc.invoke(&invokeNode, pFn, FuncSignature::build<void>(CallConvId::kHost));
|
||||||
|
|
||||||
for (i = 1; i < regCount; i++)
|
for (i = 1; i < regCount; i++)
|
||||||
if (vars[i].isValid())
|
if (vars[i].isValid())
|
||||||
@@ -3925,7 +3925,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint32_t, uint32_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint32_t, uint32_t>(CallConvId::kHost));
|
||||||
|
|
||||||
constexpr uint32_t kCount = 16;
|
constexpr uint32_t kCount = 16;
|
||||||
|
|
||||||
@@ -3941,7 +3941,7 @@ public:
|
|||||||
v[i] = cc.newUInt32("v%u", i);
|
v[i] = cc.newUInt32("v%u", i);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT<uint32_t, uint32_t>(CallConvId::kHost));
|
cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build<uint32_t, uint32_t>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, argVal);
|
invokeNode->setArg(0, argVal);
|
||||||
invokeNode->setRet(0, retVal);
|
invokeNode->setRet(0, retVal);
|
||||||
|
|
||||||
@@ -3988,12 +3988,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* mainFunc = cc.addFunc(FuncSignatureT<void, void*, const void*, const void*>(CallConvId::kHost));
|
FuncNode* mainFunc = cc.addFunc(FuncSignature::build<void, void*, const void*, const void*>(CallConvId::kHost));
|
||||||
mainFunc->frame().setAvxEnabled();
|
mainFunc->frame().setAvxEnabled();
|
||||||
mainFunc->frame().setAvxCleanup();
|
mainFunc->frame().setAvxCleanup();
|
||||||
|
|
||||||
// We need a Windows calling convention to test this properly also on a non-Windows machine.
|
// We need a Windows calling convention to test this properly also on a non-Windows machine.
|
||||||
FuncNode* helperFunc = cc.newFunc(FuncSignatureT<void, void*, const void*>(CallConvId::kX64Windows));
|
FuncNode* helperFunc = cc.newFunc(FuncSignature::build<void, void*, const void*>(CallConvId::kX64Windows));
|
||||||
helperFunc->frame().setAvxEnabled();
|
helperFunc->frame().setAvxEnabled();
|
||||||
helperFunc->frame().setAvxCleanup();
|
helperFunc->frame().setAvxCleanup();
|
||||||
|
|
||||||
@@ -4020,7 +4020,7 @@ public:
|
|||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode,
|
cc.invoke(&invokeNode,
|
||||||
helperFunc->label(),
|
helperFunc->label(),
|
||||||
FuncSignatureT<void, void*, const void*>(CallConvId::kX64Windows));
|
FuncSignature::build<void, void*, const void*>(CallConvId::kX64Windows));
|
||||||
invokeNode->setArg(0, tPtr);
|
invokeNode->setArg(0, tPtr);
|
||||||
invokeNode->setArg(1, bPtr);
|
invokeNode->setArg(1, bPtr);
|
||||||
|
|
||||||
@@ -4103,7 +4103,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp v0 = cc.newInt32("v0");
|
x86::Gp v0 = cc.newInt32("v0");
|
||||||
x86::Gp v1 = cc.newInt32("v1");
|
x86::Gp v1 = cc.newInt32("v1");
|
||||||
@@ -4145,7 +4145,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
cc.addFunc(FuncSignatureT<int>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp v0 = cc.newInt32("v0");
|
x86::Gp v0 = cc.newInt32("v0");
|
||||||
x86::Gp v1 = cc.newInt32("v1");
|
x86::Gp v1 = cc.newInt32("v1");
|
||||||
@@ -4186,7 +4186,7 @@ struct X86Test_MiscMultiRet : public X86TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, int, int>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, int, int>(CallConvId::kHost));
|
||||||
|
|
||||||
x86::Gp op = cc.newInt32("op");
|
x86::Gp op = cc.newInt32("op");
|
||||||
x86::Gp a = cc.newInt32("a");
|
x86::Gp a = cc.newInt32("a");
|
||||||
@@ -4278,8 +4278,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void compile(x86::Compiler& cc) {
|
virtual void compile(x86::Compiler& cc) {
|
||||||
FuncNode* f1Node = cc.newFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* f1Node = cc.newFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
FuncNode* f2Node = cc.newFunc(FuncSignatureT<int, int, int>(CallConvId::kHost));
|
FuncNode* f2Node = cc.newFunc(FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
|
|
||||||
{
|
{
|
||||||
x86::Gp a = cc.newInt32("a");
|
x86::Gp a = cc.newInt32("a");
|
||||||
@@ -4290,7 +4290,7 @@ public:
|
|||||||
f1Node->setArg(1, b);
|
f1Node->setArg(1, b);
|
||||||
|
|
||||||
InvokeNode* invokeNode;
|
InvokeNode* invokeNode;
|
||||||
cc.invoke(&invokeNode, f2Node->label(), FuncSignatureT<int, int, int>(CallConvId::kHost));
|
cc.invoke(&invokeNode, f2Node->label(), FuncSignature::build<int, int, int>(CallConvId::kHost));
|
||||||
invokeNode->setArg(0, a);
|
invokeNode->setArg(0, a);
|
||||||
invokeNode->setArg(1, b);
|
invokeNode->setArg(1, b);
|
||||||
invokeNode->setRet(0, a);
|
invokeNode->setRet(0, a);
|
||||||
@@ -4349,7 +4349,7 @@ public:
|
|||||||
x86::Gp b = cc.newIntPtr("b");
|
x86::Gp b = cc.newIntPtr("b");
|
||||||
Label tramp = cc.newLabel();
|
Label tramp = cc.newLabel();
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<int, int, void*>(CallConvId::kFastCall));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<int, int, void*>(CallConvId::kFastCall));
|
||||||
funcNode->setArg(0, a);
|
funcNode->setArg(0, a);
|
||||||
funcNode->setArg(1, b);
|
funcNode->setArg(1, b);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static void makeRawFunc(x86::Emitter* emitter) noexcept {
|
|||||||
|
|
||||||
// Create and initialize `FuncDetail` and `FuncFrame`.
|
// Create and initialize `FuncDetail` and `FuncFrame`.
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, int*, const int*, const int*>(CallConvId::kHost), emitter->environment());
|
func.init(FuncSignature::build<void, int*, const int*, const int*>(CallConvId::kHost), emitter->environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -70,7 +70,7 @@ static void makeCompiledFunc(x86::Compiler* cc) noexcept {
|
|||||||
x86::Xmm vec0 = cc->newXmm("vec0");
|
x86::Xmm vec0 = cc->newXmm("vec0");
|
||||||
x86::Xmm vec1 = cc->newXmm("vec1");
|
x86::Xmm vec1 = cc->newXmm("vec1");
|
||||||
|
|
||||||
FuncNode* funcNode = cc->addFunc(FuncSignatureT<void, int*, const int*, const int*>(CallConvId::kHost));
|
FuncNode* funcNode = cc->addFunc(FuncSignature::build<void, int*, const int*, const int*>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, src_a);
|
funcNode->setArg(1, src_a);
|
||||||
funcNode->setArg(2, src_b);
|
funcNode->setArg(2, src_b);
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -202,7 +202,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -242,7 +242,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE
|
|||||||
Xmm v6 = cc.newXmm("v6");
|
Xmm v6 = cc.newXmm("v6");
|
||||||
Xmm v7 = cc.newXmm("v7");
|
Xmm v7 = cc.newXmm("v7");
|
||||||
|
|
||||||
FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost));
|
FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost));
|
||||||
funcNode->setArg(0, dst);
|
funcNode->setArg(0, dst);
|
||||||
funcNode->setArg(1, src);
|
funcNode->setArg(1, src);
|
||||||
funcNode->setArg(2, i);
|
funcNode->setArg(2, i);
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) {
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -608,7 +608,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) {
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -633,7 +633,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) {
|
|||||||
a64::Gp c = cc.newIntPtr("c");
|
a64::Gp c = cc.newIntPtr("c");
|
||||||
a64::Gp d = cc.newIntPtr("d");
|
a64::Gp d = cc.newIntPtr("d");
|
||||||
|
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
generateGpSequenceInternal(cc, a, b, c, d);
|
generateGpSequenceInternal(cc, a, b, c, d);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -361,7 +361,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -386,7 +386,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro
|
|||||||
Gp c = cc.newIntPtr("c");
|
Gp c = cc.newIntPtr("c");
|
||||||
Gp d = cc.newIntPtr("d");
|
Gp d = cc.newIntPtr("d");
|
||||||
|
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
generateGpSequenceInternal(cc, form, a, b, c, d);
|
generateGpSequenceInternal(cc, form, a, b, c, d);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
@@ -927,7 +927,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -948,7 +948,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -974,7 +974,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
Xmm c = cc.newXmm("c");
|
Xmm c = cc.newXmm("c");
|
||||||
Xmm d = cc.newXmm("d");
|
Xmm d = cc.newXmm("d");
|
||||||
|
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
generateSseSequenceInternal(cc, form, gp, a, b, c, d);
|
generateSseSequenceInternal(cc, form, gp, a, b, c, d);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
@@ -2134,7 +2134,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -2155,7 +2155,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -2181,7 +2181,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr
|
|||||||
Ymm c = cc.newYmm("c");
|
Ymm c = cc.newYmm("c");
|
||||||
Ymm d = cc.newYmm("d");
|
Ymm d = cc.newYmm("d");
|
||||||
|
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
generateAvxSequenceInternal(cc, form, gp, a, b, c, d);
|
generateAvxSequenceInternal(cc, form, gp, a, b, c, d);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
@@ -4928,7 +4928,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -4949,7 +4949,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi
|
|||||||
|
|
||||||
if (emitPrologEpilog) {
|
if (emitPrologEpilog) {
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
func.init(FuncSignature::build<void, void*, const void*, size_t>(CallConvId::kHost), cc.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
@@ -4979,7 +4979,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi
|
|||||||
KReg kB = cc.newKq("kB");
|
KReg kB = cc.newKq("kB");
|
||||||
KReg kC = cc.newKq("kC");
|
KReg kC = cc.newKq("kC");
|
||||||
|
|
||||||
cc.addFunc(FuncSignatureT<void>(CallConvId::kHost));
|
cc.addFunc(FuncSignature::build<void>(CallConvId::kHost));
|
||||||
generateAvx512SequenceInternal(cc, form, gp, kA, kB, kC, vecA, vecB, vecC, vecD);
|
generateAvx512SequenceInternal(cc, form, gp, kA, kB, kC, vecA, vecB, vecC, vecD);
|
||||||
cc.endFunc();
|
cc.endFunc();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ int main() {
|
|||||||
Label data = a.newLabel();
|
Label data = a.newLabel();
|
||||||
|
|
||||||
FuncDetail func;
|
FuncDetail func;
|
||||||
func.init(FuncSignatureT<size_t, size_t>(CallConvId::kHost), code.environment());
|
func.init(FuncSignature::build<size_t, size_t>(CallConvId::kHost), code.environment());
|
||||||
|
|
||||||
FuncFrame frame;
|
FuncFrame frame;
|
||||||
frame.init(func);
|
frame.init(func);
|
||||||
|
|||||||
Reference in New Issue
Block a user