28  assert(SrcJD && 
"Tracking on Null Source .impl dylib");
 
   29  std::lock_guard<std::mutex> Lockit(ConcurrentAccess);
 
   30  for (
auto &
I : ImplMaps) {
 
   31    auto It = Maps.insert({
I.first, {
I.second.Aliasee, SrcJD}});
 
   33    assert(It.second && 
"ImplSymbols are already tracked for this Symbol?");
 
 
   40  assert(
Ptr && 
" Null Address Received in orc_speculate_for ");
 
   51      {Mangle(
"__orc_speculator"), ThisPtr},                
 
   52      {Mangle(
"__orc_speculate_for"), SpeculateForEntryPtr} 
 
 
   62  assert(TSM && 
"Speculation Layer received Null Module ?");
 
   66    auto &MContext = M.getContext();
 
   73                         "__orc_speculate_for", &M);
 
   76        nullptr, 
"__orc_speculator");
 
   82    for (
auto &Fn : M.getFunctionList()) {
 
   83      if (!Fn.isDeclaration()) {
 
   85        auto IRNames = QueryAnalysis(Fn);
 
   93              ConstantInt::get(LoadValueTy, 0),
 
   94              "__orc_speculate.guard.for." + Fn.getName());
 
   95          SpeculatorGuard->setAlignment(
Align(1));
 
  101              MContext, 
"__orc_speculate.block", &Fn, &ProgramEntry);
 
  103              MContext, 
"__orc_speculate.decision.block", &Fn, SpeculateBlock);
 
  105          assert(SpeculateDecisionBlock == &Fn.getEntryBlock() &&
 
  106                 "SpeculateDecisionBlock not updated?");
 
  110              Mutator.
CreateLoad(LoadValueTy, SpeculatorGuard, 
"guard.value");
 
  113              Mutator.
CreateICmpEQ(LoadGuard, ConstantInt::get(LoadValueTy, 0),
 
  114                                   "compare.to.speculate");
 
  115          Mutator.
CreateCondBr(CanSpeculate, SpeculateBlock, &ProgramEntry);
 
  118          auto ImplAddrToUint =
 
  120          Mutator.
CreateCall(RuntimeCallTy, RuntimeCall,
 
  121                             {SpeclAddr, ImplAddrToUint});
 
  122          Mutator.
CreateStore(ConstantInt::get(LoadValueTy, 1),
 
  127                 "IR builder association mismatch?");
 
  128          S.registerSymbols(internToJITSymbols(*IRNames),
 
  129                            &R->getTargetJITDylib());
 
  136         "Speculation Instrumentation breaks IR?");
 
  138  NextLayer.emit(std::move(R), std::move(TSM));
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Module.h This file contains the declarations for the Module class.
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Lightweight error class with error context and mandatory checking.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
@ InternalLinkage
Rename collisions when linking (static functions).
@ ExternalLinkage
Externally visible function.
BasicBlock * GetInsertBlock() const
Value * CreateICmpEQ(Value *LHS, Value *RHS, const Twine &Name="")
BranchInst * CreateCondBr(Value *Cond, BasicBlock *True, BasicBlock *False, MDNode *BranchWeights=nullptr, MDNode *Unpredictable=nullptr)
Create a conditional 'br Cond, TrueDest, FalseDest' instruction.
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args={}, const Twine &Name="", MDNode *FPMathTag=nullptr)
BranchInst * CreateBr(BasicBlock *Dest)
Create an unconditional 'br label X' instruction.
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
A Module instance is used to store all the information related to an LLVM module.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
Represents an address in the executor process.
static ExecutorAddr fromPtr(T *Ptr, UnwrapFn &&Unwrap=UnwrapFn())
Create an ExecutorAddr from the given pointer.
Represents a defining location for a JIT symbol.
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
LLVM_ABI void trackImpls(SymbolAliasMap ImplMaps, JITDylib *SrcJD)
Represents a JIT'd dynamic library.
Error define(std::unique_ptr< MaterializationUnitType > &&MU, ResourceTrackerSP RT=nullptr)
Define all symbols provided by the materialization unit to be part of this JITDylib.
Mangles symbol names then uniques them in the context of an ExecutionSession.
LLVM_ABI Error addSpeculationRuntime(JITDylib &JD, MangleAndInterner &Mangle)
Define symbols for this Speculator object (__orc_speculator) and the speculation runtime entry point ...
An LLVM Module together with a shared ThreadSafeContext.
decltype(auto) withModuleDo(Func &&F)
Locks the associated ThreadSafeContext and calls the given function on the contained Module.
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
DenseMap< SymbolStringPtr, SymbolAliasMapEntry > SymbolAliasMap
A map of Symbols to (Symbol, Flags) pairs.
This is an optimization pass for GlobalISel generic memory operations.
This struct is a compact representation of a valid (non-zero power of two) alignment.