loongarch: Add ASSERT() breakpoint support on loongarch architecture.

Bug: dawn:1506
Change-Id: Icff59529676c1f2ad3b9e1779577cad467866797
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102146
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Wang Qing 2022-09-14 13:31:37 +00:00 committed by Dawn LUCI CQ
parent b74ca3f8e0
commit cd86adaf41
2 changed files with 26 additions and 2 deletions

View File

@ -27,6 +27,8 @@ void BreakPoint() {
__asm__ __volatile__("bkpt 0");
#elif DAWN_PLATFORM_IS(ARM64)
__asm__ __volatile__("brk 0");
#elif DAWN_PLATFORM_IS(LOONGARCH)
__asm__ __volatile__("break");
#elif DAWN_PLATFORM_IS(RISCV)
__asm__ __volatile__("ebreak");
#elif DAWN_PLATFORM_IS(MIPS)

View File

@ -84,6 +84,9 @@
// - ARM
// - ARM32
// - ARM64
// - LOONGARCH
// - LOONGARCH32
// - LOONGARCH64
// - RISCV
// - RISCV32
// - RISCV64
@ -108,6 +111,14 @@
#define DAWN_PLATFORM_IS_ARM 1
#define DAWN_PLATFORM_IS_ARM64 1
#elif defined(__loongarch__)
#define DAWN_PLATFORM_IS_LOONGARCH 1
#if _LOONGARCH_SIM == _ABILP32
#define DAWN_PLATFORM_IS_LOONGARCH32 1
#else
#define DAWN_PLATFORM_IS_LOONGARCH64 1
#endif
#elif defined(__riscv)
#define DAWN_PLATFORM_IS_RISCV 1
#if __riscv_xlen == 32
@ -144,13 +155,14 @@
// - 32_BIT
#if defined(DAWN_PLATFORM_IS_X86_64) || defined(DAWN_PLATFORM_IS_ARM64) || \
defined(DAWN_PLATFORM_IS_RISCV64) || defined(DAWN_PLATFORM_IS_MIPS64) || \
defined(DAWN_PLATFORM_IS_S390X) || defined(DAWN_PLATFORM_IS_PPC64)
defined(DAWN_PLATFORM_IS_S390X) || defined(DAWN_PLATFORM_IS_PPC64) || \
defined(DAWN_PLATFORM_IS_LOONGARCH64)
#define DAWN_PLATFORM_IS_64_BIT 1
static_assert(sizeof(sizeof(char)) == 8, "Expect sizeof(size_t) == 8");
#elif defined(DAWN_PLATFORM_IS_I386) || defined(DAWN_PLATFORM_IS_ARM32) || \
defined(DAWN_PLATFORM_IS_RISCV32) || defined(DAWN_PLATFORM_IS_MIPS32) || \
defined(DAWN_PLATFORM_IS_S390) || defined(DAWN_PLATFORM_IS_PPC32) || \
defined(DAWN_PLATFORM_IS_EMSCRIPTEN)
defined(DAWN_PLATFORM_IS_EMSCRIPTEN) || defined(DAWN_PLATFORM_IS_LOONGARCH32)
#define DAWN_PLATFORM_IS_32_BIT 1
static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4");
#else
@ -216,6 +228,16 @@ static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4");
#define DAWN_PLATFORM_IS_ARM64 0
#endif
#if !defined(DAWN_PLATFORM_IS_LOONGARCH)
#define DAWN_PLATFORM_IS_LOONGARCH 0
#endif
#if !defined(DAWN_PLATFORM_IS_LOONGARCH32)
#define DAWN_PLATFORM_IS_LOONGARCH32 0
#endif
#if !defined(DAWN_PLATFORM_IS_LOONGARCH64)
#define DAWN_PLATFORM_IS_LOONGARCH64 0
#endif
#if !defined(DAWN_PLATFORM_IS_RISCV)
#define DAWN_PLATFORM_IS_RISCV 0
#endif