-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.h
41 lines (26 loc) · 846 Bytes
/
type.h
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
#ifndef TYPE_H
#define TYPE_H
#include <llvm-c/Core.h>
#include <stdbool.h>
#include "list.h"
typedef struct type_system_t {
list_t* types;
} type_system_t;
typedef struct type_t {
bool primitive;
char* name;
LLVMTypeRef (*get_ref)();
LLVMValueRef (*convert)(type_system_t*, LLVMBuilderRef, LLVMValueRef, struct type_t*);
} type_t;
type_system_t* type_init();
void type_system_free(type_system_t*);
type_t* type_get(type_system_t* type_sys, char* name);
type_t* type_set(type_system_t* type_sys, bool primitive, char* name,
LLVMTypeRef (*get_ref)(void*),
LLVMValueRef (*convert)(type_system_t*, LLVMBuilderRef, LLVMValueRef, type_t*)
);
bool type_equals(type_t* type1, type_t* type2);
bool type_name_is(type_t* type, char* name);
char* type_to_string(type_t* type);
LLVMTypeRef type_get_ref(type_t* type);
#endif