@@ -100,8 +100,12 @@ class HashPreprocessedAction : public PreprocessorFrontendAction {
100
100
101
101
class SYCLToolchain {
102
102
SYCLToolchain () {
103
+ using namespace jit_compiler ::resource;
104
+
103
105
for (size_t i = 0 ; i < NumToolchainFiles; ++i) {
104
- auto [Path, Content] = ToolchainFiles[i];
106
+ resource_file RF = ToolchainFiles[i];
107
+ std::string_view Path{RF.Path .S , RF.Path .Size };
108
+ std::string_view Content{RF.Content .S , RF.Content .Size };
105
109
ToolchainFS->addFile (Path, 0 , llvm::MemoryBuffer::getMemBuffer (Content));
106
110
}
107
111
}
@@ -196,12 +200,14 @@ class SYCLToolchain {
196
200
return std::move (Lib);
197
201
}
198
202
203
+ std::string_view getPrefix () const { return Prefix; }
199
204
std::string_view getClangXXExe () const { return ClangXXExe; }
200
205
201
206
private:
202
207
clang::IgnoringDiagConsumer IgnoreDiag;
203
- std::string ClangXXExe =
204
- (jit_compiler::ToolchainPrefix + " /bin/clang++" ).str();
208
+ std::string_view Prefix{jit_compiler::resource::ToolchainPrefix.S ,
209
+ jit_compiler::resource::ToolchainPrefix.Size };
210
+ std::string ClangXXExe = (Prefix + " /bin/clang++" ).str();
205
211
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> ToolchainFS =
206
212
llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
207
213
};
@@ -500,7 +506,7 @@ Error jit_compiler::linkDeviceLibraries(llvm::Module &Module,
500
506
LLVMContext &Context = Module.getContext ();
501
507
for (const std::string &LibName : LibNames) {
502
508
std::string LibPath =
503
- (jit_compiler::ToolchainPrefix + " /lib/" + LibName).str ();
509
+ (SYCLToolchain::instance (). getPrefix () + " /lib/" + LibName).str ();
504
510
505
511
ModuleUPtr LibModule;
506
512
if (auto Error = SYCLToolchain::instance ()
@@ -519,7 +525,7 @@ Error jit_compiler::linkDeviceLibraries(llvm::Module &Module,
519
525
// For GPU targets we need to link against vendor provided libdevice.
520
526
if (IsCudaHIP) {
521
527
Triple T{Module.getTargetTriple ()};
522
- Driver D{(jit_compiler::ToolchainPrefix + " /bin/clang++" ).str (),
528
+ Driver D{(SYCLToolchain::instance (). getPrefix () + " /bin/clang++" ).str (),
523
529
T.getTriple (), Diags};
524
530
auto [CPU, Features] =
525
531
Translator::getTargetCPUAndFeatureAttrs (&Module, " " , Format);
@@ -765,7 +771,7 @@ jit_compiler::performPostLink(ModuleUPtr Module,
765
771
auto &Ctx = Modules.front ()->getContext ();
766
772
auto WrapLibraryInDevImg = [&](const std::string &LibName) -> Error {
767
773
std::string LibPath =
768
- (jit_compiler::ToolchainPrefix + " /lib/" + LibName).str ();
774
+ (SYCLToolchain::instance (). getPrefix () + " /lib/" + LibName).str ();
769
775
ModuleUPtr LibModule;
770
776
if (auto Error = SYCLToolchain::instance ()
771
777
.loadBitcodeLibrary (LibPath, Ctx)
0 commit comments