plugify 1.2.8
Loading...
Searching...
No Matches
signarure.hpp
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7#include "plugify/value_type.hpp"
8#include "plg/inplace_vector.hpp"
9
10namespace plugify {
19 enum class CallConv : uint8_t {
20 CDecl = 0,
21 StdCall = 1,
23 FastCall = 2,
24 VectorCall = 3,
25 ThisCall = 4,
27 RegParm1 = 5,
28 RegParm2 = 6,
29 RegParm3 = 7,
30 LightCall2 = 16,
31 LightCall3 = 17,
32 LightCall4 = 18,
33 SoftFloat = 30,
34 HardFloat = 31,
35 X64SystemV = 32,
36 X64Windows = 33,
37 MaxValue = X64Windows
38 };
39
44 struct Signature {
45 inline static const size_t kMaxFuncArgs = 32;
46 inline static const uint8_t kNoVarArgs = 0xffU;
47
48 CallConv callConv{CallConv::CDecl};
49 ValueType retType{ValueType::Void};
50 uint8_t varIndex{kNoVarArgs};
52
53 void AddArg(ValueType type) {
54 argTypes.push_back(type);
55 }
56
57 size_t ArgCount() const noexcept {
58 return argTypes.size();
59 }
60
61 bool HasRet() const noexcept {
62 return retType != ValueType::Void;
63 }
64
65 void SetRet(ValueType type) noexcept {
66 retType = type;
67 }
68 };
69
73 struct CallName {
74 static constexpr std::string_view CDecl = "cdecl";
75 static constexpr std::string_view StdCall = "stdcall";
76 static constexpr std::string_view FastCall = "fastcall";
77 static constexpr std::string_view VectorCall = "vectorcall";
78 static constexpr std::string_view ThisCall = "thiscall";
79 static constexpr std::string_view RegParm1 = "regparm1";
80 static constexpr std::string_view RegParm2 = "regparm2";
81 static constexpr std::string_view RegParm3 = "regparm3";
82 static constexpr std::string_view LightCall2 = "lightcall2";
83 static constexpr std::string_view LightCall3 = "lightcall3";
84 static constexpr std::string_view LightCall4 = "lightcall4";
85 static constexpr std::string_view SoftFloat = "softfloat";
86 static constexpr std::string_view HardFloat = "hardfloat";
87 static constexpr std::string_view X64SystemV = "x64systemv";
88 static constexpr std::string_view X64Windows = "x64windows";
89 static constexpr std::string_view MaxValue = "maxvalue";
90 };
91}
Namespace containing string representations of CallConv enum values.
Definition signarure.hpp:73
Replacement for asmjit::FuncSignature using ValueType.
Definition signarure.hpp:44
CallConv callConv
Calling convention.
Definition signarure.hpp:48
ValueType retType
Return type.
Definition signarure.hpp:49
uint8_t varIndex
Variable index for variadic functions.
Definition signarure.hpp:50
std::inplace_vector< ValueType, kMaxFuncArgs > argTypes
Argument types.
Definition signarure.hpp:51