-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCode.h
More file actions
84 lines (59 loc) · 1.38 KB
/
Code.h
File metadata and controls
84 lines (59 loc) · 1.38 KB
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
/*
* @Copyright: minic
* @Author: linmaosen
* @Description: 定义中间代码的记录出口函数
* @LastEditors: linmaosen
* @LastEditTime: 2020-06-13
* @FilePath: /minic/Code.h
*/
#pragma once
#include"main.h"
#define pc 7
#define gp 6
#define bp 5
#define sp 4
#define bx 2
#define ax 1
#define zero 0
/**
* @description: 输出注释
* @param {char*}
* @return: void
*/
void emitComment( char * c );
/**
* @description: 添加指令的中间代码
* @param {char*, int, int, int, char*}
* @return: void
*/
void emitRO( char *op, int r, int s, int t, char *c);
/**
* @description: 添加指令的中间代码
* @param {char*, int, int, int, char*}
* @return: void
*/
void emitRM( char * op, int r, int d, int s, char *c);
/**
* @description: 让emitLoc加上howMany, 并返回之前的位置
* @param {int}
* @return: int
*/
int emitSkip( int howMany);
/**
* @description: 回退到指定位置,用于回退设置出口
* @param {int}
* @return: void
*/
void emitBackup( int loc);
/**
* @description: 让emitLoc等于最大值,回到最大的位置
* @param {}
* @return: void
*/
void emitRestore(void);
/**
* @description: 转换成绝对位置
* @param {char*, int, int, char*}
* @return: void
*/
void emitRM_Abs( char *op, int r, int a, char * c);