aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2025-07-29 13:09:05 -0700
committerColin Davidson <colrdavidson@gmail.com>2025-07-29 13:09:05 -0700
commit4d9fdf5bd381c21ae68e08e52a0d98729a390cfe (patch)
treed5d890f01d6614769908b9990267e8e3889a7557
parent9a2e6fff481968f201e6bf6a601ab7a4e3fbef45 (diff)
move to checker error, rather than panic
-rw-r--r--src/check_builtin.cpp8
-rw-r--r--src/llvm_backend_proc.cpp2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 66be3c69e..974224ed2 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -4714,6 +4714,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
break;
case BuiltinProc_read_cycle_counter_frequency:
+ if (build_context.metrics.arch != TargetArch_arm64) {
+ error(call, "'%.*s' is only allowed on arm64 targets", LIT(builtin_name));
+ return false;
+ }
+ operand->mode = Addressing_Value;
+ operand->type = t_i64;
+ break;
+
case BuiltinProc_read_cycle_counter:
operand->mode = Addressing_Value;
operand->type = t_i64;
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index 5e38e6bdc..d89720e0d 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -2820,8 +2820,6 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
LLVMValueRef the_asm = llvm_get_inline_asm(func_type, str_lit("mrs $0, cntfrq_el0"), str_lit("=r"), has_side_effects);
GB_ASSERT(the_asm != nullptr);
res.value = LLVMBuildCall2(p->builder, func_type, the_asm, nullptr, 0, "");
- } else {
- GB_PANIC("Unsupported architecture: %.*s", LIT(target_arch_names[build_context.metrics.arch]));
}
return res;