| 6 | #include "Processor/Instruction.hpp" |
| 7 | |
| 8 | void Program::compute_constants() |
| 9 | { |
| 10 | bool debug = OnlineOptions::singleton.has_option("debug_alloc"); |
| 11 | |
| 12 | for (int reg_type = 0; reg_type < MAX_REG_TYPE; reg_type++) |
| 13 | { |
| 14 | max_reg[reg_type] = 0; |
| 15 | max_mem[reg_type] = 0; |
| 16 | } |
| 17 | for (unsigned int i=0; i<p.size(); i++) |
| 18 | { |
| 19 | if (!p[i].get_offline_data_usage(offline_data_used)) |
| 20 | unknown_usage = true; |
| 21 | for (int reg_type = 0; reg_type < MAX_REG_TYPE; reg_type++) |
| 22 | { |
| 23 | auto reg = p[i].get_max_reg(reg_type); |
| 24 | if (debug and reg) |
| 25 | cerr << i << ": " << reg << endl; |
| 26 | max_reg[reg_type] = max(max_reg[reg_type], reg); |
| 27 | max_mem[reg_type] = max(max_mem[reg_type], |
| 28 | p[i].get_mem(RegType(reg_type))); |
| 29 | } |
| 30 | writes_persistence |= (p[i].opcode & 0xFF) == WRITEFILESHARE; |
| 31 | writes_persistence |= (p[i].opcode & 0xFF) == WRITEFILECLEAR; |
| 32 | } |
| 33 | |
| 34 | |
| 35 | if (not p.empty() and OnlineOptions::singleton.has_option("verbose_alloc")) |
| 36 | { |
| 37 | cerr << "Register usage in " << name << ":" << endl; |
| 38 | for (int reg_type = 0; reg_type < MAX_REG_TYPE; reg_type++) |
| 39 | if (max_reg[reg_type]) |
| 40 | cerr << "\tType " << reg_type << ": " << max_reg[reg_type] << endl; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | void Program::parse(string filename) |
| 45 | { |
nothing calls this directly
no test coverage detected