From 4605ef15620cb3fea64fc3f1af74722f06937e06 Mon Sep 17 00:00:00 2001
From: suijingfeng <suijingfeng@loongson.cn>
Date: Sun, 11 Jul 2021 06:12:17 +0800
Subject: [PATCH 2/4] gallivm: temporary disable coroutines on loongarch64

Signed-off-by: suijingfeng <suijingfeng@loongson.cn>
---
 src/gallium/auxiliary/gallivm/lp_bld.h      | 4 ++++
 src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld.h b/src/gallium/auxiliary/gallivm/lp_bld.h
index 9144428..4fdc075 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld.h
@@ -82,7 +82,11 @@
 #define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
 
 #if LLVM_VERSION_MAJOR >= 8
+#if defined(__loongarch__)
+#define GALLIVM_HAVE_CORO 0
+#else
 #define GALLIVM_HAVE_CORO 1
+#endif
 #else
 #define GALLIVM_HAVE_CORO 0
 #endif
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 3f040ac..9c251d8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -46,7 +46,7 @@
 #endif
 #include <llvm-c/BitWriter.h>
 #if GALLIVM_HAVE_CORO
-#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64))
+#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64) || defined(PIPE_ARCH_LOONGARCH64))
 #include <llvm-c/Transforms/IPO.h>
 #endif
 #include <llvm-c/Transforms/Coroutines.h>
@@ -135,7 +135,7 @@ create_pass_manager(struct gallivm_state *gallivm)
    }
 
 #if GALLIVM_HAVE_CORO
-#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64))
+#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64) || defined(PIPE_ARCH_LOONGARCH64))
    LLVMAddArgumentPromotionPass(gallivm->cgpassmgr);
    LLVMAddFunctionAttrsPass(gallivm->cgpassmgr);
 #endif
-- 
2.20.1

