Skip to content

Commit

Permalink
- Added -noedgerem command-line option for SPSTF analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb committed Sep 21, 2012
1 parent 56900fa commit c35c577
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
11 changes: 7 additions & 4 deletions source/analysis/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ function TypeAnalysis()
/**
Test type analysis on a source file or a list of source files
*/
TypeAnalysis.prototype.testOnFiles = function (fileList, useStdlib)
TypeAnalysis.prototype.testOnFiles = function (fileList, options)
{
if (typeof fileList === 'string')
fileList = [fileList];

// Clear existing analysis results
this.init();
// Get the relevant command-line options
var useStdLib = !options['nostdlib'];

// Clear existing analysis results and re-initialize the analysis
this.init(options);

// Get the host and client compilation parameters
var hostParams = config.hostParams;
Expand Down Expand Up @@ -107,7 +110,7 @@ TypeAnalysis.prototype.testOnFiles = function (fileList, useStdlib)
this.allUnits = [];

// If the standard library should be included
if (useStdlib === true)
if (useStdLib === true)
{
// For each stdlib file
for (var i = 0; i < libFiles.length; ++i)
Expand Down
13 changes: 11 additions & 2 deletions source/analysis/spstf.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ SPSTFInstr.prototype.getValName = function ()
function SPSTF()
{
// Initialize the type analysis
this.init();
this.init({});
}
SPSTF.prototype = new TypeAnalysis();

Expand All @@ -507,8 +507,13 @@ SPSTF.MAX_EDGE_REMS = 10;
/**
Initialize/reset the analysis
*/
SPSTF.prototype.init = function ()
SPSTF.prototype.init = function (options)
{
/**
Option to disable edge removal during analysis
*/
this.noEdgeRem = Boolean(options['noedgerem']);

// Clear the object map
TGObject.objMap.clear();

Expand Down Expand Up @@ -1812,6 +1817,10 @@ SPSTF.prototype.remEdge = function (
use
)
{
// If edge removal is disabled, return
if (this.noEdgeRem == true)
return;

/*
print('Removing edge');
print(' val : ' + def.value);
Expand Down
12 changes: 5 additions & 7 deletions source/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ function main()
var taName = args.options['ta'];

var analysis;

switch (taName)
{
case true:
Expand Down Expand Up @@ -143,15 +142,10 @@ function main()

print('Running ' + taName + ' analysis on: ' + args.files);

// Get the type analysis parameters
var useStdLib = !args.options['nostdlib'];
var outFile = args.options['outfile'];
var htmlFile = args.options['html'];

// Run the type analysis
try
{
analysis.testOnFiles(args.files, useStdLib);
analysis.testOnFiles(args.files, args.options);
}
catch (e)
{
Expand All @@ -161,6 +155,10 @@ function main()
print(e);
}

// Get the output options
var outFile = args.options['outfile'];
var htmlFile = args.options['html'];

// Output analysis results
analysis.logResults(outFile);

Expand Down

0 comments on commit c35c577

Please sign in to comment.