38 auto c_pos = val.find(
':');
39 if(c_pos != std::string::npos)
41 std::string nr = val.substr(0, c_pos);
43 val.erase(0, nr.size() + 1);
47 auto last_c_pos = val.rfind(
':');
48 if(last_c_pos != std::string::npos)
50 std::string
id = val.substr(0, last_c_pos);
58 if(maybe_fn && maybe_fn->
type.
id() == ID_code)
64 auto last_dot_pos = val.rfind(
'.');
65 if(last_dot_pos == std::string::npos)
68 "invalid loop identifier " + id,
"unwindset"};
71 std::string function_id =
id.substr(0, last_dot_pos);
72 std::string loop_nr_label =
id.substr(last_dot_pos + 1);
74 if(loop_nr_label.empty())
77 "invalid loop identifier " + id,
"unwindset"};
83 log.warning() <<
"loop identifier " <<
id
84 <<
" for non-existent function provided with unwindset"
91 if(isdigit(loop_nr_label[0]))
97 "invalid loop identifier " + id,
"unwindset"};
100 bool found = std::any_of(
104 return instruction.is_backwards_goto() &&
105 instruction.loop_number == nr;
110 log.warning() <<
"loop identifier " <<
id
111 <<
" provided with unwindset does not match any loop"
124 instruction.labels.begin(),
125 instruction.labels.end(),
126 loop_nr_label) != instruction.labels.end())
128 location = instruction.source_location();
131 location->remove(ID_hide);
134 location.has_value() && instruction.is_backwards_goto() &&
135 instruction.source_location() == *location)
141 <<
"loop identifier " <<
id
144 nr = instruction.loop_number;
150 log.warning() <<
"loop identifier " <<
id
151 <<
" provided with unwindset does not match any loop"
160 std::string uw_string = val.substr(last_c_pos + 1);
165 if(uw_string.empty())
170 if(thread_nr.has_value())
178 const std::list<std::string> &unwindset,
181 for(
auto &element : unwindset)
192 thread_loop_map.find(std::pair<irep_idt, unsigned>(loop_id, thread_nr));
195 return tl_it->second;
208 const std::string &file_name,
212 std::ifstream file(
widen(file_name));
214 std::ifstream file(file_name);
218 throw "cannot open file "+file_name;
220 std::stringstream buffer;
221 buffer << file.rdbuf();
223 std::vector<std::string> unwindset_elements =
226 for(
auto &element : unwindset_elements)