Add new intrinsics: debug_trap, trap, read_cycle_counter, expect

This commit is contained in:
gingerBill
2021-04-22 10:35:17 +01:00
parent 65551ba8fb
commit 47c7dc6a9b
9 changed files with 179 additions and 10 deletions
+12 -3
View File
@@ -6,6 +6,7 @@ package intrinsics
x86_mmx :: x86_mmx; // Specialized SIMD Vector type
// Types
simd_vector :: proc($N: int, $T: typeid) -> type/#simd[N]T
soa_struct :: proc($N: int, $T: typeid) -> type/#soa[N]T
@@ -13,8 +14,11 @@ soa_struct :: proc($N: int, $T: typeid) -> type/#soa[N]T
volatile_load :: proc(dst: ^$T) -> T ---
volatile_store :: proc(dst: ^$T, val: T) -> T ---
// Atomics
// Trapping
debug_trap :: proc() ---
trap :: proc() -> ! ---
// Atomics
atomic_fence :: proc() ---
atomic_fence_acq :: proc() ---
atomic_fence_rel :: proc() ---
@@ -89,9 +93,14 @@ atomic_cxchgweak_acqrel_failrelaxed :: proc(dst: ^$T, old, new: T) -> (T, /*opti
// Instructions
alloca :: proc(size, align: int) -> ^u8 ---
alloca :: proc(size, align: int) -> ^u8 ---
cpu_relax :: proc() ---
read_cycle_counter :: proc() -> i64 ---
// Compiler Hints
expect :: proc(val, expected_val: T) -> T ---
cpu_relax :: proc() ---
// Constant type tests
-3
View File
@@ -433,9 +433,6 @@ typeid_base_without_enum :: typeid_core;
@(default_calling_convention = "none")
foreign {
@(link_name="llvm.assume")
assume :: proc(cond: bool) ---;
@(link_name="llvm.debugtrap")
debug_trap :: proc() ---;