LLVM  14.0.0git
SimpleExecutorMemoryManager.h
Go to the documentation of this file.
1 //===---------------- SimpleExecutorMemoryManager.h -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // A simple allocator class suitable for basic remote-JIT use.
10 //
11 // FIXME: The functionality in this file should be moved to the ORC runtime.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
16 #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
17 
18 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/Support/Error.h"
24 
25 #include <mutex>
26 
27 namespace llvm {
28 namespace orc {
29 namespace rt_bootstrap {
30 
31 /// Simple page-based allocator.
33 public:
35 
38  Error deallocate(const std::vector<ExecutorAddr> &Bases);
39 
40  Error shutdown() override;
42 
43 private:
44  struct Allocation {
45  size_t Size = 0;
46  std::vector<tpctypes::WrapperFunctionCall> DeallocationActions;
47  };
48 
50 
51  Error deallocateImpl(void *Base, Allocation &A);
52 
54  reserveWrapper(const char *ArgData, size_t ArgSize);
55 
57  finalizeWrapper(const char *ArgData, size_t ArgSize);
58 
60  deallocateWrapper(const char *ArgData, size_t ArgSize);
61 
62  std::mutex M;
63  AllocationsMap Allocations;
64 };
65 
66 } // end namespace rt_bootstrap
67 } // end namespace orc
68 } // end namespace llvm
69 
70 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_SIMPLEEXECUTORMEMORYMANAGER_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
TargetProcessControlTypes.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::orc::shared::CWrapperFunctionResult
Definition: WrapperFunctionUtils.h:33
Error.h
WrapperFunctionUtils.h
DenseMap.h
llvm::orc::ExecutorBootstrapService
Definition: ExecutorBootstrapService.h:24
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::addBootstrapSymbols
void addBootstrapSymbols(StringMap< ExecutorAddr > &M) override
Definition: SimpleExecutorMemoryManager.cpp:199
llvm::orc::tpctypes::FinalizeRequest
Definition: TargetProcessControlTypes.h:123
ExecutorBootstrapService.h
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::~SimpleExecutorMemoryManager
virtual ~SimpleExecutorMemoryManager()
Definition: SimpleExecutorMemoryManager.cpp:20
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::finalize
Error finalize(tpctypes::FinalizeRequest &FR)
Definition: SimpleExecutorMemoryManager.cpp:36
uint64_t
llvm::DenseMap< void *, Allocation >
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager
Simple page-based allocator.
Definition: SimpleExecutorMemoryManager.h:32
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::deallocate
Error deallocate(const std::vector< ExecutorAddr > &Bases)
Definition: SimpleExecutorMemoryManager.cpp:150
ExecutorAddress.h
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::allocate
Expected< ExecutorAddr > allocate(uint64_t Size)
Definition: SimpleExecutorMemoryManager.cpp:24
llvm::orc::rt_bootstrap::SimpleExecutorMemoryManager::shutdown
Error shutdown() override
Definition: SimpleExecutorMemoryManager.cpp:185
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58