aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2023-02-21 19:09:34 -0800
committerLang Hames <lhames@gmail.com>2023-02-21 19:57:36 -0800
commit0df66569e529be4bcea06f314c02c6af74989704 (patch)
treeaccd140e697879cff1e58fbd79e1dca79be05acf /llvm/tools/llvm-jitlink/llvm-jitlink.cpp
parentcf550e6184dfeb1c2838132b4910548002d08563 (diff)
downloadllvm-0df66569e529be4bcea06f314c02c6af74989704.zip
llvm-0df66569e529be4bcea06f314c02c6af74989704.tar.gz
llvm-0df66569e529be4bcea06f314c02c6af74989704.tar.bz2
[ORC] Add an ExecutionSession::getTargetTriple convenience function.
Forwards to ExecutorProcessControl::getTargetTriple, and saves clients the trouble of spelling 'getExecutorProcessControl()' everywhere.
Diffstat (limited to 'llvm/tools/llvm-jitlink/llvm-jitlink.cpp')
-rw-r--r--llvm/tools/llvm-jitlink/llvm-jitlink.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index d98cd77..ed5d15b 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -982,7 +982,7 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
ExitOnErr(loadDylibs(*this));
- auto &TT = ES.getExecutorProcessControl().getTargetTriple();
+ auto &TT = ES.getTargetTriple();
if (DebuggerSupport && TT.isOSBinFormatMachO())
ObjLayer.addPlugin(ExitOnErr(
@@ -1072,14 +1072,13 @@ void Session::modifyPassConfig(const Triple &TT,
PassConfiguration &PassConfig) {
if (!CheckFiles.empty())
PassConfig.PostFixupPasses.push_back([this](LinkGraph &G) {
- auto &EPC = ES.getExecutorProcessControl();
- if (EPC.getTargetTriple().getObjectFormat() == Triple::ELF)
+ if (ES.getTargetTriple().getObjectFormat() == Triple::ELF)
return registerELFGraphInfo(*this, G);
- if (EPC.getTargetTriple().getObjectFormat() == Triple::MachO)
+ if (ES.getTargetTriple().getObjectFormat() == Triple::MachO)
return registerMachOGraphInfo(*this, G);
- if (EPC.getTargetTriple().getObjectFormat() == Triple::COFF)
+ if (ES.getTargetTriple().getObjectFormat() == Triple::COFF)
return registerCOFFGraphInfo(*this, G);
return make_error<StringError>("Unsupported object format for GOT/stub "
@@ -1497,7 +1496,7 @@ getObjectFileInterfaceHidden(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
static SmallVector<StringRef, 5> getSearchPathsFromEnvVar(Session &S) {
// FIXME: Handle EPC environment.
SmallVector<StringRef, 5> PathVec;
- auto TT = S.ES.getExecutorProcessControl().getTargetTriple();
+ auto TT = S.ES.getTargetTriple();
if (TT.isOSBinFormatCOFF())
StringRef(getenv("PATH")).split(PathVec, ";");
else if (TT.isOSBinFormatELF())
@@ -1632,7 +1631,7 @@ static Error addLibraries(Session &S,
break;
}
auto G = StaticLibraryDefinitionGenerator::Load(
- S.ObjLayer, Path, S.ES.getExecutorProcessControl().getTargetTriple(),
+ S.ObjLayer, Path, S.ES.getTargetTriple(),
std::move(GetObjFileInterface));
if (!G)
return G.takeError();
@@ -1868,14 +1867,12 @@ static TargetInfo getTargetInfo(const Triple &TT) {
}
static Error runChecks(Session &S) {
- const auto &TT = S.ES.getExecutorProcessControl().getTargetTriple();
-
if (CheckFiles.empty())
return Error::success();
LLVM_DEBUG(dbgs() << "Running checks...\n");
- auto TI = getTargetInfo(TT);
+ auto TI = getTargetInfo(S.ES.getTargetTriple());
auto IsSymbolValid = [&S](StringRef Symbol) {
return S.isSymbolRegistered(Symbol);
@@ -1899,7 +1896,7 @@ static Error runChecks(Session &S) {
RuntimeDyldChecker Checker(
IsSymbolValid, GetSymbolInfo, GetSectionInfo, GetStubInfo, GetGOTInfo,
- TT.isLittleEndian() ? support::little : support::big,
+ S.ES.getTargetTriple().isLittleEndian() ? support::little : support::big,
TI.Disassembler.get(), TI.InstPrinter.get(), dbgs());
std::string CheckLineStart = "# " + CheckName + ":";
@@ -1942,8 +1939,7 @@ static Expected<JITEvaluatedSymbol> getMainEntryPoint(Session &S) {
static Expected<JITEvaluatedSymbol> getOrcRuntimeEntryPoint(Session &S) {
std::string RuntimeEntryPoint = "__orc_rt_run_program_wrapper";
- const auto &TT = S.ES.getExecutorProcessControl().getTargetTriple();
- if (TT.getObjectFormat() == Triple::MachO)
+ if (S.ES.getTargetTriple().getObjectFormat() == Triple::MachO)
RuntimeEntryPoint = '_' + RuntimeEntryPoint;
return S.ES.lookup(S.JDSearchOrder, S.ES.intern(RuntimeEntryPoint));
}
@@ -1980,8 +1976,7 @@ static Expected<JITEvaluatedSymbol> getEntryPoint(Session &S) {
static Expected<int> runWithRuntime(Session &S, ExecutorAddr EntryPointAddr) {
StringRef DemangledEntryPoint = EntryPointName;
- const auto &TT = S.ES.getExecutorProcessControl().getTargetTriple();
- if (TT.getObjectFormat() == Triple::MachO &&
+ if (S.ES.getTargetTriple().getObjectFormat() == Triple::MachO &&
DemangledEntryPoint.front() == '_')
DemangledEntryPoint = DemangledEntryPoint.drop_front();
using llvm::orc::shared::SPSString;