Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
CompilerInterfaceTypes.h
Go to the documentation of this file.
1//===-- CompilerInterfaceTypes.cpp -- JIT compiler interface types --===//
2//
3// Part of the Proteus Project, under the Apache License v2.0 with LLVM
4// Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef PROTEUS_COMPILERINTERFACETYPES_H
12#define PROTEUS_COMPILERINTERFACETYPES_H
13
14#include <cstring>
15#include <stdint.h>
16
17namespace proteus {
18
29
37
39 using RuntimeConstantValue = union {
40 bool BoolVal;
41 int8_t Int8Val;
42 int32_t Int32Val;
43 int64_t Int64Val;
44 float FloatVal;
45 double DoubleVal;
46 long double LongDoubleVal;
47 // TODO: This allows pointer as runtime constant values. How useful is
48 // that?
49 void *PtrVal;
50 };
53 int32_t Pos;
54 int32_t Slot{-1};
55
57 : Type(Type), Pos(Pos) {
58 std::memset(&Value, 0, sizeof(RuntimeConstantValue));
59 }
60 explicit RuntimeConstant() {
61 std::memset(&Value, 0, sizeof(RuntimeConstantValue));
62 }
63
64 RuntimeConstant(const RuntimeConstant &) = default;
68};
69
70} // namespace proteus
71
72#endif
Definition Dispatcher.cpp:14
RuntimeConstantType
Definition CompilerInterfaceTypes.h:19
@ INT32
Definition CompilerInterfaceTypes.h:22
@ INT64
Definition CompilerInterfaceTypes.h:23
@ FLOAT
Definition CompilerInterfaceTypes.h:24
@ LONG_DOUBLE
Definition CompilerInterfaceTypes.h:26
@ INT8
Definition CompilerInterfaceTypes.h:21
@ BOOL
Definition CompilerInterfaceTypes.h:20
@ PTR
Definition CompilerInterfaceTypes.h:27
@ DOUBLE
Definition CompilerInterfaceTypes.h:25
Definition CompilerInterfaceTypes.h:30
RuntimeConstantInfo(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceTypes.h:34
RuntimeConstantType Type
Definition CompilerInterfaceTypes.h:31
int32_t Pos
Definition CompilerInterfaceTypes.h:32
Definition CompilerInterfaceTypes.h:38
double DoubleVal
Definition CompilerInterfaceTypes.h:45
RuntimeConstantValue Value
Definition CompilerInterfaceTypes.h:51
RuntimeConstantType Type
Definition CompilerInterfaceTypes.h:52
union { bool BoolVal RuntimeConstantValue
Definition CompilerInterfaceTypes.h:40
RuntimeConstant & operator=(RuntimeConstant &&)=default
int32_t Int32Val
Definition CompilerInterfaceTypes.h:42
RuntimeConstant(const RuntimeConstant &)=default
int64_t Int64Val
Definition CompilerInterfaceTypes.h:43
RuntimeConstant()
Definition CompilerInterfaceTypes.h:60
int32_t Slot
Definition CompilerInterfaceTypes.h:54
RuntimeConstant & operator=(const RuntimeConstant &)=default
float FloatVal
Definition CompilerInterfaceTypes.h:44
RuntimeConstant(RuntimeConstantType Type, int32_t Pos)
Definition CompilerInterfaceTypes.h:56
long double LongDoubleVal
Definition CompilerInterfaceTypes.h:46
int8_t Int8Val
Definition CompilerInterfaceTypes.h:41
void * PtrVal
Definition CompilerInterfaceTypes.h:49
int32_t Pos
Definition CompilerInterfaceTypes.h:53
RuntimeConstant(RuntimeConstant &&)=default