From ab50317e96e57dee5b3ff4ad3f16f205b2a3359e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 24 Jan 2024 20:17:23 +0100 Subject: Merge llvm-project main llvmorg-18-init-18359-g93248729cfae This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the last commit before the upstream release/18.x branch was created. PR: 276104 MFC after: 1 month (cherry picked from commit 7a6dacaca14b62ca4b74406814becb87a3fefac0) --- .../llvm/lib/Frontend/Offloading/Utility.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/Frontend/Offloading/Utility.cpp') diff --git a/contrib/llvm-project/llvm/lib/Frontend/Offloading/Utility.cpp b/contrib/llvm-project/llvm/lib/Frontend/Offloading/Utility.cpp index 25f609517ebe..531919bccb94 100644 --- a/contrib/llvm-project/llvm/lib/Frontend/Offloading/Utility.cpp +++ b/contrib/llvm-project/llvm/lib/Frontend/Offloading/Utility.cpp @@ -1,4 +1,4 @@ -//===- Utility.cpp ------ Collection of geneirc offloading utilities ------===// +//===- Utility.cpp ------ Collection of generic offloading utilities ------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -28,11 +28,10 @@ StructType *offloading::getEntryTy(Module &M) { } // TODO: Rework this interface to be more generic. -void offloading::emitOffloadingEntry(Module &M, Constant *Addr, StringRef Name, - uint64_t Size, int32_t Flags, int32_t Data, - StringRef SectionName) { - llvm::Triple Triple(M.getTargetTriple()); - +std::pair +offloading::getOffloadingEntryInitializer(Module &M, Constant *Addr, + StringRef Name, uint64_t Size, + int32_t Flags, int32_t Data) { Type *Int8PtrTy = PointerType::getUnqual(M.getContext()); Type *Int32Ty = Type::getInt32Ty(M.getContext()); Type *SizeTy = M.getDataLayout().getIntPtrType(M.getContext()); @@ -54,6 +53,16 @@ void offloading::emitOffloadingEntry(Module &M, Constant *Addr, StringRef Name, ConstantInt::get(Int32Ty, Data), }; Constant *EntryInitializer = ConstantStruct::get(getEntryTy(M), EntryData); + return {EntryInitializer, Str}; +} + +void offloading::emitOffloadingEntry(Module &M, Constant *Addr, StringRef Name, + uint64_t Size, int32_t Flags, int32_t Data, + StringRef SectionName) { + llvm::Triple Triple(M.getTargetTriple()); + + auto [EntryInitializer, NameGV] = + getOffloadingEntryInitializer(M, Addr, Name, Size, Flags, Data); auto *Entry = new GlobalVariable( M, getEntryTy(M), -- cgit v1.2.3