Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
JitEngine.hpp
Go to the documentation of this file.
1//===-- JitEngine.hpp -- Base JIT Engine header --===//
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_JITENGINE_HPP
12#define PROTEUS_JITENGINE_HPP
13
14#include <cstdlib>
15#include <optional>
16#include <string>
17
18#include <llvm/ADT/DenseMap.h>
19#include <llvm/Demangle/Demangle.h>
20#include <llvm/IR/Module.h>
21#include <llvm/Target/TargetMachine.h>
22
23#include "proteus/Config.hpp"
24#include "proteus/CoreLLVM.hpp"
25#include "proteus/Debug.h"
26#include "proteus/Hashing.hpp"
27#include "proteus/Logger.hpp"
28
29namespace proteus {
30
31using namespace llvm;
32
33class JitEngine {
34public:
36 void optimizeIR(Module &M, StringRef Arch, char OptLevel = '3',
37 unsigned CodegenOptLevel = 3);
38
40
41 void enable() { Config::get().ProteusDisable = false; }
42
43 void disable() { Config::get().ProteusDisable = true; }
44
45protected:
46 SmallVector<RuntimeConstant>
47 getRuntimeConstantValues(void **KernelArgs,
48 ArrayRef<RuntimeConstantInfo *> RCInfoArray);
49
50 JitEngine();
51
52 std::string mangleSuffix(HashT &HashValue);
53};
54
55} // namespace proteus
56
57#endif
ArrayRef< RuntimeConstantInfo * > RCInfoArray
Definition CompilerInterfaceHost.cpp:24
bool ProteusDisable
Definition Config.hpp:121
static Config & get()
Definition Config.hpp:112
Definition Hashing.hpp:19
Definition JitEngine.hpp:33
JitEngine()
Definition JitEngine.cpp:29
bool isProteusDisabled()
Definition JitEngine.hpp:39
std::string mangleSuffix(HashT &HashValue)
Definition JitEngine.cpp:45
InitLLVMTargets Init
Definition JitEngine.hpp:35
SmallVector< RuntimeConstant > getRuntimeConstantValues(void **KernelArgs, ArrayRef< RuntimeConstantInfo * > RCInfoArray)
Definition JitEngine.cpp:55
void disable()
Definition JitEngine.hpp:43
void optimizeIR(Module &M, StringRef Arch, char OptLevel='3', unsigned CodegenOptLevel=3)
Definition JitEngine.cpp:49
void enable()
Definition JitEngine.hpp:41
Definition Dispatcher.cpp:14
Definition CoreLLVM.hpp:141