aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-08-17 13:52:13 +0100
committergingerBill <bill@gingerbill.org>2022-08-17 13:52:13 +0100
commit82e840a0ca3fb547ac93e680a3dcbbb67958077f (patch)
tree7c2eeb580c952755c507292b12e2fe72dda16d37 /src/check_builtin.cpp
parent82765ca96e90f8ca3d2870e1b00bba3fecc0a78f (diff)
EXPERIMENTAL `intrinsics.valgrind_client_request`
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 687f1694b..83136d576 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -5388,6 +5388,41 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
}
break;
+ case BuiltinProc_valgrind_client_request:
+ {
+ if (!is_arch_x86()) {
+ error(call, "'%.*s' is only allowed on x86 targets (i386, amd64)", LIT(builtin_name));
+ return false;
+ }
+
+ enum {ARG_COUNT = 7};
+ GB_ASSERT(builtin_procs[BuiltinProc_valgrind_client_request].arg_count == ARG_COUNT);
+
+ Operand operands[ARG_COUNT] = {};
+ for (isize i = 0; i < ARG_COUNT; i++) {
+ Operand *op = &operands[i];
+ check_expr_with_type_hint(c, op, ce->args[i], t_uintptr);
+ if (op->mode == Addressing_Invalid) {
+ return false;
+ }
+ convert_to_typed(c, op, t_uintptr);
+ if (op->mode == Addressing_Invalid) {
+ return false;
+ }
+ if (!are_types_identical(op->type, t_uintptr)) {
+ gbString str = type_to_string(op->type);
+ error(op->expr, "'%.*s' expected a uintptr, got %s", LIT(builtin_name), str);
+ gb_string_free(str);
+ return false;
+ }
+ }
+
+ operand->type = t_uintptr;
+ operand->mode = Addressing_Value;
+ operand->value = {};
+ return true;
+ }
+
}
return true;