LLVM  14.0.0git
OrcRTBootstrap.cpp
Go to the documentation of this file.
1 //===------------------------ OrcRTBootstrap.cpp --------------------------===//
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 #include "OrcRTBootstrap.h"
10 
15 
16 #define DEBUG_TYPE "orc"
17 
18 using namespace llvm::orc::shared;
19 
20 namespace llvm {
21 namespace orc {
22 namespace rt_bootstrap {
23 
24 template <typename WriteT, typename SPSWriteT>
26 writeUIntsWrapper(const char *ArgData, size_t ArgSize) {
28  ArgData, ArgSize,
29  [](std::vector<WriteT> Ws) {
30  for (auto &W : Ws)
31  *W.Addr.template toPtr<decltype(W.Value) *>() = W.Value;
32  })
33  .release();
34 }
35 
37 writeBuffersWrapper(const char *ArgData, size_t ArgSize) {
39  ArgData, ArgSize,
40  [](std::vector<tpctypes::BufferWrite> Ws) {
41  for (auto &W : Ws)
42  memcpy(W.Addr.template toPtr<char *>(), W.Buffer.data(),
43  W.Buffer.size());
44  })
45  .release();
46 }
47 
49 runAsMainWrapper(const char *ArgData, size_t ArgSize) {
51  ArgData, ArgSize,
52  [](ExecutorAddr MainAddr,
53  std::vector<std::string> Args) -> int64_t {
54  return runAsMain(MainAddr.toPtr<int (*)(int, char *[])>(), Args);
55  })
56  .release();
57 }
58 
80 }
81 
82 } // end namespace rt_bootstrap
83 } // end namespace orc
84 } // end namespace llvm
llvm::orc::ExecutorAddr
Represents an address in the executor process.
Definition: ExecutorAddress.h:37
llvm::orc::rt_bootstrap::addTo
void addTo(StringMap< ExecutorAddr > &M)
Definition: OrcRTBootstrap.cpp:59
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::SPSSequence
SPS tag type for sequences.
Definition: SimplePackedSerialization.h:193
llvm::orc::shared::CWrapperFunctionResult
Definition: WrapperFunctionUtils.h:33
llvm::RISCVFenceField::W
@ W
Definition: RISCVBaseInfo.h:208
llvm::orc::shared::WrapperFunction
Definition: WrapperFunctionUtils.h:425
WrapperFunctionUtils.h
llvm::orc::shared
Definition: ELFNixPlatform.h:243
llvm::AtomicOrderingCABI::release
@ release
OrcRTBootstrap.h
llvm::orc::shared::SPSTuple
SPS tag type for tuples.
Definition: SimplePackedSerialization.h:183
handle
then ret i32 result Tail recursion elimination should handle
Definition: README.txt:355
llvm::orc::rt::MemoryWriteUInt64sWrapperName
const char * MemoryWriteUInt64sWrapperName
Definition: OrcRTBridge.cpp:35
llvm::orc::rt::MemoryWriteUInt32sWrapperName
const char * MemoryWriteUInt32sWrapperName
Definition: OrcRTBridge.cpp:33
int
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
Definition: README.txt:536
llvm::orc::rt::MemoryWriteBuffersWrapperName
const char * MemoryWriteBuffersWrapperName
Definition: OrcRTBridge.cpp:37
llvm::orc::runAsMain
int runAsMain(int(*Main)(int, char *[]), ArrayRef< std::string > Args, Optional< StringRef > ProgramName=None)
Run a main function, returning the result.
Definition: TargetExecutionUtils.cpp:16
RegisterEHFrames.h
llvm::orc::ExecutorAddr::fromPtr
static ExecutorAddr fromPtr(T *Value)
Create an ExecutorAddr from the given pointer.
Definition: ExecutorAddress.h:46
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::orc::rt::MemoryWriteUInt16sWrapperName
const char * MemoryWriteUInt16sWrapperName
Definition: OrcRTBridge.cpp:31
llvm::orc::rt::DeregisterEHFrameSectionCustomDirectWrapperName
const char * DeregisterEHFrameSectionCustomDirectWrapperName
Definition: OrcRTBridge.cpp:41
llvm::orc::rt_bootstrap::writeUIntsWrapper
static llvm::orc::shared::CWrapperFunctionResult writeUIntsWrapper(const char *ArgData, size_t ArgSize)
Definition: OrcRTBootstrap.cpp:26
memcpy
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
llvm::orc::rt::MemoryWriteUInt8sWrapperName
const char * MemoryWriteUInt8sWrapperName
Definition: OrcRTBridge.cpp:29
llvm::orc::tpctypes::UIntWrite
Definition: TargetProcessControlTypes.h:128
llvm_orc_deregisterEHFrameSectionCustomDirectWrapper
llvm::orc::shared::CWrapperFunctionResult llvm_orc_deregisterEHFrameSectionCustomDirectWrapper(const char *EHFrameSectionAddr, uint64_t Size)
An eh-frame deregistration utility suitable for use as a support function call.
Definition: RegisterEHFrames.cpp:171
llvm::orc::rt_bootstrap::writeBuffersWrapper
static llvm::orc::shared::CWrapperFunctionResult writeBuffersWrapper(const char *ArgData, size_t ArgSize)
Definition: OrcRTBootstrap.cpp:37
llvm_orc_registerEHFrameSectionCustomDirectWrapper
llvm::orc::shared::CWrapperFunctionResult llvm_orc_registerEHFrameSectionCustomDirectWrapper(const char *EHFrameSectionAddr, uint64_t Size)
An eh-frame registration utility suitable for use as a support function call.
Definition: RegisterEHFrames.cpp:162
llvm::orc::rt::RegisterEHFrameSectionCustomDirectWrapperName
const char * RegisterEHFrameSectionCustomDirectWrapperName
Definition: OrcRTBridge.cpp:39
llvm::orc::rt::RunAsMainWrapperName
const char * RunAsMainWrapperName
Definition: OrcRTBridge.cpp:43
llvm::orc::ExecutorAddr::toPtr
T toPtr() const
Cast this ExecutorAddr to a pointer of the given type.
Definition: ExecutorAddress.h:53
TargetExecutionUtils.h
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::orc::rt_bootstrap::runAsMainWrapper
static llvm::orc::shared::CWrapperFunctionResult runAsMainWrapper(const char *ArgData, size_t ArgSize)
Definition: OrcRTBootstrap.cpp:49
OrcRTBridge.h