Go to the documentation of this file.
13 #ifndef LIB_EXECUTIONENGINE_JITLINK_MACHOLINKGRAPHBUILDER_H
14 #define LIB_EXECUTIONENGINE_JITLINK_MACHOLINKGRAPHBUILDER_H
44 assert((!
Name || !
Name->empty()) &&
"Name must be none or non-empty");
78 const char *
Data =
nullptr;
98 template <
typename... ArgTs>
109 auto I = IndexToSection.find(
Index);
110 assert(
I != IndexToSection.end() &&
"No section recorded at index");
118 auto I = IndexToSection.find(
Index);
119 if (
I == IndexToSection.end())
120 return make_error<JITLinkError>(
"No section recorded for index " +
129 auto I = IndexToSymbol.find(
Index);
130 if (
I == IndexToSymbol.end())
131 return make_error<JITLinkError>(
"No symbol at index " +
133 assert(
I->second &&
"Null symbol at index");
144 return std::prev(
I)->second;
153 if (Address <= Sym->getAddress() + Sym->getSize())
155 return make_error<JITLinkError>(
"No symbol covering address " +
161 static bool isAltEntry(
const NormalizedSymbol &NSym);
184 void setCanonicalSymbol(NormalizedSection &NSec,
Symbol &Sym) {
185 auto *&CanonicalSymEntry = NSec.CanonicalSymbols[Sym.
getAddress()];
189 assert((!CanonicalSymEntry || CanonicalSymEntry->getSize() == 0) &&
190 "Duplicate canonical symbol at address");
191 CanonicalSymEntry = &Sym;
195 void addSectionStartSymAndBlock(
unsigned SecIndex,
Section &GraphSec,
200 Error createNormalizedSections();
201 Error createNormalizedSymbols();
205 Error graphifyRegularSymbols();
211 Symbol &createStandardGraphSymbol(NormalizedSymbol &Sym, Block &
B,
212 size_t Size,
bool IsText,
213 bool IsNoDeadStrip,
bool IsCanonical);
216 Error graphifySectionsWithCustomParsers();
219 Error graphifyCStringSection(NormalizedSection &NSec,
220 std::vector<NormalizedSymbol *> NSyms);
227 std::unique_ptr<LinkGraph>
G;
230 Section *CommonSection =
nullptr;
240 : CompactUnwindSectionName(CompactUnwindSectionName) {}
250 #endif // LIB_EXECUTIONENGINE_JITLINK_MACHOLINKGRAPHBUILDER_H
Represents an address in the executor process.
static bool isDebugSection(const NormalizedSection &NSec)
static uint64_t getPointerSize(const Value *V, const DataLayout &DL, const TargetLibraryInfo &TLI, const Function *F)
This is an optimization pass for GlobalISel generic memory operations.
Expected< Symbol & > findSymbolByAddress(NormalizedSection &NSec, orc::ExecutorAddr Address)
Returns the symbol with the highest address not greater than the search address, or an error if no su...
MachOLinkGraphBuilder(const object::MachOObjectFile &Obj, Triple TT, LinkGraph::GetEdgeKindNameFunction GetEdgeKindName)
CompactUnwindSplitter(StringRef CompactUnwindSectionName)
A pass to split up __LD,__compact_unwind sections.
Triple - Helper class for working with autoconf configuration names.
The instances of the Type class are immutable: once they are created, they are never changed.
virtual ~MachOLinkGraphBuilder()
Tagged union holding either a T or a Error.
static Linkage getLinkage(uint16_t Desc)
static bool isAltEntry(const NormalizedSymbol &NSym)
std::map< orc::ExecutorAddr, Symbol * > CanonicalSymbols
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
const char *(*)(Edge::Kind) GetEdgeKindNameFunction
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
virtual Error addRelocations()=0
static Scope getScope(StringRef Name, uint8_t Type)
MachO::relocation_info getRelocationInfo(const object::relocation_iterator RelItr)
Expected< NormalizedSymbol & > findSymbolByIndex(uint64_t Index)
Try to get the symbol at the given index.
Allocate memory in an ever growing pool, as if by bump-pointer.
Error operator()(LinkGraph &G)
LinkGraph & getGraph() const
orc::ExecutorAddr getAddress() const
Returns the address of this symbol.
Symbol * getSymbolByAddress(NormalizedSection &NSec, orc::ExecutorAddr Address)
Returns the symbol with the highest address not greater than the search address, or null if no such s...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
void addCustomSectionParser(StringRef SectionName, SectionParserFunction Parse)
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface o...
StringRef - Represent a constant reference to a string, i.e.
NormalizedSymbol & createNormalizedSymbol(ArgTs &&... Args)
Create a symbol.
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
Expected< NormalizedSection & > findSectionByIndex(unsigned Index)
Try to get the section at the given index.
Linkage
Describes symbol linkage.
const object::MachOObjectFile & getObject() const
Represents an object file section.
Lightweight error class with error context and mandatory checking.
static bool isZeroFillSection(const NormalizedSection &NSec)
Optional< StringRef > Name
std::function< Error(NormalizedSection &S)> SectionParserFunction
orc::ExecutorAddr Address
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Expected< std::unique_ptr< LinkGraph > > buildGraph()
LLVM Value Representation.
NormalizedSymbol & operator=(const NormalizedSymbol &)=delete
NormalizedSection & getSectionByIndex(unsigned Index)
Index is zero-based (MachO section indexes are usually one-based) and assumed to be in-range.