summaryrefslogtreecommitdiff
path: root/scope.h
blob: b12ce5ea35ec1cee084ea52cacddf47f953e4f49 (plain) (blame)
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
#ifndef SCOPE_H
#define SCOPE_H

#include <llvm-c/Core.h>

typedef struct scope_entry {
    char *id;
    LLVMValueRef value;
    LLVMTypeRef type;
    LLVMMetadataRef metadata;

    int has_filler;
    struct {
        char *id;
        LLVMValueRef value;
        LLVMTypeRef type;
        LLVMTypeRef constructs;
    } filler;

    struct scope_entry *prev;
} scope_entry;

typedef struct scope_layer {
    struct scope_entry *head;
    struct scope_layer *prev;
} scope_layer;

typedef scope_layer *scope;

void scope_push_layer(scope *sc);
void scope_pop_layer(scope *sc);

scope_entry *scope_add_entry(scope sc, char *id, LLVMValueRef val,
        LLVMTypeRef type);

scope_entry *scope_find(scope sc, char *id);

#endif /* SCOPE_H */