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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
#include "lib9.h"
#include <bio.h>
#include <ctype.h>
#include "../include/isa.h"
enum
{
Eof = -1,
False = 0,
True = 1,
Strsize = 1024,
Hashsize = 128
};
typedef struct Addr Addr;
typedef struct Inst Inst;
typedef struct String String;
typedef struct Sym Sym;
typedef struct Keywd Keywd;
typedef struct Desc Desc;
typedef struct Array Array;
typedef struct List List;
typedef struct Link Link;
struct Addr
{
uchar mode;
ushort off;
long val;
Sym* sym;
};
struct List
{
List* link;
int addr;
int type;
union {
vlong ival;
double fval;
String* str;
Array* a;
}u;
};
struct Inst
{
uchar op;
uchar type;
int size;
Addr* reg;
Addr* src;
Addr* dst;
ulong pc;
Sym* sym;
Inst* link;
};
struct String
{
int len;
String* next;
char* string;
};
struct Sym
{
char* name;
int lexval;
Sym* hash;
int value;
int ds;
};
struct Desc
{
int id;
int size;
int np;
uchar* map;
Desc* link;
};
struct Array
{
int i;
int size;
};
struct Link
{
int desc;
int addr;
int type;
char* name;
Link* link;
};
Sym* enter(char*, int);
Sym* lookup(char*);
void yyerror(char*, ...);
void fatal(char*, ...);
void diag(char*, ...);
int numsym(char);
int mpatof(char*, double*);
void kinit(void);
Inst* ai(int);
Addr* aa(int);
void assem(Inst*);
int iconv(Fmt*);
int aconv(Fmt*);
int opcode(Inst*);
void heap(int, int, String*);
List* newa(int, int);
List* newi(vlong, List*);
List* news(String*, List*);
void data(int, int, List*);
void dout(void);
void ext(int, int, String*);
void mklink(int, int, int, String*);
vlong dtocanon(double);
void ldts(int);
void excs(int);
void exc(int, int, int, int, int, int);
void etab(String*, int);
void source(String*);
int yyparse(void);
int yylex(void);
extern Biobuf* bout;
extern int nerr;
extern int heapid;
extern Desc* dlist;
extern int dcount;
extern int dseg;
extern List* mdata;
extern Sym* module;
extern Link* links;
extern Link* linkt;
extern int nlink;
extern int listing;
extern int dontcompile;
extern int mustcompile;
extern int dentry;
extern int pcentry;
#pragma varargck type "i" Inst*
#pragma varargck type "a" Addr*
|