aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_builtin.cpp')
-rw-r--r--src/check_builtin.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp
index 1f3928bd8..a1fd8eb6c 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -2642,7 +2642,41 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
operand->type = x.type;
}
break;
-
+
+ case BuiltinProc_prefetch_read_instruction:
+ case BuiltinProc_prefetch_read_data:
+ case BuiltinProc_prefetch_write_instruction:
+ case BuiltinProc_prefetch_write_data:
+ {
+ operand->mode = Addressing_NoValue;
+ operand->type = nullptr;
+
+ Operand x = {};
+ Operand y = {};
+ check_expr(c, &x, ce->args[0]);
+ check_expr(c, &y, ce->args[1]);
+ if (x.mode == Addressing_Invalid) {
+ return false;
+ }
+ if (y.mode == Addressing_Invalid) {
+ return false;
+ }
+ check_assignment(c, &x, t_rawptr, builtin_name);
+ if (x.mode == Addressing_Invalid) {
+ return false;
+ }
+ if (y.mode != Addressing_Constant && is_type_integer(y.type)) {
+ error(y.expr, "Second argument to '%.*s' representing the locality must be an integer in the range 0..=3", LIT(builtin_name));
+ return false;
+ }
+ i64 locality = exact_value_to_i64(y.value);
+ if (!(0 <= locality && locality <= 3)) {
+ error(y.expr, "Second argument to '%.*s' representing the locality must be an integer in the range 0..=3", LIT(builtin_name));
+ return false;
+ }
+
+ }
+ break;
case BuiltinProc_syscall:
{