ANTAREX API

Clava API

LARA API

LARA Common Language API

MemoiGen

Constructor

MemoiGen

new MemoiGen(target)

Parameters

target: any

Static Members

ApplyPolicy

ApplyPolicy

MemoiGen.ApplyPolicy = {
ALWAYS : function(report) {
return true;
},
NOT_EMPTY : function(report) {
if(MemoiUtils.mean(report.elements, report.reportCount) === 0) {
debug('skipped - no calls');
return false;
}

return true;
},
_OVER_X_PCT : function(report, x) {
var hits = MemoiUtils.mean(report.hits, report.reportCount);
var calls = MemoiUtils.mean(report.calls, report.reportCount);

var ratio = calls === 0 ? 0 : hits/calls;

println("_OVER_X_PCT " + x);
println("hits: " + hits);
println("calls: " + calls);
println("ratio: " + ratio);

return ratio > x;
},
OVER_15_PCT : function(report) {

return MemoiGen.ApplyPolicy._OVER_X_PCT(report, 0.15);
},
OVER_25_PCT : function(report) {

return MemoiGen.ApplyPolicy._OVER_X_PCT(report, 0.25);
},
OVER_50_PCT : function(report) {

return MemoiGen.ApplyPolicy._OVER_X_PCT(report, 0.5);
},
OVER_75_PCT : function(report) {

return MemoiGen.ApplyPolicy._OVER_X_PCT(report, 0.75);
},
OVER_90_PCT : function(report) {

return MemoiGen.ApplyPolicy._OVER_X_PCT(report, 0.9);
}
};


Instance Members

generate

generate()

Generates a table for all calls of the target function.

If a profiling reports are provided, the reports are used to
determine whether to generate for all target or for each single
target.


generateAll

generateAll()

Generates a table for all calls of the target function.

If a profiling reports are provided, the reports are used to
determine whether to generate for all target or for each single
target.


generateEach

generateEach()

Generates a table for each call of the target function.

If a profiling reports are provided, the reports are used to
determine whether to generate for all target or for each single
target.


generatePerfectInst

generatePerfectInst()

setApplyPolicy

setApplyPolicy(policy)

Sets the apply policy.
Defaults to MemoiApplyPolicy.NOT_EMPTY.

Parameters

policy: any

setApproxBits

setApproxBits(bits)

Sets the approximation bits in the final application.
Defaults to 0.

Parameters

bits: any

setDebug

setDebug(isDebug)

Sets whether to generate debug code in the final application.

Parameters

isDebug: any

setEmpty

setEmpty(isEmpty)

Sets whether to generate an empty table in the final application.

Parameters

isEmpty: any

setOnline

setOnline(isOnline)

Sets whether to generate update code in the final application.

Parameters

isOnline: any

setProfFromDir

setProfFromDir(dir)

Checks dir for reports matching the current target.

Parameters

dir: string - the path to the directory of the report files

setProfFromFileNames

setProfFromFileNames(names)

Checks files with the given names for reports matching the current target.

Parameters

names: string[]|...string - the paths of the report files

setResetFunc

setResetFunc(isResetFunc)

Sets whether to generate a reset function.

Parameters

isResetFunc: any

setTableSize

setTableSize(size)

Sets the table size in the final application.
Defaults to 65536.

Parameters

size: any

setUpdateAlways

setUpdateAlways(isUpdateAlways)

Sets whether to always update the table on a miss, even if not vacant.

Parameters

isUpdateAlways: any

setZeroSim

setZeroSim(isZeroSim)

Sets whether to generate code for a 0% sim.

Parameters

isZeroSim: any