[Mesa-dev] [PATCH 01/31] amd/common: move llvm helper prototype to ac_llvm_util.h
Nicolai Hähnle
nhaehnle at gmail.com
Mon Oct 31 22:10:48 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/amd/common/ac_llvm_helper.cpp | 5 ++---
src/amd/common/ac_llvm_util.h | 10 ++++++++++
src/amd/common/ac_nir_to_llvm.c | 1 +
src/amd/common/ac_nir_to_llvm.h | 4 ----
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
index 062f0aa..125f5f3 100644
--- a/src/amd/common/ac_llvm_helper.cpp
+++ b/src/amd/common/ac_llvm_helper.cpp
@@ -24,23 +24,22 @@
*/
/* based on Marek's patch to lp_bld_misc.cpp */
// Workaround http://llvm.org/PR23628
#if HAVE_LLVM >= 0x0307
# pragma push_macro("DEBUG")
# undef DEBUG
#endif
-#include "ac_nir_to_llvm.h"
+#include "ac_llvm_util.h"
#include <llvm-c/Core.h>
#include <llvm/Target/TargetOptions.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
-extern "C" void
-ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
+void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
{
llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
llvm::AttrBuilder B;
B.addDereferenceableAttr(bytes);
A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1, B));
}
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index 8357fbf..25ebc50 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -21,11 +21,21 @@
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*/
#pragma once
#include <llvm-c/TargetMachine.h>
#include "amd_family.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family);
+
+void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index c12c506..745baae 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -15,20 +15,21 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "ac_nir_to_llvm.h"
+#include "ac_llvm_util.h"
#include "ac_binary.h"
#include "sid.h"
#include "nir/nir.h"
#include "../vulkan/radv_descriptor_set.h"
#include "util/bitscan.h"
#include <llvm-c/Transforms/Scalar.h>
enum radeon_llvm_calling_convention {
RADEON_LLVM_AMDGPU_VS = 87,
RADEON_LLVM_AMDGPU_GS = 88,
diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h
index a17caf2..ca06d05 100644
--- a/src/amd/common/ac_nir_to_llvm.h
+++ b/src/amd/common/ac_nir_to_llvm.h
@@ -106,14 +106,10 @@ void ac_compile_nir_shader(LLVMTargetMachineRef tm,
#define AC_USERDATA_PUSH_CONST_DYN 8
#define AC_USERDATA_VS_VERTEX_BUFFERS 10
#define AC_USERDATA_VS_BASE_VERTEX 12
#define AC_USERDATA_VS_START_INSTANCE 13
#define AC_USERDATA_PS_SAMPLE_POS 10
#define AC_USERDATA_CS_GRID_SIZE 10
-#ifdef __cplusplus
-extern "C"
-#endif
-void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
--
2.7.4
More information about the mesa-dev
mailing list