Go to the documentation of this file.
20 #define DEBUG_TYPE "orc"
29 cl::desc(
"debug print hidden symbols defined by "
30 "materialization units"),
34 cl::desc(
"debug print callable symbols defined by "
35 "materialization units"),
39 cl::desc(
"debug print data symbols defined by "
40 "materialization units"),
46 template <
typename T>
struct PrintAll {
47 bool operator()(
const T &
E) {
return true; }
50 bool anyPrintSymbolOptionSet() {
52 return PrintHidden || PrintCallable || PrintData;
81 typename Pred = PrintAll<typename Sequence::value_type>>
82 class SequencePrinter {
84 SequencePrinter(
const Sequence &
S,
char OpenSeq,
char CloseSeq,
85 Pred ShouldPrint = Pred())
86 :
S(
S), OpenSeq(OpenSeq), CloseSeq(CloseSeq),
90 bool PrintComma =
false;
100 OS <<
' ' << CloseSeq;
107 mutable Pred ShouldPrint;
110 template <
typename Sequence,
typename Pred>
111 SequencePrinter<Sequence, Pred> printSequence(
const Sequence &
S,
char OpenSeq,
112 char CloseSeq, Pred
P = Pred()) {
113 return SequencePrinter<Sequence, Pred>(
S, OpenSeq, CloseSeq,
std::move(
P));
117 template <
typename Sequence,
typename Pred>
119 const SequencePrinter<Sequence, Pred> &
Printer) {
124 struct PrintSymbolFlagsMapElemsMatchingCLOpts {
126 return flagsMatchCLOpts(KV.second);
130 struct PrintSymbolMapElemsMatchingCLOpts {
132 return flagsMatchCLOpts(KV.second.getFlags());
146 return OS << printSequence(Symbols,
'{',
'}', PrintAll<SymbolStringPtr>());
150 return OS << printSequence(Symbols, '[', ']', PrintAll<SymbolStringPtr>());
154 return OS << printSequence(Symbols, '[', ']', PrintAll<SymbolStringPtr>());
181 return OS <<
"(\"" << KV.first <<
"\", " << KV.second <<
")";
185 return OS <<
"(\"" << KV.first <<
"\": " << KV.second <<
")";
190 PrintSymbolFlagsMapElemsMatchingCLOpts());
194 return OS << printSequence(Symbols,
'{',
'}',
195 PrintSymbolMapElemsMatchingCLOpts());
200 return OS <<
"(" << KV.first->getName() <<
", " << KV.second <<
")";
204 return OS << printSequence(Deps,
'{',
'}',
205 PrintAll<SymbolDependenceMap::value_type>());
209 OS <<
"MU@" << &MU <<
" (\"" << MU.
getName() <<
"\"";
210 if (anyPrintSymbolOptionSet())
218 return OS <<
"Static";
220 return OS <<
"DLSym";
227 switch (JDLookupFlags) {
229 return OS <<
"MatchExportedSymbolsOnly";
231 return OS <<
"MatchAllSymbols";
237 switch (LookupFlags) {
239 return OS <<
"RequiredSymbol";
241 return OS <<
"WeaklyReferencedSymbol";
248 return OS <<
"(" << KV.first <<
", " << KV.second <<
")";
252 return OS << printSequence(LookupSet,
'{',
'}',
253 PrintAll<SymbolLookupSet::value_type>());
259 if (!SearchOrder.empty()) {
260 assert(SearchOrder.front().first &&
261 "JITDylibList entries must not be null");
262 OS <<
" (\"" << SearchOrder.front().first->getName() <<
"\", "
263 << SearchOrder.begin()->second <<
")";
265 assert(KV.first &&
"JITDylibList entries must not be null");
266 OS <<
", (\"" << KV.first->getName() <<
"\", " << KV.second <<
")";
275 for (
auto &KV : Aliases)
276 OS <<
" " << *KV.first <<
": " << KV.second.Aliasee <<
" "
277 << KV.second.AliasFlags;
285 return OS <<
"Invalid";
287 return OS <<
"Never-Searched";
289 return OS <<
"Materializing";
291 return OS <<
"Resolved";
293 return OS <<
"Emitted";
295 return OS <<
"Ready";
301 std::lock_guard<std::mutex> Lock(SSP.PoolMutex);
302 for (
auto &KV : SSP.Pool)
303 OS << KV.first() <<
": " << KV.second <<
"\n";
309 IdentifierOverride(
std::
move(IdentifierOverride)) {
312 while (!this->DumpDir.empty() &&
314 this->DumpDir.pop_back();
321 std::string DumpPathStem;
323 << DumpDir << (DumpDir.empty() ?
"" :
"/") << getBufferIdentifier(*Obj);
325 std::string DumpPath = DumpPathStem +
".o";
333 <<
" -- " << (
const void *)(Obj->getBufferEnd() - 1) <<
" ] to "
341 DumpStream.
write(Obj->getBufferStart(), Obj->getBufferSize());
347 if (!IdentifierOverride.empty())
348 return IdentifierOverride;
349 StringRef Identifier =
B.getBufferIdentifier();
350 Identifier.consume_back(
".o");
raw_ostream & operator<<(raw_ostream &OS, const SymbolStringPtr &Sym)
Render a SymbolStringPtr.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
@ Materializing
Added to the symbol table, never queried.
DumpObjects(std::string DumpDir="", std::string IdentifierOverride="")
Construct a DumpObjects transform that will dump objects to disk.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
A raw_ostream that writes to an std::string.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Pointer to a pooled string representing a symbol name.
Expected< std::unique_ptr< MemoryBuffer > > operator()(std::unique_ptr< MemoryBuffer > Obj)
Dumps the given buffer to disk.
bool isExported() const
Returns true if the Exported flag is set.
Tagged union holding either a T or a Error.
bool hasError() const
Return true if there was an error retrieving this symbol.
LookupKind
Describes the kind of lookup being performed.
Flags for symbols in the JIT.
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Represents a symbol that has been evaluated to an address already.
virtual StringRef getName() const =0
Return the name of this materialization unit.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
print alias Alias Set Printer
SymbolState
Represents the state that a symbol has reached during materialization.
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
String pool for symbol names used by the JIT.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
DenseMap< SymbolStringPtr, JITEvaluatedSymbol > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
JITSymbolFlags getFlags() const
Return the flags for this symbol.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
raw_ostream & write(unsigned char C)
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
static cl::opt< bool > PrintAll("print-all-alias-modref-info", cl::ReallyHidden)
bool isWeak() const
Returns true if the Weak flag is set.
bool exists(const basic_file_status &status)
Does file exist?
std::pair< SymbolStringPtr, SymbolLookupFlags > value_type
llvm::detail::DenseMapPair< SymbolStringPtr, JITSymbolFlags > value_type
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
initializer< Ty > init(const Ty &Val)
bool isCallable() const
Returns true if the given symbol is known to be callable.
const SymbolFlagsMap & getSymbols() const
Return the set of symbols that this source provides.
@ NeverSearched
No symbol should be in this state.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder
A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Analysis the ScalarEvolution expression for r is this
@ Ready
Emitted to memory, but waiting on transitive dependencies.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
A raw_ostream that writes to a file descriptor.
DenseMap< JITDylib *, SymbolNameSet > SymbolDependenceMap
A map from JITDylibs to sets of symbols.
@ MatchExportedSymbolsOnly
bool is_separator(char value, Style style=Style::native)
Check whether the given char is a path separator on the host OS.
bool isCommon() const
Returns true if the Common flag is set.
JITTargetAddress getAddress() const
Return the address of this symbol.
@ Emitted
Assigned address, still materializing.
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
@ Resolved
Queried, materialization begun.
const char * getBufferStart() const
Return the beginning of the current stream buffer, or 0 if the stream is unbuffered.
std::vector< SymbolStringPtr > SymbolNameVector
A vector of symbol names.