-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathintrinsics.yo
More file actions
87 lines (55 loc) · 2.16 KB
/
Copy pathintrinsics.yo
File metadata and controls
87 lines (55 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// MARK: Typecasts
/// Casts between related types
/// Fails if there is no known conversion from T to R
#[intrinsic] fn cast<R, T>(T) -> R;
/// Returns `arg`, with the bit pattern reinterpreted as R
/// Requires T and R to have the exact same bit width
#[intrinsic] fn bitcast<R, T>(T) -> R;
// MARK: Function Names
/// Name of the current function
#[intrinsic] fn __func() -> *i8;
/// Name of the current function, including the full signature
#[intrinsic] fn __pretty_func() -> *i8;
/// Mangled name of the current function
#[intrinsic] fn __mangled_func() -> *i8;
// MARK: Type Information
/// Returns the size of `T`, in bytes.
/// For example, `sizeof<i64>()` would return 8.
#[intrinsic] fn sizeof<T>() -> size_t;
/// Returns a string describing the name of the template parameter `T`
#[intrinsic] fn __typename<T>() -> *i8;
/// Returns true if `T` and `U` are the same type, otherwise false
#[intrinsic] fn __is_same<T, U>() -> bool;
/// Returns true if `T` is a pointer type
#[intrinsic] fn __is_pointer<T>() -> bool;
/// Whether the type is constructible
#[intrinsic] fn __is_constructible<T>() -> bool;
/// Whether the type is copy-constructible
#[intrinsic] fn __is_copy_constructible<T>() -> bool;
/// Whether the type is destructible
#[intrinsic] fn __is_destructible<T>() -> bool;
// MARK: Arithmetic Intrinsics
#[intrinsic] fn __add<T>(T, T) -> T;
#[intrinsic] fn __sub<T>(T, T) -> T;
#[intrinsic] fn __mul<T>(T, T) -> T;
#[intrinsic] fn __div<T>(T, T) -> T;
#[intrinsic] fn __mod<T>(T, T) -> T;
/// bitwise AND
#[intrinsic] fn __and<T>(T, T) -> T;
/// bitwise OR
#[intrinsic] fn __or<T>(T, T) -> T;
#[intrinsic] fn __xor<T>(T, T) -> T;
#[intrinsic] fn __shl<T>(T, T) -> T;
#[intrinsic] fn __shr<T>(T, T) -> T;
/// Equality / Comparison for builtin types
#[intrinsic] fn __eq<T>(T, T) -> bool;
#[intrinsic] fn __lt<T>(T, T) -> bool;
/// short-circuited logical AND
#[intrinsic] fn __land(bool, bool) -> bool;
#[intrinsic] fn operator && (bool, bool) -> bool;
/// short-circuited logical OR
#[intrinsic] fn __lor(bool, bool) -> bool;
#[intrinsic] fn operator || (bool, bool) -> bool;
// MARK: Other
/// Calls the `llvm.trap` intrinsic
#[intrinsic] fn __trap();