-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbblock.cpp
More file actions
55 lines (51 loc) · 1.11 KB
/
bblock.cpp
File metadata and controls
55 lines (51 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
44
45
46
47
48
49
50
51
52
53
54
55
#include "stdafx.h"
#include "bblock.h"
bblock::bblock()
{
time = 0;
}
bblock::~bblock()
{
}
void bblock::set_instructions(list<line> inst){
instructions = inst;
string temp_inst = inst.back().get_inst().get_inst();
if (temp_inst == "beq" || temp_inst == "bne" || temp_inst == "bnez" || temp_inst == "beqz" || temp_inst == "j" || temp_inst == "jr" || temp_inst == "jal"){
set_call_for(instructions.back().get_inst().get_op().back());
}
else{
call_for.clear();
}
fst_addr = inst.front().get_add1();
lst_addr = inst.back().get_add1();
}
list<line> bblock::get_instructions(){
return instructions;
}
void bblock::set_call_for(string vec){
if (vec[0] == '0' && vec[1] == 'x'){
vec.erase(vec.begin(), vec.begin() + 2);
}
call_for = vec;
}
string bblock::get_call_for(){
return call_for;
}
void bblock::set_called_by(list<string> vec){
called_by = vec;
}
void bblock::set_fst_addr(string str){
fst_addr = str;
}
void bblock::set_lst_addr(string str){
lst_addr = str;
}
void bblock::set_time(int t){
time = t;
}
string bblock::get_fst_addr(){
return fst_addr;
}
string bblock::get_lst_addr(){
return lst_addr;
}