kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

c_abi.h (1325B)


      1 #ifndef KIT_LANG_C_ABI_H
      2 #define KIT_LANG_C_ABI_H
      3 
      4 #include "c_support.h"
      5 #include "type/type.h"
      6 
      7 typedef struct ABIFieldLayout {
      8   u32 offset;
      9   u16 bit_offset;
     10   u16 bit_width;
     11   u32 storage_size;
     12 } ABIFieldLayout;
     13 
     14 typedef struct ABIRecordLayout {
     15   u32 size;
     16   u32 align;
     17   u32 nfields;
     18   const ABIFieldLayout* fields;
     19 } ABIRecordLayout;
     20 
     21 typedef struct ABIArgInfo {
     22   u8 dummy;
     23 } ABIArgInfo;
     24 
     25 typedef struct ABIFuncInfo {
     26   ABIArgInfo* params;
     27   u16 nparams;
     28 } ABIFuncInfo;
     29 
     30 /* Size/align queries lower the type to a CG id through the caller's Pool so the
     31  * lowering scratch (and record-layout memo) is reused for the whole translation
     32  * unit -- never a throwaway per-query arena. The lowered id's size/align ride
     33  * the per-id api_type_layout memo, so these need no extra Type*-keyed cache. */
     34 u32 c_abi_sizeof(KitCompiler*, Pool*, const Type*);
     35 u32 c_abi_alignof(KitCompiler*, Pool*, const Type*);
     36 const ABIRecordLayout* c_abi_record_layout(KitCompiler*, Pool*, const Type*);
     37 const ABIFuncInfo* c_abi_func_info(KitCompiler*, Pool*, const Type*);
     38 
     39 const Type* c_abi_size_type(KitCompiler*, Pool*);
     40 const Type* c_abi_ptrdiff_type(KitCompiler*, Pool*);
     41 const Type* c_abi_intptr_type(KitCompiler*, Pool*);
     42 const Type* c_abi_uintptr_type(KitCompiler*, Pool*);
     43 const Type* c_abi_va_list_type(KitCompiler*, Pool*);
     44 
     45 #endif