forked from blitz-research/blitz3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ir_code.txt
38 lines (30 loc) · 1.15 KB
/
ir_code.txt
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
Intermediate representation of program:
Data...
LABEL( sconst ) ;insert an ASM label
INT( iconst ) ;insert int constant
FLOAT( fconst ) ;insert float constant
STRING( sconst ) ;insert string constant
Code...
Statements only:
ENTER( iconst ) ;enter func with iconst locals
LEAVE( iconst ) ;leave func with iconst locals
JUMP( sconst ) ;jump to label sconst
JUMPT( l,sconst ) ;eval expr-l, if !=0 jump to label sconst
JUMPF( r,sconst ) ;eval expr-r, if ==0 jump to label sconst
RETURN( l,sconst ) ;eval expr-l into return reg and jump to label sconst
STORE( l,r ) ;eval expr-r and store it in expr-l
Stmts or expressions:
CALL( l,r ) ;eval expr-r, push it and call expr-l
ARGS( l,r ) ;eval expr-r, push it, eval expr-l
FRAME() ;copy of frame pointer
GLOBAL( sconst ) ;address of label sconst
LOAD( l ) ;integer load
NEG( l ),NOT( l ).. ;integer uniops
ADD( l,r ),SUB( l,r ).. ;integer binops
CONST( iconst ) ;integer constant
CAST( l ) ;cast float expr-l to int
FLOAD( l ) ;float load
FNEG( l ),FNOT( l ).. ;float uniops
FADD( l,r ),FSUB( l,r ).;float binops
FCONST( fconst ) ;float constant
FCAST( l ) ;cast int expr-l to float