-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction.h
More file actions
43 lines (37 loc) · 1.11 KB
/
Copy pathFunction.h
File metadata and controls
43 lines (37 loc) · 1.11 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
#ifndef __FUNCTION_H__
#define __FUNCTION_H__
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include "AsmBuilder.h"
#include "Ast.h"
#include "BasicBlock.h"
#include "SymbolTable.h"
class Unit;
class Function
{
typedef std::vector<BasicBlock *>::iterator iterator;
typedef std::vector<BasicBlock *>::reverse_iterator reverse_iterator;
private:
std::vector<BasicBlock *> block_list;
SymbolEntry *sym_ptr;
BasicBlock *entry;
Unit *parent;
public:
Function(Unit *, SymbolEntry *);
~Function();
void insertBlock(BasicBlock *bb) { block_list.push_back(bb); };
BasicBlock *getEntry() { return entry; };
void remove(BasicBlock *bb);
void output() const;
std::vector<BasicBlock *> &getBlockList(){return block_list;};
iterator begin() { return block_list.begin(); };
iterator end() { return block_list.end(); };
reverse_iterator rbegin() { return block_list.rbegin(); };
reverse_iterator rend() { return block_list.rend(); };
SymbolEntry *getSymPtr() { return sym_ptr; };
void genMachineCode(AsmBuilder*);
};
#endif