MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / compute_constants

Method compute_constants

Processor/Program.cpp:8–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "Processor/Instruction.hpp"
7
8void 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
44void Program::parse(string filename)
45{

Callers

nothing calls this directly

Calls 8

maxFunction · 0.85
has_optionMethod · 0.80
get_max_regMethod · 0.80
RegTypeEnum · 0.70
sizeMethod · 0.45
get_memMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected