aboutsummaryrefslogtreecommitdiff
path: root/src/check_builtin.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2021-09-18 13:03:29 +0100
committerGitHub <noreply@github.com>2021-09-18 13:03:29 +0100
commit21b6ef87575a766199112eff25a3bbca73d2856f (patch)
treefee8308be2fe02e2742ec52e0ad3f99588e35ebf /src/check_builtin.cpp
parent05ac2002e0296c3acccca1d8cffaafb002e43120 (diff)
parentb427bd8105dea84ada14df6047177e64a242a565 (diff)
Merge pull request #1156 from odin-lang/llvm-12.0.1-windows
Update Windows to LLVM 12.0.1
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 399de98a0..1f5e62f06 100644
--- a/src/check_builtin.cpp
+++ b/src/check_builtin.cpp
@@ -2646,7 +2646,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:
{