hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 5f51e691a49f0824d26a0d0f62ac7b4b4f1e8305
parent 1ed8bd9ad4e53e648d7b0032b7a8701344af81e5
Author: Sebastian <sebastian@sebsite.pw>
Date:   Thu, 31 Aug 2023 02:12:56 -0400

hare::types: add VALIST to storage enum

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mhare/types/arch.ha | 8++++++++
Mhare/types/hash.ha | 8+++++---
Mhare/types/store.ha | 4++++
3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/hare/types/arch.ha b/hare/types/arch.ha @@ -6,6 +6,8 @@ export type arch = struct { _int: size, _pointer: size, _size: size, + valist_size: size, + valist_align: size, }; // [[arch]] configuration for x86_64. @@ -13,6 +15,8 @@ export const x86_64: arch = arch { _int = 4, _pointer = 8, _size = 8, + valist_size = 24, + valist_align = 8, }; // [[arch]] configuration for aarch64. @@ -20,6 +24,8 @@ export const aarch64: arch = arch { _int = 4, _pointer = 8, _size = 8, + valist_size = 32, + valist_align = 8, }; // [[arch]] configuration for riscv64. @@ -27,4 +33,6 @@ export const riscv64: arch = arch { _int = 4, _pointer = 8, _size = 8, + valist_size = 8, + valist_align = 8, }; diff --git a/hare/types/hash.ha b/hare/types/hash.ha @@ -8,9 +8,9 @@ use strings; // Keep ordered with respect to bootstrap harec:include/types.h type storage = enum u8 { - BOOL, F32, F64, I16, I32, I64, I8, INT, NEVER, NULL, OPAQUE, - RUNE, SIZE, STRING, U16, U32, U64, U8, UINT, UINTPTR, VOID, ALIAS, - ARRAY, ENUM, FUNCTION, POINTER, SLICE, STRUCT, TAGGED, TUPLE, UNION, + BOOL, F32, F64, I16, I32, I64, I8, INT, NEVER, NULL, OPAQUE, RUNE, SIZE, + STRING, U16, U32, U64, U8, UINT, UINTPTR, VOID, ALIAS, ARRAY, ENUM, + FUNCTION, POINTER, SLICE, STRUCT, TAGGED, TUPLE, UNION, VALIST, }; fn builtin_storage(b: builtin) u8 = { @@ -55,6 +55,8 @@ fn builtin_storage(b: builtin) u8 = { return storage::UINT; case builtin::UINTPTR => return storage::UINTPTR; + case builtin::VALIST => + return storage::VALIST; case builtin::VOID => return storage::VOID; }; diff --git a/hare/types/store.ha b/hare/types/store.ha @@ -263,6 +263,10 @@ fn fromast(store: *typestore, atype: *ast::_type) (_type | deferred | error) = { sz = SIZE_UNDEFINED; _align = SIZE_UNDEFINED; yield builtin::NEVER; + case ast::builtin_type::VALIST => + sz = store.arch.valist_size; + _align = store.arch.valist_align; + yield builtin::VALIST; }; case let f: ast::func_type => yield func_from_ast(store, &f)?;