-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit.h
More file actions
33 lines (28 loc) · 908 Bytes
/
Copy pathUnit.h
File metadata and controls
33 lines (28 loc) · 908 Bytes
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
#ifndef __UNIT_H__
#define __UNIT_H__
#include <vector>
#include "Function.h"
#include "SymbolTable.h"
class Unit
{
typedef std::vector<Function*>::iterator iterator;
typedef std::vector<Function*>::reverse_iterator reverse_iterator;
private:
std::vector<SymbolEntry*> global_decl_list;
std::vector<Function*> func_list;
std::vector<SymbolEntry*> declare_list;
public:
Unit() = default;
~Unit();
void insertFunc(Function*);
void removeFunc(Function*);
void insertGlobal(SymbolEntry*);
void insertDeclare(SymbolEntry*);
void output() const;
iterator begin() { return func_list.begin(); };
iterator end() { return func_list.end(); };
reverse_iterator rbegin() { return func_list.rbegin(); };
reverse_iterator rend() { return func_list.rend(); };
void genMachineCode(MachineUnit* munit);
};
#endif