aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/cc.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/cc/cc.h')
-rw-r--r--sys/cmd/cc/cc.h42
1 files changed, 30 insertions, 12 deletions
diff --git a/sys/cmd/cc/cc.h b/sys/cmd/cc/cc.h
index e8ab05e..ce7eca7 100644
--- a/sys/cmd/cc/cc.h
+++ b/sys/cmd/cc/cc.h
@@ -374,7 +374,7 @@ enum
Dvar,
Dvars,
- /* names (shouldn't interact with base AST node enumeration */
+ /* names */
Nident,
Nparen,
Nindex,
@@ -577,7 +577,7 @@ struct Name
} idx;
struct {
int n;
- int vararg : 1;
+ int dots : 1;
Obj *arg;
} call;
};
@@ -641,7 +641,7 @@ struct Type
uintptr size;
uintptr max;
uint16 align : 8;
- uint16 sign : 2;
+ uint8 sign : 2;
union {
struct {
uint32 qual;
@@ -655,12 +655,17 @@ struct Type
int len;
Obj *f;
Expr *x;
- } agr;
+ } aggr;
struct {
int len;
string *s;
Expr *x;
} enm;
+ struct {
+ Type *ret;
+ int n;
+ Type **arg;
+ } func;
};
};
@@ -701,7 +706,7 @@ struct Parser
error parse(Parser *, Lexer *);
// -----------------------------------------------------------------------
-// global compiler
+// global compiler data
struct StrTab
{
@@ -714,14 +719,19 @@ struct StrTab
int32 *vals;
};
-/* cc.c string functions */
-int32 intern(byte **str);
-string internview(byte* beg, byte *end);
+struct TypeSet
+{
+ int32 n_buckets;
+ int32 size;
+ int32 n_occupied;
+ int32 upper_bound;
+ int32 *flags;
+ Type **keys;
+};
/* main data */
struct Compiler
{
- /* storage */
memĀ·Arena *heap;
StrTab strs;
string outfile;
@@ -739,15 +749,23 @@ struct Compiler
} inc;
struct {
+ struct TypeSet p; // pointer
+ struct TypeSet a; // array
+ struct TypeSet f; // funcs
+ struct TypeSet s; // structs
+ struct TypeSet u; // unions
+ struct TypeSet e; // enums
+
int cap;
int len;
Type *info;
} type;
-};
+};
extern Compiler C;
-/* cc.c compiler functions */
-void init();
+/* cc.c functions */
+void init();
+int32 intern(byte **str);
#undef iota