16#define DEBUG_TYPE "orc"
21 : ES(ES), Mode(fromTriple(ES.getTargetTriple(), ABIName)) {}
24 : ES(ES), Mode(Mode) {}
27 : ES(ES), Mode(fromDataLayout(
DL)) {}
38 return ES.intern(Name);
40 if (Name.front() ==
'\1')
41 return ES.intern(Name.substr(1));
43 if (Name[0] ==
'?' && doNotMangleLeadingQuestionMark())
44 return ES.intern(Name);
47 return ES.intern((
"_" + Name).str());
49 return ES.intern(Name);
53MangleAndInterner::fromDataLayoutStr(
StringRef DLStr) {
55 if (!
Spec.starts_with(
"m:"))
57 auto ModeStr =
Spec.drop_front(2);
58 assert(ModeStr.size() == 1 &&
59 "invalid data layout string from Triple::computeDataLayout");
83MangleAndInterner::fromTriple(
const Triple &TT, StringRef ABIName) {
84 return fromDataLayoutStr(
TT.computeDataLayout(ABIName));
88MangleAndInterner::fromDataLayout(
const DataLayout &
DL) {
89 return fromDataLayoutStr(
DL.getStringRepresentation());
92bool MangleAndInterner::doNotMangleLeadingQuestionMark()
const {
104 for (
auto *
G : GVs) {
105 assert(
G &&
"GVs cannot contain null elements");
106 if (!
G->hasName() ||
G->isDeclaration() ||
G->hasLocalLinkage() ||
107 G->hasAvailableExternallyLinkage() ||
G->hasAppendingLinkage())
115 auto EmuTLSV = Mangle((
"__emutls_v." + GV->getName()).str());
116 SymbolFlags[EmuTLSV] = Flags;
117 if (SymbolToDefinition)
118 (*SymbolToDefinition)[EmuTLSV] = GV;
122 if (GV->hasInitializer()) {
123 const auto *InitVal = GV->getInitializer();
129 if (InitIntValue && InitIntValue->isZero())
132 auto EmuTLST = Mangle((
"__emutls_t." + GV->getName()).str());
133 SymbolFlags[EmuTLST] = Flags;
134 if (SymbolToDefinition)
135 (*SymbolToDefinition)[EmuTLST] = GV;
141 auto MangledName = Mangle(
G->getName());
143 if (SymbolToDefinition)
144 (*SymbolToDefinition)[MangledName] =
G;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
Check if the array is empty.
A parsed version of the target data layout string in and methods for querying it.
static LLVM_ABI JITSymbolFlags fromGlobalValue(const GlobalValue &GV)
Construct a JITSymbolFlags value based on the flags of the given global value.
Represent a constant reference to a string, i.e.
An ExecutionSession represents a running JIT program.
static LLVM_ABI void add(ExecutionSession &ES, const ManglingOptions &MO, ArrayRef< GlobalValue * > GVs, SymbolFlagsMap &SymbolFlags, SymbolNameToDefinitionMap *SymbolToDefinition=nullptr)
Add mangled symbols for the given GlobalValues to SymbolFlags.
std::map< SymbolStringPtr, GlobalValue * > SymbolNameToDefinitionMap
Mangles symbol names then uniques them in the context of an ExecutionSession.
LLVM_ABI SymbolStringPtr operator()(StringRef Name)
LLVM_ABI MangleAndInterner(ExecutionSession &ES, StringRef ABIName="")
Pointer to a pooled string representing a symbol name.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
iterator_range< SplittingIterator > split(StringRef Str, StringRef Separator)
Split the specified string over a separator and return a range-compatible iterable over its partition...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.