Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file autoTune0.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697openGobConfigopenGoblintCilletisActivateda=get_bool"ana.autotune.enabled"&&List.mema@@get_string_list"ana.autotune.activated"(*Collect stats to be able to make decisions*)typecomplexityFactors={mutablefunctions:int;(*function definitions. Does not include extern functions, but functions that get added by goblint (e.g. bsearch or __VERIFIER_nondet_pointer (sv-comp))*)mutablefunctionCalls:int;(*places where functions are called*)mutableloops:int;mutableloopBreaks:int;(*Breaks and continues. Cil converts the loop conditions to a break. Only set if collection is done before prepareCFG, afterwards they are replaced by GOTOs*)mutablecontrolFlowStatements:int;(*Return, Goto, break, continue, if, switch. Includes at least one (implicit) return in each function*)mutableexpressions:int;(* recursively. e.g. x = x + 1 has 4 expressions*)mutableinstructions:int;(*function calls and assignments*)mutableintegralVars:(int*int);(*global, local. Does not consider the types that a pointer/array contains*)mutablearrayVars:(int*int);mutablepointerVars:(int*int);}letprintFactorsf=Printf.printf"functions: %d\n"f.functions;Printf.printf"functionCalls: %d\n"f.functionCalls;Printf.printf"loops: %d\n"f.loops;Printf.printf"loopBreaks: %d\n"f.loopBreaks;Printf.printf"controlFlowStatements: %d\n"f.controlFlowStatements;Printf.printf"expressions: %d\n"f.expressions;Printf.printf"instructions: %d\n"f.instructions;Printf.printf"integralVars: (%d,%d)\n"(fstf.integralVars)(sndf.integralVars);Printf.printf"arrayVars: (%d,%d)\n"(fstf.arrayVars)(sndf.arrayVars);Printf.printf"pointerVars: (%d,%d)\n"(fstf.pointerVars)(sndf.pointerVars);flushstdout;classcollectComplexityFactorsVisitor(factors)=objectinheritnopCilVisitormethod!vfunc_=factors.functions<-factors.functions+1;DoChildrenmethod!vvdecvar=letincVar(g,l)=ifvar.vglobthen(g+1,l)else(g,l+1)in(ifisIntegralTypevar.vtypethenfactors.integralVars<-incVarfactors.integralVarselseifisPointerTypevar.vtypethenfactors.pointerVars<-incVarfactors.pointerVarselseifisArrayTypevar.vtypethenfactors.arrayVars<-incVarfactors.arrayVars);DoChildrenmethod!vexpr_=factors.expressions<-factors.expressions+1;DoChildrenmethod!vinst=function|Set_->factors.instructions<-factors.instructions+1;DoChildren|Call(Some_,_,_,_,_)->factors.instructions<-factors.instructions+2;(*Count function call and assignment of the result seperately *)factors.functionCalls<-factors.functionCalls+1;DoChildren|Call_->factors.instructions<-factors.instructions+1;factors.functionCalls<-factors.functionCalls+1;DoChildren|_->DoChildrenmethod!vstmtstmt=matchstmt.skindwith|Loop_->factors.controlFlowStatements<-factors.controlFlowStatements+1;factors.loops<-factors.loops+1;DoChildren|If_|Switch_|Goto_|ComputedGoto_|Return_->factors.controlFlowStatements<-factors.controlFlowStatements+1;DoChildren|Break_|Continue_->factors.controlFlowStatements<-factors.controlFlowStatements+1;factors.loopBreaks<-factors.loopBreaks+1;DoChildren|_->DoChildrenendletcollectFactorsvisitActionvisitedObject=letfactors={functions=0;functionCalls=0;loops=0;loopBreaks=0;controlFlowStatements=0;expressions=0;instructions=0;integralVars=(0,0);arrayVars=(0,0);pointerVars=(0,0);}inletvisitor=newcollectComplexityFactorsVisitor(factors)inignore(visitActionvisitorvisitedObject);factorsletis_large_array=function|TArray(_,Some(Const(CInt(i,_,_))),_)->i>Z.of_int@@10*get_int"ana.base.arrays.unrolling-factor"|_->false