| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2024 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
/*========================== begin_copyright_notice ============================ |
| 10 |
|
| 11 |
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
See https://llvm.org/LICENSE.txt for license information. |
| 13 |
SPDX-License-Identifier: Apache-2.0 with LLVM-exception |
| 14 |
|
| 15 |
============================= end_copyright_notice ===========================*/ |
| 16 |
|
| 17 |
From 58f7b6504a97ece65ba015b7b11f34204cc73c0a Mon Sep 17 00:00:00 2001 |
| 18 |
From: Artem Gindinson <[email protected]> |
| 19 |
Date: Tue, 6 Aug 2024 19:45:00 +0200 |
| 20 |
Subject: [PATCH] Revert "[LLVMContext] Remove hasSetOpaquePointersValue() API |
| 21 |
(NFC)" |
| 22 |
|
| 23 |
This reverts commit 4756f9ae0aa6c2a0b4231d93d5166c055f303603 |
| 24 |
by Nikita Popov <[email protected]>: |
| 25 |
|
| 26 |
"[LLVMContext] Remove hasSetOpaquePointersValue() API (NFC) |
| 27 |
Now that we no longer perform any kind of typed pointer guessing, |
| 28 |
we no longer need this API". |
| 29 |
|
| 30 |
Signed-off-by: Artem Gindinson <[email protected]> |
| 31 |
--- |
| 32 |
llvm/include/llvm/IR/LLVMContext.h | 3 +++ |
| 33 |
llvm/lib/IR/LLVMContext.cpp | 4 ++++ |
| 34 |
llvm/lib/IR/LLVMContextImpl.cpp | 4 ++++ |
| 35 |
llvm/lib/IR/LLVMContextImpl.h | 1 + |
| 36 |
4 files changed, 12 insertions(+) |
| 37 |
|
| 38 |
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h |
| 39 |
index a8095a5c2fd3..c380ed215b6c 100644 |
| 40 |
--- a/llvm/include/llvm/IR/LLVMContext.h |
| 41 |
+++ b/llvm/include/llvm/IR/LLVMContext.h |
| 42 |
@@ -311,6 +311,9 @@ public: |
| 43 |
/// LLVMContext is used by compilation. |
| 44 |
void setOptPassGate(OptPassGate&); |
| 45 |
|
| 46 |
+ /// Whether we've decided on using opaque pointers or typed pointers yet. |
| 47 |
+ bool hasSetOpaquePointersValue() const; |
| 48 |
+ |
| 49 |
/// Set whether opaque pointers are enabled. The method may be called multiple |
| 50 |
/// times, but only with the same value. Note that creating a pointer type or |
| 51 |
/// otherwise querying the opaque pointer mode performs an implicit set to |
| 52 |
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp |
| 53 |
index 7911705776e3..2b5577595ee3 100644 |
| 54 |
--- a/llvm/lib/IR/LLVMContext.cpp |
| 55 |
+++ b/llvm/lib/IR/LLVMContext.cpp |
| 56 |
@@ -368,6 +368,10 @@ std::unique_ptr<DiagnosticHandler> LLVMContext::getDiagnosticHandler() { |
| 57 |
return std::move(pImpl->DiagHandler); |
| 58 |
} |
| 59 |
|
| 60 |
+bool LLVMContext::hasSetOpaquePointersValue() const { |
| 61 |
+ return pImpl->hasOpaquePointersValue(); |
| 62 |
+} |
| 63 |
+ |
| 64 |
void LLVMContext::setOpaquePointers(bool Enable) const { |
| 65 |
pImpl->setOpaquePointers(Enable); |
| 66 |
} |
| 67 |
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp |
| 68 |
index 9acb1f654899..cd46a04a684b 100644 |
| 69 |
--- a/llvm/lib/IR/LLVMContextImpl.cpp |
| 70 |
+++ b/llvm/lib/IR/LLVMContextImpl.cpp |
| 71 |
@@ -249,6 +249,10 @@ void LLVMContextImpl::setOptPassGate(OptPassGate& OPG) { |
| 72 |
this->OPG = &OPG; |
| 73 |
} |
| 74 |
|
| 75 |
+bool LLVMContextImpl::hasOpaquePointersValue() { |
| 76 |
+ return OpaquePointers.has_value(); |
| 77 |
+} |
| 78 |
+ |
| 79 |
bool LLVMContextImpl::getOpaquePointers() { |
| 80 |
if (LLVM_UNLIKELY(!OpaquePointers)) |
| 81 |
OpaquePointers = OpaquePointersCL; |
| 82 |
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h |
| 83 |
index d2651a6ec72e..e5d9b39261ed 100644 |
| 84 |
--- a/llvm/lib/IR/LLVMContextImpl.h |
| 85 |
+++ b/llvm/lib/IR/LLVMContextImpl.h |
| 86 |
@@ -1627,6 +1627,7 @@ public: |
| 87 |
// TODO: clean up the following after we no longer support non-opaque pointer |
| 88 |
// types. |
| 89 |
bool getOpaquePointers(); |
| 90 |
+ bool hasOpaquePointersValue(); |
| 91 |
void setOpaquePointers(bool OP); |
| 92 |
|
| 93 |
private: |
| 94 |
-- |
| 95 |
2.46.0.windows.1 |
| 96 |
|