MCPcopy Create free account
hub / github.com/csmith-project/csmith / permute_param_oders

Method permute_param_oders

src/FunctionInvocation.cpp:416–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416vector<intvec>
417FunctionInvocation::permute_param_oders(void) const
418{
419 vector<intvec> ret;
420 intvec ret_base; // the ordered sequence
421 vector<int> base;
422 size_t i, j;
423 // shortcut for 2 parameters
424 if (param_value.size() == 2) {
425 ret_base.push_back(0);
426 ret_base.push_back(1);
427 ret.push_back(ret_base);
428 ret_base.clear();
429 ret_base.push_back(1);
430 ret_base.push_back(0);
431 ret.push_back(ret_base);
432 return ret;
433 }
434 // get initial order, mark those paramters that invoke function call
435 for (i=0; i<param_value.size(); i++) {
436 if (param_value[i]->func_count() > 0) {
437 base.push_back(i);
438 }
439 ret_base.push_back(i);
440 }
441 // permute
442 vector<intvec> permuted = permute(base);
443 for (i=0; i<permuted.size(); i++) {
444 intvec new_seq = permuted[i];
445 intvec tmp = ret_base;
446 for (j=0; j<new_seq.size(); j++) {
447 // plug back the new sequence into initial ordered sequence
448 int orig_pos = base[j];
449 int new_pos = new_seq[j];
450 tmp[orig_pos] = new_pos;
451 }
452 ret.push_back(tmp);
453 }
454 return ret;
455}
456
457bool
458FunctionInvocation::visit_unordered_params(vector<const Fact*>& inputs, CGContext& cg_context) const

Callers

nothing calls this directly

Calls 4

permuteFunction · 0.85
sizeMethod · 0.80
func_countMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected