diff --git a/src/asmjit/core.h b/src/asmjit/core.h index 21e2157..ab0f2b5 100644 --- a/src/asmjit/core.h +++ b/src/asmjit/core.h @@ -246,6 +246,12 @@ namespace asmjit { //! - 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. //! +//! - 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` instead of `FuncSignatureT`. The old API has been deprecated. +//! +//! - The maximum number of function arguments was raised from 16 to 32. +//! //! ### Changes committed at 2023-12-26 //! //! Core changes: @@ -442,7 +448,7 @@ namespace asmjit { //! // Calling a function (Compiler) changed - use invoke() instead of call(). //! void functionInvocation(x86::Compiler& cc) { //! InvokeNode* invokeNode; -//! cc.invoke(&invokeNode, targetOperand, FuncSignatureT<...>(...)); +//! cc.invoke(&invokeNode, targetOperand, FuncSignature::build<...>(...)); //! } //! ``` diff --git a/src/asmjit/core/api-config.h b/src/asmjit/core/api-config.h index 97a9ae6..58b61b5 100644 --- a/src/asmjit/core/api-config.h +++ b/src/asmjit/core/api-config.h @@ -425,17 +425,10 @@ namespace asmjit { //! Marks function, class, struct, enum, or anything else as deprecated. #if defined(__GNUC__) #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) #define ASMJIT_DEPRECATED(MESSAGE) __declspec(deprecated(MESSAGE)) - #define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */ #else #define ASMJIT_DEPRECATED(MESSAGE) - #define ASMJIT_DEPRECATED_STRUCT(MESSAGE) #endif // Utilities. diff --git a/src/asmjit/core/func.cpp b/src/asmjit/core/func.cpp index 04dc2aa..f48c1cd 100644 --- a/src/asmjit/core/func.cpp +++ b/src/asmjit/core/func.cpp @@ -283,4 +283,18 @@ ASMJIT_FAVOR_SIZE Error FuncArgsAssignment::updateFuncFrame(FuncFrame& frame) co return kErrorOk; } +// Func API - Tests +// ================ + +#if defined(ASMJIT_TEST) +UNIT(func_signature) { + FuncSignature signature; + signature.setRetT(); + signature.addArgT(); + signature.addArg(TypeId::kInt32); + + EXPECT_EQ(signature, FuncSignature::build()); +} +#endif + ASMJIT_END_NAMESPACE diff --git a/src/asmjit/core/func.h b/src/asmjit/core/func.h index d9c2d9b..5826910 100644 --- a/src/asmjit/core/func.h +++ b/src/asmjit/core/func.h @@ -377,36 +377,80 @@ struct FuncSignature { //! \{ //! Calling convention id. - CallConvId _ccId; + CallConvId _ccId = CallConvId::kHost; //! Count of arguments. - uint8_t _argCount; + uint8_t _argCount = 0; //! Index of a first VA or `kNoVarArgs`. - uint8_t _vaIndex; + uint8_t _vaIndex = kNoVarArgs; //! Return value TypeId. - TypeId _ret; - //! Function arguments TypeIds. - const TypeId* _args; + TypeId _ret = TypeId::kVoid; + //! Reserved for future use. + uint8_t _reserved[4] {}; + //! Function argument TypeIds. + TypeId _args[Globals::kMaxFuncArgs] {}; //! \} - //! \name Initialization & Reset + //! \name Construction & Destruction //! \{ - //! Initializes the function signature. - inline void init(CallConvId ccId, uint32_t vaIndex, TypeId ret, const TypeId* args, uint32_t argCount) noexcept { - ASMJIT_ASSERT(argCount <= 0xFF); + //! Default constructed function signature, initialized to \ref CallConvId::kHost, having no return value and no arguments. + ASMJIT_FORCE_INLINE constexpr FuncSignature() = default; - _ccId = ccId; - _argCount = uint8_t(argCount); - _vaIndex = uint8_t(vaIndex); - _ret = ret; - _args = args; + //! Copy constructor, which is initialized to the same function signature as `other`. + ASMJIT_FORCE_INLINE constexpr FuncSignature(const FuncSignature& other) = default; + + //! Initializes the function signature with calling convention id `ccId` and variable argument's index `vaIndex`. + 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 + 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)...} {} + + template + static ASMJIT_INLINE_NODEBUG constexpr FuncSignature build(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept { + return FuncSignature(ccId, vaIndex, (TypeId(TypeUtils::TypeIdOfT::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{}; } //! \} + //! \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 //! \{ @@ -415,6 +459,55 @@ struct FuncSignature { //! Sets the calling convention to `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 + ASMJIT_INLINE_NODEBUG void setRetT() noexcept { setRet(TypeId(TypeUtils::TypeIdOfT::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 + inline void setArgT(uint32_t index) noexcept { setArg(index, TypeId(TypeUtils::TypeIdOfT::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 + inline void addArgT() noexcept { addArg(TypeId(TypeUtils::TypeIdOfT::kTypeId)); } + //! Tests whether the function has variable number of arguments (...). ASMJIT_INLINE_NODEBUG bool hasVarArgs() const noexcept { return _vaIndex != kNoVarArgs; } //! 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). 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 -class FuncSignatureT : public FuncSignature { +#if !defined(ASMJIT_NO_DEPRECATED) +template +class ASMJIT_DEPRECATED("Use FuncSignature::build() instead") FuncSignatureT : public FuncSignature { public: - ASMJIT_INLINE_NODEBUG FuncSignatureT(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept { - static constexpr TypeId ret_args[] = { (TypeId(TypeUtils::TypeIdOfT::kTypeId))... }; - init(ccId, vaIndex, ret_args[0], ret_args + 1, uint32_t(ASMJIT_ARRAY_SIZE(ret_args) - 1)); - } + ASMJIT_INLINE_NODEBUG constexpr FuncSignatureT(CallConvId ccId = CallConvId::kHost, uint32_t vaIndex = kNoVarArgs) noexcept + : FuncSignature(ccId, vaIndex, (TypeId(TypeUtils::TypeIdOfT::kTypeId))... ) {} }; -//! Function signature builder. -class FuncSignatureBuilder : public FuncSignature { -public: - 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 - ASMJIT_INLINE_NODEBUG void setRetT() noexcept { setRet(TypeId(TypeUtils::TypeIdOfT::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 - inline void setArgT(uint32_t index) noexcept { setArg(index, TypeId(TypeUtils::TypeIdOfT::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 - inline void addArgT() noexcept { addArg(TypeId(TypeUtils::TypeIdOfT::kTypeId)); } - - //! \} -}; +ASMJIT_DEPRECATED("Use FuncSignature instead of FuncSignatureBuilder") +typedef FuncSignature FuncSignatureBuilder; +#endif // ASMJIT_NO_DEPRECATED //! Argument or return value (or its part) as defined by `FuncSignature`, but with register or stack address //! (and other metadata) assigned. @@ -758,10 +795,8 @@ public: //! \name Constants //! \{ - enum : uint8_t { - //! Doesn't have variable number of arguments (`...`). - kNoVarArgs = 0xFFu - }; + //! Function doesn't have a variable number of arguments (`...`). + static constexpr uint8_t kNoVarArgs = 0xFFu; //! \} diff --git a/src/asmjit/core/globals.h b/src/asmjit/core/globals.h index 1a589d3..22e93b8 100644 --- a/src/asmjit/core/globals.h +++ b/src/asmjit/core/globals.h @@ -96,10 +96,9 @@ static constexpr uint32_t kMaxTreeHeight = (ASMJIT_ARCH_BITS == 32 ? 30 : 61) + static constexpr uint32_t kMaxOpCount = 6; //! 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 -//! return value. +//! The number of values that can be assigned to a single function argument or return value. static constexpr uint32_t kMaxValuePack = 4; //! Maximum number of physical registers AsmJit can use per register group. diff --git a/src/asmjit/x86/x86assembler.h b/src/asmjit/x86/x86assembler.h index f7be0d9..8c90220 100644 --- a/src/asmjit/x86/x86assembler.h +++ b/src/asmjit/x86/x86assembler.h @@ -365,7 +365,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! //! // Create/initialize FuncDetail and FuncFrame. //! FuncDetail func; -//! func.init(FuncSignatureT(CallConvId::kHost)); +//! func.init(FuncSignature::build(CallConvId::kHost)); //! //! FuncFrame frame; //! frame.init(func); diff --git a/src/asmjit/x86/x86builder.h b/src/asmjit/x86/x86builder.h index 0de36e9..1deef4a 100644 --- a/src/asmjit/x86/x86builder.h +++ b/src/asmjit/x86/x86builder.h @@ -61,7 +61,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! //! // Create and initialize `FuncDetail`. //! FuncDetail func; -//! func.init(FuncSignatureT(CallConvId::kHost)); +//! func.init(FuncSignature::build(CallConvId::kHost)); //! //! // Remember prolog insertion point. //! BaseNode* prologInsertionPoint = cb.cursor(); diff --git a/src/asmjit/x86/x86compiler.h b/src/asmjit/x86/x86compiler.h index add17b0..5b27b98 100644 --- a/src/asmjit/x86/x86compiler.h +++ b/src/asmjit/x86/x86compiler.h @@ -35,32 +35,32 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! typedef int (*Func)(void); //! //! int main() { -//! JitRuntime rt; // Runtime specialized for JIT code execution. -//! CodeHolder code; // Holds code and relocation information. +//! JitRuntime rt; // Runtime specialized for JIT code execution. +//! 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()); -//! 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());// Begin a function of `int fn(void)` signature. +//! cc.addFunc(FuncSignature::build()); // Begin a function of `int fn(void)` signature. //! -//! x86::Gp vReg = cc.newGpd(); // Create a 32-bit general purpose register. -//! cc.mov(vReg, 1); // Move one to our virtual register `vReg`. -//! cc.ret(vReg); // Return `vReg` from the function. +//! x86::Gp vReg = cc.newGpd(); // Create a 32-bit general purpose register. +//! cc.mov(vReg, 1); // Move one to our virtual register `vReg`. +//! cc.ret(vReg); // Return `vReg` from the function. //! -//! cc.endFunc(); // End of the function body. -//! cc.finalize(); // Translate and assemble the whole 'cc' content. +//! cc.endFunc(); // End of the function body. +//! cc.finalize(); // Translate and assemble the whole 'cc' content. //! // ----> x86::Compiler is no longer needed from here and can be destroyed <---- //! //! Func fn; -//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime. -//! if (err) return 1; // Handle a possible error returned by AsmJit. +//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime. +//! if (err) return 1; // Handle a possible error returned by AsmJit. //! // ----> CodeHolder is no longer needed from here and can be destroyed <---- //! -//! int result = fn(); // Execute the generated code. -//! printf("%d\n", result); // Print the resulting "1". +//! int result = fn(); // Execute the generated code. +//! 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; //! } //! ``` @@ -80,49 +80,49 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! typedef void (*MemCpy32)(uint32_t* dst, const uint32_t* src, size_t count); //! //! int main() { -//! JitRuntime rt; // Runtime specialized for JIT code execution. -//! CodeHolder code; // Holds code and relocation information. +//! JitRuntime rt; // Runtime specialized for JIT code execution. +//! 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()); -//! 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: -//! FuncSignatureT()); // 3rd argument - size_t (machine reg-size). +//! FuncNode* funcNode = cc.addFunc ( // Begin the function of the following signature: +//! FuncSignature::build()); // 3rd argument - size_t (machine reg-size). //! -//! Label L_Loop = cc.newLabel(); // Start of the loop. -//! Label L_Exit = cc.newLabel(); // Used to exit early. +//! Label L_Loop = cc.newLabel(); // Start of the loop. +//! Label L_Exit = cc.newLabel(); // Used to exit early. //! -//! x86::Gp dst = cc.newIntPtr("dst");// Create `dst` register (destination 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 dst = cc.newIntPtr("dst"); // Create `dst` register (destination pointer). +//! x86::Gp src = cc.newIntPtr("src"); // Create `src` register (source pointer). +//! x86::Gp i = cc.newUIntPtr("i"); // Create `i` register (loop counter). //! -//! funcNode->setArg(0, dst); // Assign `dst` argument. -//! funcNode->setArg(1, src); // Assign `src` argument. -//! funcNode->setArg(2, i); // Assign `i` argument. +//! funcNode->setArg(0, dst); // Assign `dst` argument. +//! funcNode->setArg(1, src); // Assign `src` 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.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). -//! cc.mov(tmp, x86::dword_ptr(src)); // Load DWORD from [src] address. -//! cc.mov(x86::dword_ptr(dst), tmp); // Store DWORD to [dst] address. +//! 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(x86::dword_ptr(dst), tmp); // Store DWORD to [dst] address. //! -//! cc.add(src, 4); // Increment `src`. -//! cc.add(dst, 4); // Increment `dst`. +//! cc.add(src, 4); // Increment `src`. +//! 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.bind(L_Exit); // Label used by early exit. -//! cc.endFunc(); // End of the function body. +//! cc.bind(L_Exit); // Label used by early exit. +//! 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 <---- //! //! // Add the generated code to the runtime. @@ -163,14 +163,14 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! typedef void (*Func)(void*); //! //! int main() { -//! JitRuntime rt; // Runtime specialized for JIT code execution. -//! CodeHolder code; // Holds code and relocation information. +//! JitRuntime rt; // Runtime specialized for JIT code execution. +//! 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()); -//! 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()); +//! FuncNode* funcNode = cc.addFunc(FuncSignature::build()); //! //! // Use the following to enable AVX and/or AVX-512. //! funcNode->frame().setAvxEnabled(); @@ -186,13 +186,13 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! cc.vpaddq(vreg, vreg, vreg); //! cc.vmovdqu32(x86::ptr(addr), vreg); //! -//! cc.endFunc(); // End of the function body. -//! cc.finalize(); // Translate and assemble the whole 'cc' content. +//! cc.endFunc(); // End of the function body. +//! cc.finalize(); // Translate and assemble the whole 'cc' content. //! // ----> x86::Compiler is no longer needed from here and can be destroyed <---- //! //! Func fn; -//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime. -//! if (err) return 1; // Handle a possible error returned by AsmJit. +//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime. +//! if (err) return 1; // Handle a possible error returned by AsmJit. //! // ----> CodeHolder is no longer needed from here and can be destroyed <---- //! //! // Execute the generated code and print some output. @@ -200,7 +200,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! fn(data); //! 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; //! } //! ``` @@ -222,48 +222,48 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! typedef uint32_t (*Fibonacci)(uint32_t x); //! //! int main() { -//! JitRuntime rt; // Runtime specialized for JIT code execution. -//! CodeHolder code; // Holds code and relocation information. +//! JitRuntime rt; // Runtime specialized for JIT code execution. +//! 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()); -//! 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() -//! FuncSignatureT()); // Returns a pointer to the FuncNode node. +//! FuncNode* funcNode = cc.addFunc( // Begin of the Fibonacci function, addFunc() +//! FuncSignature::build()); // Returns a pointer to the FuncNode node. //! -//! Label L_Exit = cc.newLabel() // Exit label. -//! x86::Gp x = cc.newUInt32(); // Function x argument. -//! x86::Gp y = cc.newUInt32(); // Temporary. +//! Label L_Exit = cc.newLabel(); // Exit label. +//! x86::Gp x = cc.newUInt32(); // Function x argument. +//! x86::Gp y = cc.newUInt32(); // Temporary. //! //! 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.mov(y, x); // Make copy of the original x. -//! cc.dec(x); // Decrease x. +//! cc.mov(y, x); // Make copy of the original x. +//! cc.dec(x); // Decrease x. //! -//! InvokeNode* invokeNode; // Function invocation: -//! cc.invoke(&invokeNode, // - InvokeNode (output). -//! funcNode->label(), // - Function address or Label. -//! FuncSignatureT()); // - Function signature. +//! InvokeNode* invokeNode; // Function invocation: +//! cc.invoke(&invokeNode, // - InvokeNode (output). +//! funcNode->label(), // - Function address or Label. +//! FuncSignature::build()); // - Function signature. //! -//! invokeNode->setArg(0, x); // Assign x as the first argument. -//! invokeNode->setRet(0, x); // Assign x as a return value as well. +//! invokeNode->setArg(0, x); // Assign x as the first argument. +//! 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.ret(x); // Return x. -//! cc.endFunc(); // End of the function body. +//! cc.ret(x); // Return x. +//! 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 <---- //! //! Fibonacci fib; -//! Error err = rt.add(&fib, &code); // Add the generated code to the runtime. -//! if (err) return 1; // Handle a possible error returned by AsmJit. +//! Error err = rt.add(&fib, &code); // Add the generated code to the runtime. +//! if (err) return 1; // Handle a possible error returned by AsmJit. //! // ----> CodeHolder is no longer needed from here and can be destroyed <---- //! //! // Test the generated code. @@ -291,14 +291,14 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! typedef int (*Func)(void); //! //! int main() { -//! JitRuntime rt; // Runtime specialized for JIT code execution. -//! CodeHolder code; // Holds code and relocation information. +//! JitRuntime rt; // Runtime specialized for JIT code execution. +//! 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()); -//! 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());// Create a function that returns int. +//! cc.addFunc(FuncSignature::build()); // Create a function that returns int. //! //! x86::Gp p = cc.newIntPtr("p"); //! 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. //! x86::Mem stack = cc.newStack(256, 4); //! -//! x86::Mem stackIdx(stack); // Copy of stack with i added. -//! stackIdx.setIndex(i); // stackIdx <- stack[i]. -//! stackIdx.setSize(1); // stackIdx <- byte ptr stack[i]. +//! x86::Mem stackIdx(stack); // Copy of stack with i added. +//! stackIdx.setIndex(i); // stackIdx <- stack[i]. +//! stackIdx.setSize(1); // stackIdx <- byte ptr stack[i]. //! //! // 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) @@ -321,12 +321,12 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! Label L1 = cc.newLabel(); //! Label L2 = cc.newLabel(); //! -//! cc.bind(L1); // First loop, fill the stack. -//! cc.mov(stackIdx, i.r8()); // stack[i] = uint8_t(i). +//! cc.bind(L1); // First loop, fill the stack. +//! cc.mov(stackIdx, i.r8()); // stack[i] = uint8_t(i). //! -//! cc.inc(i); // i++; -//! cc.cmp(i, 256); // if (i < 256) -//! cc.jb(L1); // goto L1; +//! cc.inc(i); // i++; +//! cc.cmp(i, 256); // if (i < 256) +//! cc.jb(L1); // goto L1; //! //! // Second loop, sum all bytes stored in `stack`. //! x86::Gp sum = cc.newInt32("sum"); @@ -337,25 +337,25 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! //! cc.bind(L2); //! -//! cc.movzx(val, stackIdx); // val = uint32_t(stack[i]); -//! cc.add(sum, val); // sum += val; +//! cc.movzx(val, stackIdx); // val = uint32_t(stack[i]); +//! cc.add(sum, val); // sum += val; //! -//! cc.inc(i); // i++; -//! cc.cmp(i, 256); // if (i < 256) -//! cc.jb(L2); // goto L2; +//! cc.inc(i); // i++; +//! cc.cmp(i, 256); // if (i < 256) +//! cc.jb(L2); // goto L2; //! -//! cc.ret(sum); // Return the `sum` of all values. -//! cc.endFunc(); // End of the function body. +//! cc.ret(sum); // Return the `sum` of all values. +//! 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 <---- //! //! Func func; -//! Error err = rt.add(&func, &code); // Add the generated code to the runtime. -//! if (err) return 1; // Handle a possible error returned by AsmJit. +//! Error err = rt.add(&func, &code); // Add the generated code to the runtime. +//! if (err) return 1; // Handle a possible error returned by AsmJit. //! // ----> 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); //! return 0; @@ -380,7 +380,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! using namespace asmjit; //! //! static void exampleUseOfConstPool(x86::Compiler& cc) { -//! cc.addFunc(FuncSignatureT()); +//! cc.addFunc(FuncSignature::build()); //! //! x86::Gp v0 = cc.newGpd("v0"); //! x86::Gp v1 = cc.newGpd("v1"); @@ -414,7 +414,7 @@ ASMJIT_BEGIN_SUB_NAMESPACE(x86) //! using namespace asmjit; //! //! static void exampleUseOfIndirectJump(x86::Compiler& cc) { -//! FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); +//! FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); //! //! // Function arguments //! x86::Xmm a = cc.newXmmSs("a"); diff --git a/test/asmjit_test_compiler_a64.cpp b/test/asmjit_test_compiler_a64.cpp index bc859fe..4ec0f13 100644 --- a/test/asmjit_test_compiler_a64.cpp +++ b/test/asmjit_test_compiler_a64.cpp @@ -55,7 +55,7 @@ public: uint32_t i; uint32_t argCount = _argCount; - FuncSignatureBuilder signature; + FuncSignature signature; signature.setRetT(); for (i = 0; i < argCount; i++) signature.addArgT(); @@ -201,7 +201,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Gp dst = cc.newUIntPtr("dst"); a64::Gp src1 = cc.newUIntPtr("src1"); @@ -261,7 +261,7 @@ public: } virtual void compile(a64::Compiler& cc) { - cc.addFunc(FuncSignatureT()); + cc.addFunc(FuncSignature::build()); a64::Gp* regs = static_cast(malloc(_regCount * sizeof(a64::Gp))); @@ -311,7 +311,7 @@ public: } virtual void compile(a64::Compiler& cc) { - cc.addFunc(FuncSignatureT()); + cc.addFunc(FuncSignature::build()); a64::Gp addr = cc.newIntPtr("addr"); a64::Gp val = cc.newIntPtr("val"); @@ -355,7 +355,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Gp p = cc.newIntPtr("p"); a64::Gp count = cc.newIntPtr("count"); @@ -410,7 +410,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Gp x = cc.newUInt32("x"); a64::Gp y = cc.newUInt32("y"); @@ -423,7 +423,7 @@ public: cc.mov(fn, (uint64_t)calledFunc); InvokeNode* invokeNode; - cc.invoke(&invokeNode, fn, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, fn, FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, x); invokeNode->setArg(1, y); invokeNode->setRet(0, r); @@ -463,7 +463,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Vec x = cc.newVecD("x"); a64::Vec y = cc.newVecD("y"); @@ -475,7 +475,7 @@ public: cc.mov(fn, (uint64_t)calledFunc); InvokeNode* invokeNode; - cc.invoke(&invokeNode, fn, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, fn, FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, x); invokeNode->setArg(1, y); invokeNode->setRet(0, r); @@ -515,7 +515,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Vec x = cc.newVecD("x"); a64::Vec y = cc.newVecD("y"); @@ -527,7 +527,7 @@ public: cc.mov(fn, (uint64_t)calledFunc); InvokeNode* invokeNode; - cc.invoke(&invokeNode, fn, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, fn, FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, y); invokeNode->setArg(1, x); invokeNode->setRet(0, r); @@ -580,7 +580,7 @@ public: } virtual void compile(a64::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT()); + FuncNode* funcNode = cc.addFunc(FuncSignature::build()); a64::Vec a = cc.newVecS("a"); a64::Vec b = cc.newVecS("b"); diff --git a/test/asmjit_test_compiler_x86.cpp b/test/asmjit_test_compiler_x86.cpp index 23aa37b..8e69a72 100644 --- a/test/asmjit_test_compiler_x86.cpp +++ b/test/asmjit_test_compiler_x86.cpp @@ -67,7 +67,7 @@ public: uint32_t i; uint32_t argCount = _argCount; - FuncSignatureBuilder signature(CallConvId::kHost); + FuncSignature signature(CallConvId::kHost); signature.setRetT(); for (i = 0; i < argCount; i++) signature.addArgT(); @@ -223,7 +223,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); cc.endFunc(); } @@ -250,7 +250,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); cc.align(AlignMode::kCode, 0); cc.align(AlignMode::kCode, 1); cc.endFunc(); @@ -279,7 +279,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* func = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* func = cc.addFunc(FuncSignature::build(CallConvId::kHost)); func->addAttributes(FuncAttributes::kIndirectBranchProtection); cc.endFunc(); } @@ -316,7 +316,7 @@ public: x86::Gp dst = cc.newIntPtr("dst"); x86::Gp val = cc.newInt32("val"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, val); @@ -372,7 +372,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); Label L1 = cc.newLabel(); Label L2 = cc.newLabel(); @@ -413,7 +413,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); for (uint32_t i = 0; i < 1000; i++) { Label L = cc.newLabel(); cc.jmp(L); @@ -453,7 +453,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); Label L_1 = cc.newLabel(); Label L_2 = cc.newLabel(); @@ -515,7 +515,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); Label L_1 = cc.newLabel(); Label L_2 = cc.newLabel(); @@ -588,7 +588,7 @@ public: Label L_Div = cc.newLabel(); Label L_End = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, a); funcNode->setArg(1, b); funcNode->setArg(2, op); @@ -689,7 +689,7 @@ public: Label L_Case1 = cc.newLabel(); Label L_End = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, value); cc.bind(L_Begin); @@ -759,7 +759,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); Label L_Target = cc.newLabel(); x86::Gp target = cc.newUIntPtr("target"); @@ -807,7 +807,7 @@ public: x86::Gp result = cc.newUInt32("result"); x86::Gp condition = cc.newUInt32("condition"); - FuncNode* func = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* func = cc.addFunc(FuncSignature::build(CallConvId::kHost)); func->setArg(0, condition); Label L_NonZero = cc.newLabel(); @@ -878,7 +878,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp v0 = cc.newInt32("v0"); x86::Gp v1 = cc.newInt32("v1"); @@ -933,7 +933,7 @@ public: x86::Gp a0 = cc.newIntPtr("a0"); x86::Gp a1 = cc.newIntPtr("a1"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, a0); funcNode->setArg(1, a1); @@ -1001,7 +1001,7 @@ public: x86::Gp a = cc.newIntPtr("a"); x86::Gp v[32]; - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, a); 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 src = cc.newInt32("src"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dstHi); funcNode->setArg(1, dstLo); funcNode->setArg(2, vLo); @@ -1115,7 +1115,7 @@ public: x86::Gp dst = cc.newIntPtr("dst"); x86::Gp src = cc.newIntPtr("src"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, src); @@ -1168,7 +1168,7 @@ public: x86::Gp b = cc.newInt32("b"); x86::Gp dummy = cc.newInt32("dummy"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, a); funcNode->setArg(1, b); @@ -1212,7 +1212,7 @@ public: x86::Gp src1 = cc.newInt32("src1"); x86::Gp dst0 = cc.newIntPtr("dst0"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, src0); funcNode->setArg(1, src1); funcNode->setArg(2, dst0); @@ -1262,7 +1262,7 @@ public: x86::Gp vShlParam = cc.newInt32("vShlParam"); x86::Gp vRorParam = cc.newInt32("vRorParam"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, var); funcNode->setArg(2, vShlParam); @@ -1310,7 +1310,7 @@ public: x86::Gp rSum = cc.newUInt32("rSum"); x86::Gp x[kCount]; - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, rPtr); for (uint32_t i = 0; i < kCount; i++) { @@ -1391,7 +1391,7 @@ public: virtual void compile(x86::Compiler& cc) { x86::Gp v = cc.newUInt32("v"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v); cc.mov(v.r8(), 0xFF); @@ -1429,7 +1429,7 @@ public: x86::Gp src = cc.newIntPtr("src"); x86::Gp cnt = cc.newIntPtr("cnt"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, src); funcNode->setArg(2, cnt); @@ -1471,7 +1471,7 @@ public: Label L_1 = cc.newLabel(); Label L_2 = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v1); funcNode->setArg(1, v2); @@ -1523,7 +1523,7 @@ public: Label L_3 = cc.newLabel(); Label L_4 = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v1); funcNode->setArg(1, v2); @@ -1582,7 +1582,7 @@ public: Label L_Loop = cc.newLabel(); Label L_Exit = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v1); funcNode->setArg(1, v2); @@ -1642,7 +1642,7 @@ public: Label L_Loop2 = cc.newLabel(); Label L_Exit = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v1); funcNode->setArg(1, v2); @@ -1699,7 +1699,7 @@ public: x86::Gp x = cc.newInt8("x"); x86::Gp y = cc.newInt32("y"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); cc.movsx(y, x); @@ -1736,7 +1736,7 @@ public: virtual void compile(x86::Compiler& cc) { x86::Gp x = cc.newInt32("x"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(2, x); cc.ret(x); @@ -1769,7 +1769,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp var[8]; for (uint32_t i = 0; i < 8; i++) { @@ -1825,7 +1825,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp p = cc.newIntPtr("p"); x86::Xmm xv[7]; @@ -1876,7 +1876,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp p = cc.newIntPtr("p"); x86::Xmm xv[7]; @@ -1936,7 +1936,7 @@ public: x86::Xmm a = cc.newXmm("aXmm"); x86::Xmm b = cc.newXmm("bXmm"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, a); funcNode->setArg(1, b); @@ -1984,7 +1984,7 @@ public: virtual void compile(x86::Compiler& cc) { x86::Xmm x = cc.newXmmSs("x"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); cc.ret(x); @@ -2020,7 +2020,7 @@ public: x86::Xmm x = cc.newXmmSs("x"); x86::Xmm y = cc.newXmmSs("y"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); funcNode->setArg(1, y); @@ -2058,7 +2058,7 @@ public: virtual void compile(x86::Compiler& cc) { x86::Xmm x = cc.newXmmSd("x"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); cc.ret(x); @@ -2094,7 +2094,7 @@ public: x86::Xmm x = cc.newXmmSd("x"); x86::Xmm y = cc.newXmmSd("y"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); funcNode->setArg(1, y); @@ -2132,7 +2132,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Mem stack = cc.newStack(kSize, 1); stack.setSize(1); @@ -2206,7 +2206,7 @@ public: Label L_Loop = cc.newLabel(); // Create base labels we use Label L_Exit = cc.newLabel(); // in our function. - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, src); funcNode->setArg(2, cnt); @@ -2283,7 +2283,7 @@ public: x86::Gp a = cc.newInt32("a"); x86::Gp b = cc.newInt32("b"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, cond); funcNode->setArg(1, a); funcNode->setArg(2, b); @@ -2422,7 +2422,7 @@ public: x86::Gp v1 = cc.newInt32("v1"); x86::Gp v2 = cc.newInt32("v2"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, v0); funcNode->setArg(1, v1); funcNode->setArg(2, v2); @@ -2434,7 +2434,7 @@ public: // Call a function. InvokeNode* invokeNode; - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, v2); invokeNode->setArg(1, v1); invokeNode->setArg(2, v0); @@ -2474,7 +2474,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); const int kTokenSize = 32; @@ -2494,19 +2494,19 @@ public: cc.lea(p2, s2); // Try to corrupt the stack if wrongly allocated. - cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignatureT(CallConvId::kCDecl)); + cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignature::build(CallConvId::kCDecl)); invokeNode->setArg(0, p1); invokeNode->setArg(1, imm(token)); invokeNode->setArg(2, imm(kTokenSize)); invokeNode->setRet(0, p1); - cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignatureT(CallConvId::kCDecl)); + cc.invoke(&invokeNode, imm((void*)memcpy), FuncSignature::build(CallConvId::kCDecl)); invokeNode->setArg(0, p2); invokeNode->setArg(1, imm(token)); invokeNode->setArg(2, imm(kTokenSize)); invokeNode->setRet(0, p2); - cc.invoke(&invokeNode, imm((void*)memcmp), FuncSignatureT(CallConvId::kCDecl)); + cc.invoke(&invokeNode, imm((void*)memcmp), FuncSignature::build(CallConvId::kCDecl)); invokeNode->setArg(0, p1); invokeNode->setArg(1, p2); invokeNode->setArg(2, imm(kTokenSize)); @@ -2557,7 +2557,7 @@ public: x86::Gp y = cc.newInt32("y"); x86::Gp z = cc.newInt32("z"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); funcNode->setArg(1, y); funcNode->setArg(2, z); @@ -2565,7 +2565,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kStdCall)); + FuncSignature::build(CallConvId::kStdCall)); invokeNode->setArg(0, x); invokeNode->setArg(1, y); invokeNode->setArg(2, z); @@ -2608,16 +2608,16 @@ public: virtual void compile(x86::Compiler& cc) { x86::Gp var = cc.newInt32("var"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, var); InvokeNode* invokeNode; - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kFastCall)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kFastCall)); invokeNode->setArg(0, var); invokeNode->setRet(0, var); - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kFastCall)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kFastCall)); invokeNode->setArg(0, var); invokeNode->setRet(0, var); @@ -2666,7 +2666,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp resultPtr = cc.newIntPtr("resultPtr"); x86::Gp aPtr = cc.newIntPtr("aPtr"); @@ -2695,7 +2695,7 @@ public: cc.movdqu(bXmm, x86::ptr(bPtr)); InvokeNode* invokeNode; - cc.invoke(&invokeNode, pFn, FuncSignatureT(ccId)); + cc.invoke(&invokeNode, pFn, FuncSignature::build(ccId)); invokeNode->setArg(0, aXmm); invokeNode->setArg(1, bXmm); @@ -2748,8 +2748,8 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncSignatureT f1Sig(CallConvId::kCDecl); - FuncSignatureT f2Sig(CallConvId::kLightCall2); + FuncSignature f1Sig = FuncSignature::build(CallConvId::kCDecl); + FuncSignature f2Sig = FuncSignature::build(CallConvId::kLightCall2); FuncNode* f1Node = cc.newFunc(f1Sig); FuncNode* f2Node = cc.newFunc(f2Sig); @@ -2850,7 +2850,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); // Prepare. x86::Gp va = cc.newInt32("va"); @@ -2879,7 +2879,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, va); invokeNode->setArg(1, vb); invokeNode->setArg(2, vc); @@ -2926,7 +2926,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); // Prepare. x86::Gp a = cc.newInt32("a"); @@ -2936,7 +2936,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, a); invokeNode->setArg(1, a); invokeNode->setArg(2, a); @@ -2979,7 +2979,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); // Prepare. x86::Gp rv = cc.newInt32("rv"); @@ -2988,7 +2988,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)X86Test_FuncCallManyArgs::calledFunc), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, imm(0x03)); invokeNode->setArg(1, imm(0x12)); @@ -3045,7 +3045,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); // Prepare. x86::Gp rv = cc.newInt32("rv"); @@ -3054,7 +3054,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, imm(0x01)); invokeNode->setArg(1, imm(0x02)); @@ -3106,7 +3106,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); // Prepare. x86::Gp arg1 = cc.newInt32(); @@ -3124,7 +3124,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, arg1); invokeNode->setArg(1, arg2); @@ -3168,7 +3168,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Xmm a = cc.newXmmSs("a"); x86::Xmm b = cc.newXmmSs("b"); @@ -3179,7 +3179,7 @@ public: // Call function. InvokeNode* invokeNode; - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, a); invokeNode->setArg(1, b); invokeNode->setRet(0, ret); @@ -3218,7 +3218,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Xmm a = cc.newXmmSd("a"); x86::Xmm b = cc.newXmmSd("b"); @@ -3228,7 +3228,7 @@ public: funcNode->setArg(1, b); InvokeNode* invokeNode; - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, a); invokeNode->setArg(1, b); invokeNode->setRet(0, ret); @@ -3270,7 +3270,7 @@ public: InvokeNode* invokeNode; x86::Gp result; - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, x); funcNode->setArg(1, y); funcNode->setArg(2, op); @@ -3290,7 +3290,7 @@ public: cc.bind(opAdd); result = cc.newInt32("result_1"); - cc.invoke(&invokeNode, (uint64_t)calledFuncAdd, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, (uint64_t)calledFuncAdd, FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, x); invokeNode->setArg(1, y); invokeNode->setRet(0, result); @@ -3299,7 +3299,7 @@ public: cc.bind(opMul); result = cc.newInt32("result_2"); - cc.invoke(&invokeNode, (uint64_t)calledFuncMul, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, (uint64_t)calledFuncMul, FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, x); invokeNode->setArg(1, y); invokeNode->setRet(0, result); @@ -3353,7 +3353,7 @@ public: x86::Gp acc0 = cc.newInt32("acc0"); x86::Gp acc1 = cc.newInt32("acc1"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, buf); cc.mov(acc0, 0); @@ -3368,7 +3368,7 @@ public: cc.mov(ptr, buf); cc.mov(idx, int(i)); - cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignatureT(CallConvId::kFastCall)); + cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignature::build(CallConvId::kFastCall)); invokeNode->setArg(0, ptr); invokeNode->setArg(1, idx); invokeNode->setRet(0, ret); @@ -3378,7 +3378,7 @@ public: cc.mov(ptr, buf); cc.mov(idx, int(i)); - cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignatureT(CallConvId::kFastCall)); + cc.invoke(&invokeNode, (uint64_t)calledFunc, FuncSignature::build(CallConvId::kFastCall)); invokeNode->setArg(0, ptr); invokeNode->setArg(1, idx); invokeNode->setRet(0, ret); @@ -3422,7 +3422,7 @@ public: x86::Gp val = cc.newInt32("val"); Label skip = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, val); cc.cmp(val, 1); @@ -3434,7 +3434,7 @@ public: InvokeNode* invokeNode; - cc.invoke(&invokeNode, funcNode->label(), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, funcNode->label(), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, tmp); invokeNode->setRet(0, tmp); cc.mul(cc.newInt32(), val, tmp); @@ -3470,7 +3470,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp a0 = cc.newInt32("a0"); x86::Gp a1 = cc.newInt32("a1"); @@ -3488,7 +3488,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost, 1)); + FuncSignature::build(CallConvId::kHost, 1)); invokeNode->setArg(0, imm(4)); invokeNode->setArg(1, a0); invokeNode->setArg(2, a1); @@ -3538,7 +3538,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Xmm a0 = cc.newXmmSd("a0"); x86::Xmm a1 = cc.newXmmSd("a1"); @@ -3556,7 +3556,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)calledFunc), - FuncSignatureT(CallConvId::kHost, 1)); + FuncSignature::build(CallConvId::kHost, 1)); invokeNode->setArg(0, imm(4)); invokeNode->setArg(1, a0); invokeNode->setArg(2, a1); @@ -3606,7 +3606,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); if (cc.is64Bit()) { x86::Gp reg = cc.newUInt64(); @@ -3669,7 +3669,7 @@ public: static void dummy(int, int) {} virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp a = cc.newInt32("a"); x86::Gp b = cc.newInt32("b"); @@ -3681,7 +3681,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)dummy), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, a); invokeNode->setArg(1, b); @@ -3717,7 +3717,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp p = cc.newIntPtr("p"); x86::Xmm arg = cc.newXmmSd("arg"); @@ -3729,7 +3729,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)op), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, arg); invokeNode->setRet(0, ret); @@ -3767,7 +3767,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp p = cc.newIntPtr("p"); x86::Xmm arg = cc.newXmmSd("arg"); @@ -3779,7 +3779,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, imm((void*)op), - FuncSignatureT(CallConvId::kHost)); + FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, arg); invokeNode->setRet(0, ret); @@ -3822,12 +3822,12 @@ public: virtual void compile(x86::Compiler& cc) { InvokeNode* invokeNode; - FuncSignatureBuilder funcSignature; + FuncSignature funcSignature; funcSignature.setCallConvId(CallConvId::kHost); funcSignature.setRet(TypeId::kFloat64); cc.addFunc(funcSignature); - FuncSignatureBuilder invokeSignature; + FuncSignature invokeSignature; invokeSignature.setCallConvId(CallConvId::kHost); invokeSignature.setRet(TypeId::kFloat64); @@ -3868,7 +3868,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp pFn = cc.newIntPtr("pFn"); x86::Gp vars[16]; @@ -3887,7 +3887,7 @@ public: } InvokeNode* invokeNode; - cc.invoke(&invokeNode, pFn, FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, pFn, FuncSignature::build(CallConvId::kHost)); for (i = 1; i < regCount; i++) if (vars[i].isValid()) @@ -3925,7 +3925,7 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); constexpr uint32_t kCount = 16; @@ -3941,7 +3941,7 @@ public: v[i] = cc.newUInt32("v%u", i); InvokeNode* invokeNode; - cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, imm((void*)calledFunc), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, argVal); invokeNode->setRet(0, retVal); @@ -3988,12 +3988,12 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* mainFunc = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* mainFunc = cc.addFunc(FuncSignature::build(CallConvId::kHost)); mainFunc->frame().setAvxEnabled(); mainFunc->frame().setAvxCleanup(); // We need a Windows calling convention to test this properly also on a non-Windows machine. - FuncNode* helperFunc = cc.newFunc(FuncSignatureT(CallConvId::kX64Windows)); + FuncNode* helperFunc = cc.newFunc(FuncSignature::build(CallConvId::kX64Windows)); helperFunc->frame().setAvxEnabled(); helperFunc->frame().setAvxCleanup(); @@ -4020,7 +4020,7 @@ public: InvokeNode* invokeNode; cc.invoke(&invokeNode, helperFunc->label(), - FuncSignatureT(CallConvId::kX64Windows)); + FuncSignature::build(CallConvId::kX64Windows)); invokeNode->setArg(0, tPtr); invokeNode->setArg(1, bPtr); @@ -4103,7 +4103,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp v0 = cc.newInt32("v0"); x86::Gp v1 = cc.newInt32("v1"); @@ -4145,7 +4145,7 @@ public: } virtual void compile(x86::Compiler& cc) { - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp v0 = cc.newInt32("v0"); x86::Gp v1 = cc.newInt32("v1"); @@ -4186,7 +4186,7 @@ struct X86Test_MiscMultiRet : public X86TestCase { } virtual void compile(x86::Compiler& cc) { - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); x86::Gp op = cc.newInt32("op"); x86::Gp a = cc.newInt32("a"); @@ -4278,8 +4278,8 @@ public: } virtual void compile(x86::Compiler& cc) { - FuncNode* f1Node = cc.newFunc(FuncSignatureT(CallConvId::kHost)); - FuncNode* f2Node = cc.newFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* f1Node = cc.newFunc(FuncSignature::build(CallConvId::kHost)); + FuncNode* f2Node = cc.newFunc(FuncSignature::build(CallConvId::kHost)); { x86::Gp a = cc.newInt32("a"); @@ -4290,7 +4290,7 @@ public: f1Node->setArg(1, b); InvokeNode* invokeNode; - cc.invoke(&invokeNode, f2Node->label(), FuncSignatureT(CallConvId::kHost)); + cc.invoke(&invokeNode, f2Node->label(), FuncSignature::build(CallConvId::kHost)); invokeNode->setArg(0, a); invokeNode->setArg(1, b); invokeNode->setRet(0, a); @@ -4349,7 +4349,7 @@ public: x86::Gp b = cc.newIntPtr("b"); Label tramp = cc.newLabel(); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kFastCall)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kFastCall)); funcNode->setArg(0, a); funcNode->setArg(1, b); diff --git a/test/asmjit_test_emitters.cpp b/test/asmjit_test_emitters.cpp index c5ac0b2..aa14639 100644 --- a/test/asmjit_test_emitters.cpp +++ b/test/asmjit_test_emitters.cpp @@ -34,7 +34,7 @@ static void makeRawFunc(x86::Emitter* emitter) noexcept { // Create and initialize `FuncDetail` and `FuncFrame`. FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), emitter->environment()); + func.init(FuncSignature::build(CallConvId::kHost), emitter->environment()); FuncFrame frame; frame.init(func); @@ -70,7 +70,7 @@ static void makeCompiledFunc(x86::Compiler* cc) noexcept { x86::Xmm vec0 = cc->newXmm("vec0"); x86::Xmm vec1 = cc->newXmm("vec1"); - FuncNode* funcNode = cc->addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc->addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, src_a); funcNode->setArg(2, src_b); diff --git a/test/asmjit_test_misc.h b/test/asmjit_test_misc.h index 0839d30..8dc2799 100644 --- a/test/asmjit_test_misc.h +++ b/test/asmjit_test_misc.h @@ -170,7 +170,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -202,7 +202,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -242,7 +242,7 @@ static void generateSseAlphaBlend(asmjit::BaseEmitter& emitter, bool emitPrologE Xmm v6 = cc.newXmm("v6"); Xmm v7 = cc.newXmm("v7"); - FuncNode* funcNode = cc.addFunc(FuncSignatureT(CallConvId::kHost)); + FuncNode* funcNode = cc.addFunc(FuncSignature::build(CallConvId::kHost)); funcNode->setArg(0, dst); funcNode->setArg(1, src); funcNode->setArg(2, i); diff --git a/test/asmjit_test_perf_a64.cpp b/test/asmjit_test_perf_a64.cpp index 054959b..a7a8bc5 100644 --- a/test/asmjit_test_perf_a64.cpp +++ b/test/asmjit_test_perf_a64.cpp @@ -582,7 +582,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) { if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -608,7 +608,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) { if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -633,7 +633,7 @@ static void generateGpSequence(BaseEmitter& emitter, bool emitPrologEpilog) { a64::Gp c = cc.newIntPtr("c"); a64::Gp d = cc.newIntPtr("d"); - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); generateGpSequenceInternal(cc, a, b, c, d); cc.endFunc(); } diff --git a/test/asmjit_test_perf_x86.cpp b/test/asmjit_test_perf_x86.cpp index 462a0b3..907bcf4 100644 --- a/test/asmjit_test_perf_x86.cpp +++ b/test/asmjit_test_perf_x86.cpp @@ -335,7 +335,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -361,7 +361,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -386,7 +386,7 @@ static void generateGpSequence(BaseEmitter& emitter, InstForm form, bool emitPro Gp c = cc.newIntPtr("c"); Gp d = cc.newIntPtr("d"); - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); generateGpSequenceInternal(cc, form, a, b, c, d); cc.endFunc(); } @@ -927,7 +927,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -948,7 +948,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -974,7 +974,7 @@ static void generateSseSequence(BaseEmitter& emitter, InstForm form, bool emitPr Xmm c = cc.newXmm("c"); Xmm d = cc.newXmm("d"); - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); generateSseSequenceInternal(cc, form, gp, a, b, c, d); cc.endFunc(); } @@ -2134,7 +2134,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -2155,7 +2155,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -2181,7 +2181,7 @@ static void generateAvxSequence(BaseEmitter& emitter, InstForm form, bool emitPr Ymm c = cc.newYmm("c"); Ymm d = cc.newYmm("d"); - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); generateAvxSequenceInternal(cc, form, gp, a, b, c, d); cc.endFunc(); } @@ -4928,7 +4928,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -4949,7 +4949,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi if (emitPrologEpilog) { FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), cc.environment()); + func.init(FuncSignature::build(CallConvId::kHost), cc.environment()); FuncFrame frame; frame.init(func); @@ -4979,7 +4979,7 @@ static void generateAvx512Sequence(BaseEmitter& emitter, InstForm form, bool emi KReg kB = cc.newKq("kB"); KReg kC = cc.newKq("kC"); - cc.addFunc(FuncSignatureT(CallConvId::kHost)); + cc.addFunc(FuncSignature::build(CallConvId::kHost)); generateAvx512SequenceInternal(cc, form, gp, kA, kB, kC, vecA, vecB, vecC, vecD); cc.endFunc(); } diff --git a/test/asmjit_test_x86_sections.cpp b/test/asmjit_test_x86_sections.cpp index 31a88ab..9a08aee 100644 --- a/test/asmjit_test_x86_sections.cpp +++ b/test/asmjit_test_x86_sections.cpp @@ -70,7 +70,7 @@ int main() { Label data = a.newLabel(); FuncDetail func; - func.init(FuncSignatureT(CallConvId::kHost), code.environment()); + func.init(FuncSignature::build(CallConvId::kHost), code.environment()); FuncFrame frame; frame.init(func);