coverage guided deletion
This commit is contained in:
parent
10bcaa2caf
commit
e7bf886902
@ -14,7 +14,7 @@ def perform_test(exepath,filepath,outname)
|
||||
filepath=path_local(filepath)
|
||||
printf("calling:" + "#{exepath} -a1 -o#{output_path}.a1 #{filepath}\n")
|
||||
result = `#{exepath} -a1 -o#{output_path}.a1 #{filepath}`
|
||||
result = `#{exepath} -a2msc -o#{output_path}.a2 #{filepath}`
|
||||
result = `#{exepath} -a2msc -V -o#{output_path}.a2 #{filepath}`
|
||||
puts result
|
||||
p $?
|
||||
end
|
||||
|
||||
@ -20,26 +20,6 @@ void newBundle (bundle *)
|
||||
}
|
||||
|
||||
|
||||
/* Increments the size of the table strTab by deltaProcLines and copies all
|
||||
* the strings to the new table. */
|
||||
static void incTableSize (strTable *strTab)
|
||||
{
|
||||
strTab->resize(strTab->size()+deltaProcLines);
|
||||
}
|
||||
|
||||
|
||||
/* Appends the new line (in printf style) to the string table strTab. */
|
||||
void appendStrTab (strTable *strTab, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[lineSize];
|
||||
va_start (args, format);
|
||||
vsprintf (buf, format, args);
|
||||
strTab->push_back(buf);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
/* Returns the next available index into the table */
|
||||
Int nextBundleIdx (strTable *strTab)
|
||||
{
|
||||
@ -87,7 +67,7 @@ static void freeStrTab (strTable &strTab)
|
||||
|
||||
void freeBundle (bundle *procCode)
|
||||
/* Deallocates the space taken by the bundle procCode */
|
||||
{
|
||||
{
|
||||
freeStrTab (procCode->decl);
|
||||
freeStrTab (procCode->code);
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ static boolT successor (Int s, Int h, Function * pProc)
|
||||
BB * header;
|
||||
|
||||
header = pProc->dfsLast[h];
|
||||
for (i = 0; i < header->numOutEdges; i++)
|
||||
for (i = 0; i < header->edges.size(); i++)
|
||||
if (header->edges[i].BBptr->dfsLastNum == s)
|
||||
return true;
|
||||
return false;
|
||||
@ -366,7 +366,7 @@ static void tagNodesInCase (BB * pBB, nodeList &l, Int head, Int tail)
|
||||
{
|
||||
insertList (l, current);
|
||||
pBB->caseHead = head;
|
||||
for (i = 0; i < pBB->numOutEdges; i++)
|
||||
for (i = 0; i < pBB->edges.size(); i++)
|
||||
if (pBB->edges[i].BBptr->traversed != DFS_CASE)
|
||||
tagNodesInCase (pBB->edges[i].BBptr, l, head, tail);
|
||||
}
|
||||
@ -406,8 +406,11 @@ void Function::structCases()
|
||||
* header field with caseHeader. */
|
||||
insertList (caseNodes, i);
|
||||
dfsLast[i]->caseHead = i;
|
||||
for (j = 0; j < caseHeader->numOutEdges; j++)
|
||||
tagNodesInCase (caseHeader->edges[j].BBptr, caseNodes, i, exitNode);
|
||||
std::for_each(caseHeader->edges.begin(),caseHeader->edges.end(),
|
||||
[&caseNodes, i, exitNode](TYPEADR_TYPE &pb)
|
||||
{tagNodesInCase(pb.BBptr, caseNodes, i, exitNode);});
|
||||
// for (j = 0; j < caseHeader->edges[j]; j++)
|
||||
// tagNodesInCase (caseHeader->edges[j].BBptr, caseNodes, i, exitNode);
|
||||
if (exitNode != NO_NODE)
|
||||
dfsLast[exitNode]->caseHead = i;
|
||||
}
|
||||
|
||||
@ -171,8 +171,10 @@ void Function::elimCondCodes ()
|
||||
}
|
||||
/* Error - definition not found for use of a cond code */
|
||||
else if (defAt == pBB->start)
|
||||
fatalError (DEF_NOT_FOUND,
|
||||
Icode.GetLlOpcode(useAt-1));
|
||||
{
|
||||
reportError(DEF_NOT_FOUND,Icode.GetLlOpcode(useAt-1));
|
||||
//fatalError (DEF_NOT_FOUND, Icode.GetLlOpcode(useAt-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -591,7 +593,7 @@ static boolT xClear (COND_EXPR *rhs, Int f, Int t, Int lastBBinst, Function * pp
|
||||
return true;
|
||||
/* else if (rhs->expr.ident.idType == LONG_VAR)
|
||||
{
|
||||
missing all other identifiers ****
|
||||
missing all other identifiers ****
|
||||
} */
|
||||
|
||||
case BOOLEAN_OP:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
#include "dcc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
//#ifndef __UNIX__
|
||||
#if 1
|
||||
@ -17,10 +17,8 @@
|
||||
static const char *errorMessage[] = {
|
||||
"Invalid option -%c\n", /* INVALID_ARG */
|
||||
"Invalid instruction %02X at location %06lX\n", /* INVALID_OPCODE */
|
||||
"Don't understand 80386 instruction %02X at location %06lX\n",
|
||||
/* INVALID_386OP */
|
||||
"Segment override with no memory operand at location %06lX\n",
|
||||
/* FUNNY_SEGOVR */
|
||||
"Don't understand 80386 instruction %02X at location %06lX\n", /* INVALID_386OP */
|
||||
"Segment override with no memory operand at location %06lX\n", /* FUNNY_SEGOVR */
|
||||
"REP prefix without a string instruction at location %06lX\n",/* FUNNY_REP */
|
||||
"Cannot open %s\n", /* CANNOT_OPEN */
|
||||
"Error while reading %s\n", /* CANNOT_READ */
|
||||
@ -29,10 +27,9 @@ static const char *errorMessage[] = {
|
||||
"Failed to find a BB for jump to %ld in proc %s\n", /* NO_BB */
|
||||
"Basic Block is a synthetic jump\n", /* INVALID_SYNTHETIC_BB */
|
||||
"Failed to find a BB for interval\n", /* INVALID_INT_BB */
|
||||
"Instruction at location %06lX goes beyond loaded image\n",
|
||||
/* IP_OUT_OF_RANGE*/
|
||||
"Instruction at location %06lX goes beyond loaded image\n", /* IP_OUT_OF_RANGE*/
|
||||
"Definition not found for condition code usage at opcode %d\n",
|
||||
/* DEF_NOT_FOUND */
|
||||
/* DEF_NOT_FOUND */
|
||||
"JX use, definition not supported at opcode #%d\n", /* JX_NOT_DEF */
|
||||
"Def - use not supported. Def op = %d, use op = %d.\n", /* NOT_DEF_USE */
|
||||
"Failed to construct repeat..until() condition.\n", /* REPEAT_FAIL */
|
||||
|
||||
@ -67,7 +67,6 @@ CondJumps:
|
||||
/* This is for jumps off into nowhere */
|
||||
if (pIcode->ic.ll.flg & NO_LABEL)
|
||||
{
|
||||
pBB->numOutEdges--;
|
||||
pBB->edges.pop_back();
|
||||
}
|
||||
else
|
||||
@ -138,7 +137,7 @@ CondJumps:
|
||||
for (; iter!=heldBBs.end(); ++iter)
|
||||
{
|
||||
pBB = *iter;
|
||||
for (i = 0; i < pBB->numOutEdges; i++)
|
||||
for (i = 0; i < pBB->edges.size(); i++)
|
||||
{
|
||||
ip = pBB->edges[i].ip;
|
||||
if (ip >= SYNTHESIZED_MIN)
|
||||
@ -210,12 +209,12 @@ void Function::compressCFG()
|
||||
pBB = *iter;
|
||||
if(pBB->inEdges.empty() || (pBB->nodeType != ONE_BRANCH && pBB->nodeType != TWO_BRANCH))
|
||||
continue;
|
||||
for (i = 0; i < pBB->numOutEdges; i++)
|
||||
for (i = 0; i < pBB->edges.size(); i++)
|
||||
{
|
||||
ip = pBB->rbegin();
|
||||
pNxt = rmJMP(this, ip, pBB->edges[i].BBptr);
|
||||
|
||||
if (pBB->numOutEdges) /* Might have been clobbered */
|
||||
if (not pBB->edges.empty()) /* Might have been clobbered */
|
||||
{
|
||||
pBB->edges[i].BBptr = pNxt;
|
||||
Icode.SetImmediateOp(ip, (dword)pNxt->begin());
|
||||
@ -241,8 +240,7 @@ void Function::compressCFG()
|
||||
pBB->index = UN_INIT;
|
||||
else
|
||||
{
|
||||
if (pBB->numOutEdges)
|
||||
pBB->edges.clear();
|
||||
pBB->edges.clear();
|
||||
delete pBB;
|
||||
stats.numBBaft--;
|
||||
}
|
||||
@ -305,7 +303,6 @@ static BB * rmJMP(Function * pProc, Int marker, BB * pBB)
|
||||
} while (pBB->nodeType != NOWHERE_NODE);
|
||||
|
||||
pBB->edges.clear();
|
||||
pBB->numOutEdges = 0;
|
||||
}
|
||||
}
|
||||
return pBB;
|
||||
@ -350,14 +347,13 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
|
||||
numOutEdges = pChild->numOutEdges;
|
||||
edges.swap(pChild->edges);
|
||||
|
||||
pChild->numOutEdges = 0;
|
||||
pChild->inEdges.clear();
|
||||
pChild->edges.clear();
|
||||
}
|
||||
traversed = DFS_MERGE;
|
||||
|
||||
/* Process all out edges recursively */
|
||||
for (i = 0; i < numOutEdges; i++)
|
||||
for (i = 0; i < edges.size(); i++)
|
||||
if (edges[i].BBptr->traversed != DFS_MERGE)
|
||||
edges[i].BBptr->mergeFallThrough(Icode);
|
||||
}
|
||||
@ -376,7 +372,7 @@ void BB::dfsNumbering(std::vector<BB *> &dfsLast, Int *first, Int *last)
|
||||
dfsFirstNum = (*first)++;
|
||||
|
||||
/* index is being used as an index to inEdges[]. */
|
||||
for (i = 0; i < numOutEdges; i++)
|
||||
for (i = 0; i < edges.size(); i++)
|
||||
{
|
||||
pChild = edges[i].BBptr;
|
||||
pChild->inEdges[pChild->index++] = this;
|
||||
|
||||
@ -15,7 +15,7 @@ static word *T1, *T2; /* Pointers to T1[i], T2[i] */
|
||||
static short *g; /* g[] */
|
||||
|
||||
static int numEdges; /* An edge counter */
|
||||
static bool *visited; /* Array of bools: whether visited */
|
||||
//static bool *visited; /* Array of bools: whether visited */
|
||||
|
||||
/* Private prototypes */
|
||||
static void initGraph(void);
|
||||
@ -23,7 +23,7 @@ static void addToGraph(int e, int v1, int v2);
|
||||
static bool isCycle(void);
|
||||
static void duplicateKeys(int v1, int v2);
|
||||
PatternHasher g_pattern_hasher;
|
||||
|
||||
|
||||
void
|
||||
PatternHasher::init(int _NumEntry, int _EntryLen, int _SetSize, char _SetMin,
|
||||
int _NumVert)
|
||||
@ -39,36 +39,13 @@ PatternHasher::init(int _NumEntry, int _EntryLen, int _SetSize, char _SetMin,
|
||||
NumVert = _NumVert;
|
||||
|
||||
/* Allocate the variable sized tables etc */
|
||||
if ((T1base = (word *)malloc(EntryLen * SetSize * sizeof(word))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
if ((T2base = (word *)malloc(EntryLen * SetSize * sizeof(word))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
|
||||
if ((graphNode = (int *)malloc((NumEntry*2 + 1) * sizeof(int))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
if ((graphNext = (int *)malloc((NumEntry*2 + 1) * sizeof(int))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
if ((graphFirst = (int *)malloc((NumVert + 1) * sizeof(int))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
|
||||
if ((g = (short *)malloc((NumVert+1) * sizeof(short))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
if ((visited = (bool *)malloc((NumVert+1) * sizeof(bool))) == 0)
|
||||
{
|
||||
goto BadAlloc;
|
||||
}
|
||||
T1base = new word [EntryLen * SetSize];
|
||||
T2base = new word [EntryLen * SetSize];
|
||||
graphNode = new int [NumEntry*2 + 1];
|
||||
graphNext = new int [NumEntry*2 + 1];
|
||||
graphFirst = new int [NumVert + 1];
|
||||
g = new short [NumVert + 1];
|
||||
// visited = new bool [NumVert + 1];
|
||||
return;
|
||||
|
||||
BadAlloc:
|
||||
@ -80,12 +57,13 @@ BadAlloc:
|
||||
void PatternHasher::cleanup(void)
|
||||
{
|
||||
/* Free the storage for variable sized tables etc */
|
||||
if (T1base) free(T1base);
|
||||
if (T2base) free(T2base);
|
||||
if (graphNode) free(graphNode);
|
||||
if (graphNext) free(graphNext);
|
||||
if (graphFirst) free(graphFirst);
|
||||
if (g) free(g);
|
||||
delete [] T1base;
|
||||
delete [] T2base;
|
||||
delete [] graphNode;
|
||||
delete [] graphNext;
|
||||
delete [] graphFirst;
|
||||
delete [] g;
|
||||
// delete [] visited;
|
||||
}
|
||||
|
||||
int PatternHasher::hash(byte *string)
|
||||
|
||||
@ -128,7 +128,7 @@ void derSeq_Entry::findIntervals (Function *c)
|
||||
while ((h = pI->firstOfInt()) != NULL)
|
||||
{
|
||||
/* Check all immediate successors of h */
|
||||
for (i = 0; i < h->numOutEdges; i++)
|
||||
for (i = 0; i < h->edges.size(); i++)
|
||||
{
|
||||
succ = h->edges[i].BBptr;
|
||||
succ->inEdgeCount--;
|
||||
@ -273,12 +273,12 @@ bool Function::nextOrderGraph (derSeq *derivedGi)
|
||||
|
||||
/* Find out edges */
|
||||
|
||||
if (BBnode->numOutEdges > 0)
|
||||
if (BBnode->edges.size() > 0)
|
||||
{
|
||||
for(auto iter=listIi.begin();iter!=listIi.end(); ++iter)
|
||||
{
|
||||
curr = *iter;
|
||||
for (j = 0; j < curr->numOutEdges; j++)
|
||||
for (j = 0; j < curr->edges.size(); j++)
|
||||
{
|
||||
succ = curr->edges[j].BBptr;
|
||||
if (succ->inInterval != curr->inInterval)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user