LLVM  14.0.0git
IndirectionUtils.cpp
Go to the documentation of this file.
1 //===---- IndirectionUtils.cpp - Utilities for call indirection in Orc ----===//
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 
10 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/ADT/Triple.h"
13 #include "llvm/IR/IRBuilder.h"
14 #include "llvm/Support/Format.h"
16 #include <sstream>
17 
18 using namespace llvm;
19 using namespace llvm::orc;
20 
21 namespace {
22 
23 class CompileCallbackMaterializationUnit : public orc::MaterializationUnit {
24 public:
25  using CompileFunction = JITCompileCallbackManager::CompileFunction;
26 
27  CompileCallbackMaterializationUnit(SymbolStringPtr Name,
28  CompileFunction Compile)
30  nullptr),
31  Name(std::move(Name)), Compile(std::move(Compile)) {}
32 
33  StringRef getName() const override { return "<Compile Callbacks>"; }
34 
35 private:
36  void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
39  // No dependencies, so these calls cannot fail.
40  cantFail(R->notifyResolved(Result));
41  cantFail(R->notifyEmitted());
42  }
43 
44  void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
45  llvm_unreachable("Discard should never occur on a LMU?");
46  }
47 
49  CompileFunction Compile;
50 };
51 
52 } // namespace
53 
54 namespace llvm {
55 namespace orc {
56 
58 void IndirectStubsManager::anchor() {}
59 
62  if (auto TrampolineAddr = TP->getTrampoline()) {
63  auto CallbackName =
64  ES.intern(std::string("cc") + std::to_string(++NextCallbackId));
65 
66  std::lock_guard<std::mutex> Lock(CCMgrMutex);
67  AddrToSymbol[*TrampolineAddr] = CallbackName;
68  cantFail(
69  CallbacksJD.define(std::make_unique<CompileCallbackMaterializationUnit>(
70  std::move(CallbackName), std::move(Compile))));
71  return *TrampolineAddr;
72  } else
73  return TrampolineAddr.takeError();
74 }
75 
77  JITTargetAddress TrampolineAddr) {
79 
80  {
81  std::unique_lock<std::mutex> Lock(CCMgrMutex);
82  auto I = AddrToSymbol.find(TrampolineAddr);
83 
84  // If this address is not associated with a compile callback then report an
85  // error to the execution session and return ErrorHandlerAddress to the
86  // callee.
87  if (I == AddrToSymbol.end()) {
88  Lock.unlock();
89  std::string ErrMsg;
90  {
91  raw_string_ostream ErrMsgStream(ErrMsg);
92  ErrMsgStream << "No compile callback for trampoline at "
93  << format("0x%016" PRIx64, TrampolineAddr);
94  }
95  ES.reportError(
96  make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode()));
97  return ErrorHandlerAddress;
98  } else
99  Name = I->second;
100  }
101 
102  if (auto Sym =
103  ES.lookup(makeJITDylibSearchOrder(
105  Name))
106  return Sym->getAddress();
107  else {
108  llvm::dbgs() << "Didn't find callback.\n";
109  // If anything goes wrong materializing Sym then report it to the session
110  // and return the ErrorHandlerAddress;
111  ES.reportError(Sym.takeError());
112  return ErrorHandlerAddress;
113  }
114 }
115 
118  JITTargetAddress ErrorHandlerAddress) {
119  switch (T.getArch()) {
120  default:
121  return make_error<StringError>(
122  std::string("No callback manager available for ") + T.str(),
124  case Triple::aarch64:
125  case Triple::aarch64_32: {
127  return CCMgrT::Create(ES, ErrorHandlerAddress);
128  }
129 
130  case Triple::x86: {
132  return CCMgrT::Create(ES, ErrorHandlerAddress);
133  }
134 
135  case Triple::mips: {
137  return CCMgrT::Create(ES, ErrorHandlerAddress);
138  }
139  case Triple::mipsel: {
141  return CCMgrT::Create(ES, ErrorHandlerAddress);
142  }
143 
144  case Triple::mips64:
145  case Triple::mips64el: {
147  return CCMgrT::Create(ES, ErrorHandlerAddress);
148  }
149 
150  case Triple::x86_64: {
151  if (T.getOS() == Triple::OSType::Win32) {
153  return CCMgrT::Create(ES, ErrorHandlerAddress);
154  } else {
156  return CCMgrT::Create(ES, ErrorHandlerAddress);
157  }
158  }
159 
160  }
161 }
162 
163 std::function<std::unique_ptr<IndirectStubsManager>()>
165  switch (T.getArch()) {
166  default:
167  return [](){
168  return std::make_unique<
170  };
171 
172  case Triple::aarch64:
173  case Triple::aarch64_32:
174  return [](){
175  return std::make_unique<
177  };
178 
179  case Triple::x86:
180  return [](){
181  return std::make_unique<
183  };
184 
185  case Triple::mips:
186  return [](){
187  return std::make_unique<
189  };
190 
191  case Triple::mipsel:
192  return [](){
193  return std::make_unique<
195  };
196 
197  case Triple::mips64:
198  case Triple::mips64el:
199  return [](){
200  return std::make_unique<
202  };
203 
204  case Triple::x86_64:
205  if (T.getOS() == Triple::OSType::Win32) {
206  return [](){
207  return std::make_unique<
209  };
210  } else {
211  return [](){
212  return std::make_unique<
214  };
215  }
216 
217  }
218 }
219 
221  Constant *AddrIntVal =
223  Constant *AddrPtrVal =
224  ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
225  PointerType::get(&FT, 0));
226  return AddrPtrVal;
227 }
228 
230  const Twine &Name, Constant *Initializer) {
231  auto IP = new GlobalVariable(M, &PT, false, GlobalValue::ExternalLinkage,
232  Initializer, Name, nullptr,
233  GlobalValue::NotThreadLocal, 0, true);
234  IP->setVisibility(GlobalValue::HiddenVisibility);
235  return IP;
236 }
237 
238 void makeStub(Function &F, Value &ImplPointer) {
239  assert(F.isDeclaration() && "Can't turn a definition into a stub.");
240  assert(F.getParent() && "Function isn't in a module.");
241  Module &M = *F.getParent();
242  BasicBlock *EntryBlock = BasicBlock::Create(M.getContext(), "entry", &F);
243  IRBuilder<> Builder(EntryBlock);
244  LoadInst *ImplAddr = Builder.CreateLoad(F.getType(), &ImplPointer);
245  std::vector<Value*> CallArgs;
246  for (auto &A : F.args())
247  CallArgs.push_back(&A);
248  CallInst *Call = Builder.CreateCall(F.getFunctionType(), ImplAddr, CallArgs);
249  Call->setTailCall();
250  Call->setAttributes(F.getAttributes());
251  if (F.getReturnType()->isVoidTy())
252  Builder.CreateRetVoid();
253  else
254  Builder.CreateRet(Call);
255 }
256 
257 std::vector<GlobalValue *> SymbolLinkagePromoter::operator()(Module &M) {
258  std::vector<GlobalValue *> PromotedGlobals;
259 
260  for (auto &GV : M.global_values()) {
261  bool Promoted = true;
262 
263  // Rename if necessary.
264  if (!GV.hasName())
265  GV.setName("__orc_anon." + Twine(NextId++));
266  else if (GV.getName().startswith("\01L"))
267  GV.setName("__" + GV.getName().substr(1) + "." + Twine(NextId++));
268  else if (GV.hasLocalLinkage())
269  GV.setName("__orc_lcl." + GV.getName() + "." + Twine(NextId++));
270  else
271  Promoted = false;
272 
273  if (GV.hasLocalLinkage()) {
274  GV.setLinkage(GlobalValue::ExternalLinkage);
275  GV.setVisibility(GlobalValue::HiddenVisibility);
276  Promoted = true;
277  }
278  GV.setUnnamedAddr(GlobalValue::UnnamedAddr::None);
279 
280  if (Promoted)
281  PromotedGlobals.push_back(&GV);
282  }
283 
284  return PromotedGlobals;
285 }
286 
288  ValueToValueMapTy *VMap) {
289  Function *NewF =
290  Function::Create(cast<FunctionType>(F.getValueType()),
291  F.getLinkage(), F.getName(), &Dst);
292  NewF->copyAttributesFrom(&F);
293 
294  if (VMap) {
295  (*VMap)[&F] = NewF;
296  auto NewArgI = NewF->arg_begin();
297  for (auto ArgI = F.arg_begin(), ArgE = F.arg_end(); ArgI != ArgE;
298  ++ArgI, ++NewArgI)
299  (*VMap)[&*ArgI] = &*NewArgI;
300  }
301 
302  return NewF;
303 }
304 
306  ValueMaterializer *Materializer,
307  Function *NewF) {
308  assert(!OrigF.isDeclaration() && "Nothing to move");
309  if (!NewF)
310  NewF = cast<Function>(VMap[&OrigF]);
311  else
312  assert(VMap[&OrigF] == NewF && "Incorrect function mapping in VMap.");
313  assert(NewF && "Function mapping missing from VMap.");
314  assert(NewF->getParent() != OrigF.getParent() &&
315  "moveFunctionBody should only be used to move bodies between "
316  "modules.");
317 
318  SmallVector<ReturnInst *, 8> Returns; // Ignore returns cloned.
319  CloneFunctionInto(NewF, &OrigF, VMap,
321  nullptr, nullptr, Materializer);
322  OrigF.deleteBody();
323 }
324 
326  ValueToValueMapTy *VMap) {
327  GlobalVariable *NewGV = new GlobalVariable(
328  Dst, GV.getValueType(), GV.isConstant(),
329  GV.getLinkage(), nullptr, GV.getName(), nullptr,
331  NewGV->copyAttributesFrom(&GV);
332  if (VMap)
333  (*VMap)[&GV] = NewGV;
334  return NewGV;
335 }
336 
338  ValueToValueMapTy &VMap,
339  ValueMaterializer *Materializer,
340  GlobalVariable *NewGV) {
341  assert(OrigGV.hasInitializer() && "Nothing to move");
342  if (!NewGV)
343  NewGV = cast<GlobalVariable>(VMap[&OrigGV]);
344  else
345  assert(VMap[&OrigGV] == NewGV &&
346  "Incorrect global variable mapping in VMap.");
347  assert(NewGV->getParent() != OrigGV.getParent() &&
348  "moveGlobalVariableInitializer should only be used to move "
349  "initializers between modules");
350 
351  NewGV->setInitializer(MapValue(OrigGV.getInitializer(), VMap, RF_None,
352  nullptr, Materializer));
353 }
354 
356  ValueToValueMapTy &VMap) {
357  assert(OrigA.getAliasee() && "Original alias doesn't have an aliasee?");
358  auto *NewA = GlobalAlias::create(OrigA.getValueType(),
359  OrigA.getType()->getPointerAddressSpace(),
360  OrigA.getLinkage(), OrigA.getName(), &Dst);
361  NewA->copyAttributesFrom(&OrigA);
362  VMap[&OrigA] = NewA;
363  return NewA;
364 }
365 
366 void cloneModuleFlagsMetadata(Module &Dst, const Module &Src,
367  ValueToValueMapTy &VMap) {
368  auto *MFs = Src.getModuleFlagsMetadata();
369  if (!MFs)
370  return;
371  for (auto *MF : MFs->operands())
372  Dst.addModuleFlag(MapMetadata(MF, VMap));
373 }
374 
375 } // End namespace orc.
376 } // End namespace llvm.
llvm::RF_None
@ RF_None
Definition: ValueMapper.h:67
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:922
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::MapMetadata
Metadata * MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Lookup or compute a mapping for a piece of metadata.
Definition: ValueMapper.h:230
llvm::orc::LocalJITCompileCallbackManager
Manage compile callbacks for in-process JITs.
Definition: IndirectionUtils.h:234
llvm::GlobalVariable::copyAttributesFrom
void copyAttributesFrom(const GlobalVariable *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a GlobalVariable) fro...
Definition: Globals.cpp:412
llvm::GlobalValue::getLinkage
LinkageTypes getLinkage() const
Definition: GlobalValue.h:467
llvm::GlobalValue::HiddenVisibility
@ HiddenVisibility
The GV is hidden.
Definition: GlobalValue.h:64
T
llvm::Function
Definition: Function.h:62
llvm::Triple::x86
@ x86
Definition: Triple.h:83
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::PointerType::get
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Definition: Type.cpp:729
llvm::GlobalValue::NotThreadLocal
@ NotThreadLocal
Definition: GlobalValue.h:179
llvm::orc::cloneModuleFlagsMetadata
void cloneModuleFlagsMetadata(Module &Dst, const Module &Src, ValueToValueMapTy &VMap)
Clone module flags metadata into the destination module.
Definition: IndirectionUtils.cpp:366
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::GlobalValue::UnnamedAddr::None
@ None
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition: DerivedTypes.h:734
llvm::IRBuilder<>
llvm::GlobalVariable
Definition: GlobalVariable.h:40
llvm::PointerType::getAddressSpace
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:687
llvm::GlobalAlias
Definition: GlobalAlias.h:27
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MapValue
Value * MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Look up or compute a value in the value map.
Definition: ValueMapper.h:208
llvm::CloneFunctionChangeType::DifferentModule
@ DifferentModule
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:84
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
STLExtras.h
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:54
Format.h
OrcABISupport.h
llvm::Triple::mips64
@ mips64
Definition: Triple.h:64
llvm::orc::MaterializationUnit
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Definition: Core.h:664
llvm::JITEvaluatedSymbol
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:229
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:198
llvm::GlobalVariable::hasInitializer
bool hasInitializer() const
Definitions have initializers, declarations don't.
Definition: GlobalVariable.h:92
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::Lock
static sys::Mutex Lock
Definition: NVPTXUtilities.cpp:39
llvm::GlobalValue::isDeclaration
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Definition: Globals.cpp:228
llvm::orc::createIRTypedAddress
Constant * createIRTypedAddress(FunctionType &FT, JITTargetAddress Addr)
Build a function pointer of FunctionType with the given constant address.
Definition: IndirectionUtils.cpp:220
llvm::Triple::mips64el
@ mips64el
Definition: Triple.h:65
llvm::GlobalValue::getThreadLocalMode
ThreadLocalMode getThreadLocalMode() const
Definition: GlobalValue.h:252
llvm::orc
Definition: CompileOnDemandLayer.h:57
llvm::orc::SymbolLinkagePromoter::operator()
std::vector< GlobalValue * > operator()(Module &M)
Promote symbols in the given module.
Definition: IndirectionUtils.cpp:257
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
IP
Definition: NVPTXLowerArgs.cpp:166
llvm::orc::cloneGlobalVariableDecl
GlobalVariable * cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV, ValueToValueMapTy *VMap=nullptr)
Clone a global variable declaration into a new module.
Definition: IndirectionUtils.cpp:325
llvm::Function::copyAttributesFrom
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
Definition: Function.cpp:712
llvm::ConstantInt::get
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
Definition: Constants.cpp:925
llvm::orc::createLocalCompileCallbackManager
Expected< std::unique_ptr< JITCompileCallbackManager > > createLocalCompileCallbackManager(const Triple &T, ExecutionSession &ES, JITTargetAddress ErrorHandlerAddress)
Create a local compile callback manager.
Definition: IndirectionUtils.cpp:117
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
uint64_t
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:578
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
llvm::orc::createLocalIndirectStubsManagerBuilder
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indriect stubs manager builder.
Definition: IndirectionUtils.cpp:164
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap< SymbolStringPtr, JITSymbolFlags >
I
#define I(x, y, z)
Definition: MD5.cpp:59
Cloning.h
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:632
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:139
IRBuilder.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::sys::SmartMutex::unlock
bool unlock()
Definition: Mutex.h:46
llvm::ConstantExpr::getCast
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
Definition: Constants.cpp:1988
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:650
Triple.h
llvm::orc::createImplPointer
GlobalVariable * createImplPointer(PointerType &PT, Module &M, const Twine &Name, Constant *Initializer)
Create a function pointer with the given type, name, and initializer in the given Module.
Definition: IndirectionUtils.cpp:229
llvm::orc::cloneGlobalAliasDecl
GlobalAlias * cloneGlobalAliasDecl(Module &Dst, const GlobalAlias &OrigA, ValueToValueMapTy &VMap)
Clone a global alias declaration into a new module.
Definition: IndirectionUtils.cpp:355
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::cantFail
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:737
llvm::BasicBlock::Create
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Definition: BasicBlock.h:100
llvm::orc::cloneFunctionDecl
Function * cloneFunctionDecl(Module &Dst, const Function &F, ValueToValueMapTy *VMap=nullptr)
Clone a function declaration into a new module.
Definition: IndirectionUtils.cpp:287
llvm::orc::moveGlobalVariableInitializer
void moveGlobalVariableInitializer(GlobalVariable &OrigGV, ValueToValueMapTy &VMap, ValueMaterializer *Materializer=nullptr, GlobalVariable *NewGV=nullptr)
Move global variable GV from its parent module to cloned global declaration in a different module.
Definition: IndirectionUtils.cpp:337
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::GlobalAlias::getAliasee
const Constant * getAliasee() const
Definition: GlobalAlias.h:73
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
llvm::ValueMap
See the file comment.
Definition: ValueMap.h:85
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:127
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:175
llvm::orc::makeStub
void makeStub(Function &F, Value &ImplPointer)
Turn a function declaration into a stub function that makes an indirect call using the given function...
Definition: IndirectionUtils.cpp:238
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
Definition: Type.cpp:242
llvm::orc::JITCompileCallbackManager::CompileFunction
std::function< JITTargetAddress()> CompileFunction
Definition: IndirectionUtils.h:198
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::GlobalAlias::create
static GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
Definition: Globals.cpp:480
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::Triple::mipsel
@ mipsel
Definition: Triple.h:63
llvm::JITTargetAddress
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Definition: JITSymbol.h:42
llvm::Function::arg_begin
arg_iterator arg_begin()
Definition: Function.h:749
llvm::orc::LocalIndirectStubsManager
IndirectStubsManager implementation for the host architecture, e.g.
Definition: IndirectionUtils.h:363
llvm::GlobalValue::ExternalLinkage
@ ExternalLinkage
Externally visible function.
Definition: GlobalValue.h:48
llvm::GlobalVariable::isConstant
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
Definition: GlobalVariable.h:153
llvm::orc::JITCompileCallbackManager::executeCompileCallback
JITTargetAddress executeCompileCallback(JITTargetAddress TrampolineAddr)
Execute the callback for the given trampoline id.
Definition: IndirectionUtils.cpp:76
llvm::to_string
std::string to_string(const T &Value)
Definition: ScopedPrinter.h:63
IndirectionUtils.h
llvm::GlobalValue::getType
PointerType * getType() const
Global values are always pointers.
Definition: GlobalValue.h:271
llvm::GlobalValue::getValueType
Type * getValueType() const
Definition: GlobalValue.h:273
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1475
llvm::CloneFunctionInto
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, ValueToValueMapTy &VMap, CloneFunctionChangeType Changes, SmallVectorImpl< ReturnInst * > &Returns, const char *NameSuffix="", ClonedCodeInfo *CodeInfo=nullptr, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Clone OldFunc into NewFunc, transforming the old arguments into references to VMap values.
Definition: CloneFunction.cpp:83
llvm::orc::TrampolinePool::~TrampolinePool
virtual ~TrampolinePool()
Definition: IndirectionUtils.cpp:57
llvm::orc::JITCompileCallbackManager::getCompileCallback
Expected< JITTargetAddress > getCompileCallback(CompileFunction Compile)
Reserve a compile callback.
Definition: IndirectionUtils.cpp:61
llvm::orc::JITDylibLookupFlags::MatchAllSymbols
@ MatchAllSymbols
llvm::orc::moveFunctionBody
void moveFunctionBody(Function &OrigF, ValueToValueMapTy &VMap, ValueMaterializer *Materializer=nullptr, Function *NewF=nullptr)
Move the body of function 'F' to a cloned function declaration in a different module (See related clo...
Definition: IndirectionUtils.cpp:305
llvm::ValueMaterializer
This is a class that can be implemented by clients to materialize Values on demand.
Definition: ValueMapper.h:50
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::Triple::mips
@ mips
Definition: Triple.h:62
llvm::orc::makeJITDylibSearchOrder
JITDylibSearchOrder makeJITDylibSearchOrder(ArrayRef< JITDylib * > JDs, JITDylibLookupFlags Flags=JITDylibLookupFlags::MatchExportedSymbolsOnly)
Convenience function for creating a search order from an ArrayRef of JITDylib*, all with the same fla...
Definition: Core.h:158
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:52
llvm::GlobalVariable::setInitializer
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
Definition: Globals.cpp:389
llvm::JITSymbolFlags::Exported
@ Exported
Definition: JITSymbol.h:85
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103