forked from cgeyer/llvm-cbg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PredecessorList.h
75 lines (52 loc) · 1.46 KB
/
PredecessorList.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* PredecessorList.h
*
* Created on: Nov 7, 2011
* Author: cbg
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*/
#ifndef PREDECESSORLIST_H_
#define PREDECESSORLIST_H_
#include "llvm/CodeGen/MachineBasicBlock.h"
#include <list>
using namespace llvm;
class PredecessorList {
protected:
class ListEntry {
private:
MachineBasicBlock* MBB;
ListEntry* predecessor;
public:
ListEntry(MachineBasicBlock* mbb, ListEntry* pred) :
MBB(mbb), predecessor(pred) {}
ListEntry(MachineBasicBlock* mbb) :
MBB(mbb), predecessor(0) {}
ListEntry* getPredecessor(void) const {
return predecessor;
}
MachineBasicBlock* getMachineBasicBlock(void) const {
return MBB;
}
ListEntry& operator=(const ListEntry&);
bool operator==(const MachineBasicBlock*) const;
bool operator!=(const MachineBasicBlock*) const;
};
typedef std::list<ListEntry*> PredList;
private:
PredList listEntries;
protected:
ListEntry* findMachineBasicBlock(const MachineBasicBlock*);
public:
typedef std::list<MachineBasicBlock*> MBB_list;
PredecessorList() :
listEntries(0) {}
~PredecessorList();
void insertRoot(MachineBasicBlock* mbb);
void insertSuccessor(MachineBasicBlock* mbb,
const MachineBasicBlock* predecessor);
MBB_list getPredecessors(const MachineBasicBlock* &mbb);
};
#endif /* PREDECESSORLIST_H_ */