-
Notifications
You must be signed in to change notification settings - Fork 1
/
flowgraph.h
56 lines (45 loc) · 1.28 KB
/
flowgraph.h
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
#ifndef _FLOWGRAPH_H
#define _FLOWGRAPH_H
#include "assembler.h"
namespace Optimize {
class FlowGraphNode {
friend class FlowGraph;
private:
const Asm::Instruction *instruction;
/**
* Instruction outputs without the ignored node
*/
std::vector<IR::VirtualRegister *> used;
/**
* Same as instruction->is_reg_to_reg_assign, except if assignment
* source is the ignored register this will be false instead
*/
bool is_reg_to_reg_assign;
public:
int index;
std::list<FlowGraphNode *> previous, next;
FlowGraphNode(int _index, const Asm::Instruction *_instruction,
IR::VirtualRegister *ignored_register);
const std::vector<IR::VirtualRegister *> &usedRegisters() const;
const std::vector<IR::VirtualRegister *> &assignedRegisters() const;
bool isRegToRegAssignment() const {return is_reg_to_reg_assign;}
};
class FlowGraph {
public:
typedef std::list<FlowGraphNode> NodeList;
private:
NodeList nodes;
int nodecount;
public:
FlowGraphNode *last_instruction;
/**
* Frame pointer should be ignored_register because it's not
* handled by the register allocator
*/
FlowGraph(const Asm::Instructions &code,
IR::VirtualRegister *ignored_register);
int nodeCount() const {return nodecount;}
const NodeList &getNodes() const {return nodes;}
};
};
#endif // FLOWGRAPH_H