aboutsummaryrefslogtreecommitdiffstats
path: root/lcc/src/rcc.asdl
blob: 833478e2bf94c338363f2cbf70688a63c012cc95 (plain)
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
-- lcc IR
-- $Id: rcc.asdl 145 2001-10-17 21:53:10Z timo $
module rcc {

-- Pickles start with an int version number, followed by rcc.program

program = (int nuids,int nlabels,item* items,interface* interfaces,int argc,string *argv)

real	= (int msb,int lsb)

item	= Symbol(symbol symbol)
	| Type(type type)
	attributes(int uid)

symbol	= (identifier id,int type,int scope,int sclass,int ref,int flags)

field	= (identifier id,int type,int offset,int bitsize,int lsb)

enum	= (identifier id,int value)

type	= INT
	| UNSIGNED
	| FLOAT
	| VOID
	| POINTER(int type)
	| ENUM(identifier tag,enum* ids)
	| STRUCT(identifier tag,field* fields)
	| UNION(identifier tag,field* fields)
	| ARRAY(int type)
	| FUNCTION(int type,int* formals)
	| CONST(int type)
	| VOLATILE(int type)
	attributes(int size,int align)

interface	= Export(int p)
		| Import(int p)
		| Global(int p,int seg)
		| Local(int uid,symbol p)		-- includes formals
		| Address(int uid,symbol q,int p,int n)
		| Segment(int seg)
		| Defaddress(int p)
		| Deflabel(int label)
		| Defconst(int suffix,int size,int value)
		| Defconstf(int size,real value)
		| Defstring(string s)
		| Space(int n)
		| Function(int f,int* caller,int* callee,int ncalls,interface* codelist)
		| Blockbeg
		| Blockend
		| Forest(node* nodes)

node	= CNST(int value)
	| CNSTF(real value)
	| ARG(node left,int len,int align)
	| ASGN(node left,node right,int len,int align)
	| CVT(int op,node left,int fromsize)
	| CALL(node left,int type)
	| CALLB(node left,node right,int type)
	| RET
	| ADDRG(int uid)
	| ADDRL(int uid)
	| ADDRF(int uid)
	| Unary(int op,node left)				-- INDIR RET JUMP NEG BCOM
	| Binary(int op,node left,node right)			-- ADD SUB DIV MUL MOD BOR BAND BXOR RSH LSH
	| Compare(int op,node left,node right,int label)	-- EQ NE GT GE LE LT
	| LABEL(int label)
	| BRANCH(int label)
	| CSE(int uid,node node)
	attributes(int suffix,int size)
}