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

Method limit_binarys

src/ReducerOutputMgr.cpp:438–463  ·  view source on GitHub ↗

* limit the number of binary operations by removing some simple ones */

Source from the content-addressed store, hash-verified

436 * limit the number of binary operations by removing some simple ones
437 */
438void
439ReducerOutputMgr::limit_binarys(vector<const FunctionInvocationBinary*>& binarys, vector<int>& ids)
440{
441 int s;
442 while (binarys.size() > BINARY_REDUCTION_LIMIT) {
443 for (s = binarys.size() - 1; s>=0; s--) {
444 const FunctionInvocationBinary* fib = binarys[s];
445 vector<const FunctionInvocationBinary*> dummy1;
446 vector<int> dummy2;
447 if (reducer->find_binary_operations(fib->param_value[0], dummy1, dummy2, true) == 0 &&
448 reducer->find_binary_operations(fib->param_value[1], dummy1, dummy2, true) == 0) {
449 binarys.erase(binarys.begin() + s);
450 ids.erase(ids.begin() + s);
451 break;
452 }
453 }
454 }
455 // if still more than limit, delete the last few binary operations
456 if (binarys.size() > BINARY_REDUCTION_LIMIT) {
457 int extra = binarys.size() - BINARY_REDUCTION_LIMIT;
458 for (s=0; s<extra; s++) {
459 binarys.pop_back();
460 ids.pop_back();
461 }
462 }
463}
464
465/*******************************************************************************
466 * output statement with "all" possible binary reductions.

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
beginMethod · 0.80

Tested by

no test coverage detected