1#ifndef PROTEUS_COMPILER_INTERFACE_RUNTIME_CONSTANT_INFO_H
2#define PROTEUS_COMPILER_INTERFACE_RUNTIME_CONSTANT_INFO_H
63 std::optional<RuntimeConstantArrayInfo>
OptArrInfo = std::nullopt;
64 std::optional<RuntimeConstantObjectInfo>
OptObjInfo = std::nullopt;
91 std::to_string(Type));
95 int32_t Size,
bool PassByValue)
100 std::to_string(Type));
115 if constexpr (std::is_same_v<T, bool>) {
116 return *
static_cast<bool *
>(Arg);
117 }
else if constexpr (std::is_same_v<T, int8_t>) {
118 return *
static_cast<int8_t *
>(Arg);
119 }
else if constexpr (std::is_same_v<T, int32_t>) {
120 return *
static_cast<int32_t *
>(Arg);
121 }
else if constexpr (std::is_same_v<T, int64_t>) {
122 return *
static_cast<int64_t *
>(Arg);
123 }
else if constexpr (std::is_same_v<T, float>) {
124 return *
static_cast<float *
>(Arg);
125 }
else if constexpr (std::is_same_v<T, double>) {
126 return *
static_cast<double *
>(Arg);
127 }
else if constexpr (std::is_same_v<T, long double>) {
128 return *
static_cast<long double *
>(Arg);
129 }
else if constexpr (std::is_pointer_v<T>) {
130 return static_cast<T
>(*(intptr_t *)Arg);
141 void *Arg =
Args[RC.Pos];
146 <<
"Value " <<
RC.Value.BoolVal <<
"\n");
151 <<
"Value " <<
RC.Value.Int8Val <<
"\n");
156 <<
"Value " <<
RC.Value.Int32Val <<
"\n");
161 <<
"Value " <<
RC.Value.Int64Val <<
"\n");
166 <<
"Value " <<
RC.Value.FloatVal <<
"\n");
171 <<
"Value " <<
RC.Value.DoubleVal <<
"\n");
179 <<
"Value " << std::to_string(
RC.Value.LongDoubleVal) <<
"\n");
187 if (
RCInfo.OptArrInfo->OptNumEltsRCInfo) {
190 RCInfo.OptArrInfo->OptNumEltsRCInfo->Type;
202 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
211 <<
"Value Blob ptr " << Blob.get() <<
"\n");
217 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
226 <<
"Value Blob ptr " << Blob.get() <<
"\n");
232 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
240 <<
"Value Blob ptr " << Blob.get() <<
"\n");
244 std::shared_ptr<unsigned char[]> Blob{
245 new unsigned char[
RCInfo.OptObjInfo->Size]};
247 void *
Src = (
RCInfo.OptObjInfo->PassByValue
251 std::memcpy(Blob.get(),
Src,
RCInfo.OptObjInfo->Size);
254 RCInfo.OptObjInfo->PassByValue, Blob};
char int void ** Args
Definition CompilerInterfaceHost.cpp:21
#define PROTEUS_DBG(x)
Definition Debug.h:9
#define PROTEUS_FATAL_ERROR(x)
Definition Error.h:7
static llvm::raw_ostream & logs(const std::string &Name)
Definition Logger.hpp:19
Definition BuiltinsCUDA.cpp:4
static int Pos
Definition JitInterface.hpp:105
RuntimeConstantType
Definition CompilerInterfaceTypes.h:20
@ ARRAY
Definition CompilerInterfaceTypes.h:33
@ VECTOR
Definition CompilerInterfaceTypes.h:32
@ INT32
Definition CompilerInterfaceTypes.h:25
@ INT64
Definition CompilerInterfaceTypes.h:26
@ FLOAT
Definition CompilerInterfaceTypes.h:27
@ STATIC_ARRAY
Definition CompilerInterfaceTypes.h:31
@ LONG_DOUBLE
Definition CompilerInterfaceTypes.h:29
@ INT8
Definition CompilerInterfaceTypes.h:24
@ BOOL
Definition CompilerInterfaceTypes.h:23
@ OBJECT
Definition CompilerInterfaceTypes.h:34
@ PTR
Definition CompilerInterfaceTypes.h:30
@ DOUBLE
Definition CompilerInterfaceTypes.h:28
T getRuntimeConstantValue(void *Arg)
Definition CompilerInterfaceRuntimeConstantInfo.h:114
size_t NumElts
Definition JitInterface.hpp:43
std::string toString(CodegenOption Option)
Definition Config.hpp:26
size_t getSizeInBytes(RuntimeConstantType RCType)
Definition RuntimeConstantTypeHelpers.h:73
RuntimeConstant dispatchGetRuntimeConstantValue(void **Args, const RuntimeConstantInfo &RCInfo)
Definition CompilerInterfaceRuntimeConstantInfo.h:137
Definition CompilerInterfaceTypes.h:41
int32_t NumElts
Definition CompilerInterfaceTypes.h:42
RuntimeConstantType EltType
Definition CompilerInterfaceTypes.h:43
Definition CompilerInterfaceTypes.h:50
int32_t Size
Definition CompilerInterfaceTypes.h:51
Definition CompilerInterfaceRuntimeConstantInfo.h:19
int32_t Pos
Definition CompilerInterfaceRuntimeConstantInfo.h:21
RuntimeConstantType Type
Definition CompilerInterfaceRuntimeConstantInfo.h:20
RuntimeConstantArgInfo(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceRuntimeConstantInfo.h:23
Definition CompilerInterfaceRuntimeConstantInfo.h:31
int32_t NumElts
Definition CompilerInterfaceRuntimeConstantInfo.h:32
RuntimeConstantType EltType
Definition CompilerInterfaceRuntimeConstantInfo.h:33
RuntimeConstantArrayInfo(RuntimeConstantType EltType, RuntimeConstantType NumEltsType, int32_t NumEltsPos)
Definition CompilerInterfaceRuntimeConstantInfo.h:40
std::optional< RuntimeConstantArgInfo > OptNumEltsRCInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:35
RuntimeConstantArrayInfo(int32_t NumElts, RuntimeConstantType EltType)
Definition CompilerInterfaceRuntimeConstantInfo.h:37
Definition CompilerInterfaceRuntimeConstantInfo.h:61
bool operator!=(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:106
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceRuntimeConstantInfo.h:66
std::optional< RuntimeConstantArrayInfo > OptArrInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:63
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, int32_t NumElts, RuntimeConstantType EltType)
Definition CompilerInterfaceRuntimeConstantInfo.h:72
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, int32_t Size, bool PassByValue)
Definition CompilerInterfaceRuntimeConstantInfo.h:94
bool operator<(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:109
bool operator==(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:103
RuntimeConstantArgInfo ArgInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:62
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, RuntimeConstantType EltType, RuntimeConstantType NumEltsType, int32_t NumEltsPos)
Definition CompilerInterfaceRuntimeConstantInfo.h:83
std::optional< RuntimeConstantObjectInfo > OptObjInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:64
Definition CompilerInterfaceRuntimeConstantInfo.h:50
bool PassByValue
Definition CompilerInterfaceRuntimeConstantInfo.h:52
int32_t Size
Definition CompilerInterfaceRuntimeConstantInfo.h:51
RuntimeConstantObjectInfo(int32_t Size, bool PassByValue)
Definition CompilerInterfaceRuntimeConstantInfo.h:54
Definition CompilerInterfaceTypes.h:72