[PATCH] D120270: [OpenMP] Try to embed offloading objects after codegen
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 14 17:09:14 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG806bbc49dc07: [OpenMP] Try to embed offloading objects after codegen (authored by jhuber6).
Herald added a project: All.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120270/new/
https://reviews.llvm.org/D120270
Files:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/Frontend/embed-object.c
Index: clang/test/Frontend/embed-object.c
===================================================================
--- /dev/null
+++ clang/test/Frontend/embed-object.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x c -triple x86_64-unknown-linux-gnu -emit-llvm -fembed-offload-object=%S/Inputs/empty.h,section
+
+// CHECK: @[[OBJECT:.+]] = private constant [0 x i8] zeroinitializer, section ".llvm.offloading.section"
+// CHECK: @llvm.compiler.used = appending global [3 x i8*] [i8* getelementptr inbounds ([0 x i8], [0 x i8]* @[[OBJECT1]]], section "llvm.metadata"
+
+void foo(void) {}
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -43,6 +43,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
+#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/ADT/StringSwitch.h"
@@ -876,6 +877,9 @@
EmitBackendOptionsMetadata(getCodeGenOpts());
+ // If there is device offloading code embed it in the host now.
+ EmbedObject(&getModule(), CodeGenOpts, getDiags());
+
// Set visibility from DLL storage class
// We do this at the end of LLVM IR generation; after any operation
// that might affect the DLL storage class or the visibility, and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120270.415276.patch
Type: text/x-patch
Size: 1447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220315/2cbf2717/attachment.bin>
More information about the cfe-commits
mailing list