-
Notifications
You must be signed in to change notification settings - Fork 126
/
Copy pathBasicBlock.php
102 lines (83 loc) · 1.83 KB
/
BasicBlock.php
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
require_once CURR_PATH . '/CFGEdge.php';
require CURR_PATH . '/summary/BlockSummary.class.php';
/**
* 定义基本块信息
* @author exploit
*
*/
class BasicBlock{
//基本块中包含的AST node,放入list中
private $containedNodes ;
private $blockSummary;
public $is_entry = false ;
public $is_exit = false ;
public $loop_var = NULL;
//CFG节点的进入边
private $inEdges = array() ;
//CFG节点的出边
private $outEdges = array() ;
public function __construct(){
$this->containedNodes = array() ;
$this->blockSummary = new BlockSummary() ;
}
/**
* 给定一个node,将其加入到containedNodes中
* @param unknown $node
*/
public function addNode($node){
if($node){
array_push($this->containedNodes, $node) ;
}else{
return ;
}
}
/**
* 获取基本块中所有的AST节点
*/
public function getContainedNodes(){
return $this->containedNodes ;
}
public function getBlockSummary() {
return $this->blockSummary;
}
public function setBlockSummary($blockSummary) {
$this->blockSummary = $blockSummary;
}
/**
* 为CFG中的节点添加入入边
* @param unknown $inEdge
*/
public function addInEdge($inEdge){
if($inEdge){
array_push($this->inEdges, $inEdge) ;
}else{
return ;
}
}
/**
* 为CFG中的节点加入出边
* @param unknown $outEdge
*/
public function addOutEdge($outEdge){
if($outEdge){
array_push($this->outEdges, $outEdge) ;
}else{
return ;
}
}
//--------------------------Getter && Setter---------------------------------------------
public function getInEdges() {
return $this->inEdges;
}
public function getOutEdges() {
return $this->outEdges;
}
public function setInEdges($inEdges) {
$this->inEdges = $inEdges;
}
public function setOutEdges($outEdges) {
$this->outEdges = $outEdges;
}
}
?>