1#ifndef PROTEUS_COMPILER_INTERFACE_RUNTIME_CONSTANT_INFO_H
2#define PROTEUS_COMPILER_INTERFACE_RUNTIME_CONSTANT_INFO_H
62 std::optional<RuntimeConstantArrayInfo>
OptArrInfo = std::nullopt;
63 std::optional<RuntimeConstantObjectInfo>
OptObjInfo = std::nullopt;
90 std::to_string(Type));
94 int32_t Size,
bool PassByValue)
99 std::to_string(Type));
114 if constexpr (std::is_same_v<T, bool>) {
115 return *
static_cast<bool *
>(Arg);
116 }
else if constexpr (std::is_same_v<T, int8_t>) {
117 return *
static_cast<int8_t *
>(Arg);
118 }
else if constexpr (std::is_same_v<T, int32_t>) {
119 return *
static_cast<int32_t *
>(Arg);
120 }
else if constexpr (std::is_same_v<T, int64_t>) {
121 return *
static_cast<int64_t *
>(Arg);
122 }
else if constexpr (std::is_same_v<T, float>) {
123 return *
static_cast<float *
>(Arg);
124 }
else if constexpr (std::is_same_v<T, double>) {
125 return *
static_cast<double *
>(Arg);
126 }
else if constexpr (std::is_same_v<T, long double>) {
127 return *
static_cast<long double *
>(Arg);
128 }
else if constexpr (std::is_pointer_v<T>) {
129 return static_cast<T
>(*(intptr_t *)Arg);
140 void *Arg =
Args[RC.Pos];
145 <<
"Value " <<
RC.Value.BoolVal <<
"\n");
150 <<
"Value " <<
RC.Value.Int8Val <<
"\n");
155 <<
"Value " <<
RC.Value.Int32Val <<
"\n");
160 <<
"Value " <<
RC.Value.Int64Val <<
"\n");
165 <<
"Value " <<
RC.Value.FloatVal <<
"\n");
170 <<
"Value " <<
RC.Value.DoubleVal <<
"\n");
178 <<
"Value " << std::to_string(
RC.Value.LongDoubleVal) <<
"\n");
186 if (
RCInfo.OptArrInfo->OptNumEltsRCInfo) {
189 RCInfo.OptArrInfo->OptNumEltsRCInfo->Type;
201 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
210 <<
"Value Blob ptr " << Blob.get() <<
"\n");
216 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
225 <<
"Value Blob ptr " << Blob.get() <<
"\n");
231 std::shared_ptr<unsigned char[]> Blob{
new unsigned char[
SizeInBytes]};
239 <<
"Value Blob ptr " << Blob.get() <<
"\n");
243 std::shared_ptr<unsigned char[]> Blob{
244 new unsigned char[
RCInfo.OptObjInfo->Size]};
246 void *
Src = (
RCInfo.OptObjInfo->PassByValue
250 std::memcpy(Blob.get(),
Src,
RCInfo.OptObjInfo->Size);
253 RCInfo.OptObjInfo->PassByValue, Blob};
char int void ** Args
Definition CompilerInterfaceHost.cpp:20
#define PROTEUS_DBG(x)
Definition Debug.h:9
static llvm::raw_ostream & logs(const std::string &Name)
Definition Logger.hpp:19
Definition ObjectCacheChain.cpp:26
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
void reportFatalError(const llvm::Twine &Reason, const char *FILE, unsigned Line)
Definition Error.cpp:14
T getRuntimeConstantValue(void *Arg)
Definition CompilerInterfaceRuntimeConstantInfo.h:113
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:136
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:18
int32_t Pos
Definition CompilerInterfaceRuntimeConstantInfo.h:20
RuntimeConstantType Type
Definition CompilerInterfaceRuntimeConstantInfo.h:19
RuntimeConstantArgInfo(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceRuntimeConstantInfo.h:22
Definition CompilerInterfaceRuntimeConstantInfo.h:30
int32_t NumElts
Definition CompilerInterfaceRuntimeConstantInfo.h:31
RuntimeConstantType EltType
Definition CompilerInterfaceRuntimeConstantInfo.h:32
RuntimeConstantArrayInfo(RuntimeConstantType EltType, RuntimeConstantType NumEltsType, int32_t NumEltsPos)
Definition CompilerInterfaceRuntimeConstantInfo.h:39
std::optional< RuntimeConstantArgInfo > OptNumEltsRCInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:34
RuntimeConstantArrayInfo(int32_t NumElts, RuntimeConstantType EltType)
Definition CompilerInterfaceRuntimeConstantInfo.h:36
Definition CompilerInterfaceRuntimeConstantInfo.h:60
bool operator!=(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:105
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceRuntimeConstantInfo.h:65
std::optional< RuntimeConstantArrayInfo > OptArrInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:62
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, int32_t NumElts, RuntimeConstantType EltType)
Definition CompilerInterfaceRuntimeConstantInfo.h:71
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, int32_t Size, bool PassByValue)
Definition CompilerInterfaceRuntimeConstantInfo.h:93
bool operator<(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:108
bool operator==(const RuntimeConstantInfo &O) const
Definition CompilerInterfaceRuntimeConstantInfo.h:102
RuntimeConstantArgInfo ArgInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:61
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos, RuntimeConstantType EltType, RuntimeConstantType NumEltsType, int32_t NumEltsPos)
Definition CompilerInterfaceRuntimeConstantInfo.h:82
std::optional< RuntimeConstantObjectInfo > OptObjInfo
Definition CompilerInterfaceRuntimeConstantInfo.h:63
Definition CompilerInterfaceRuntimeConstantInfo.h:49
bool PassByValue
Definition CompilerInterfaceRuntimeConstantInfo.h:51
int32_t Size
Definition CompilerInterfaceRuntimeConstantInfo.h:50
RuntimeConstantObjectInfo(int32_t Size, bool PassByValue)
Definition CompilerInterfaceRuntimeConstantInfo.h:53
Definition CompilerInterfaceTypes.h:72