This commit is contained in:
Artur K
2011-12-12 21:50:30 +01:00
parent 900438c453
commit cd040363e6
15 changed files with 125 additions and 1698 deletions

View File

@@ -112,6 +112,11 @@ public:
void controlFlowAnalysis();
void newRegArg(ICODE *picode, ICODE *ticode);
protected:
// TODO: replace those with friend visitor ?
void propLongReg(Int i, ID *pLocId);
void propLongStk(Int i, ID *pLocId);
void propLongGlb(Int i, ID *pLocId);
void structCases();
void findExps();
void genDU1();

View File

@@ -11,23 +11,32 @@
#define word unsigned short
/* Prototypes */
void hashParams(int NumEntry, int EntryLen, int SetSize, char SetMin,
int NumVert); /* Set the parameters for the hash table */
void hashCleanup(void); /* Frees memory allocated by hashParams() */
void map(void); /* Part 1 of creating the tables */
void assign(void); /* Part 2 of creating the tables */
int hash(byte *s); /* Hash the string to an int 0 .. NUMENTRY-1 */
word *readT1(void); /* Returns a pointer to the T1 table */
word *readT2(void); /* Returns a pointer to the T2 table */
word *readG(void); /* Returns a pointer to the g table */
/* The application must provide these functions: */
void getKey(int i, byte **pKeys);/* Set *keys to point to the i+1th key */
void dispKey(int i); /* Display the key */
class PatternHasher
{
word *T1base, *T2base; /* Pointers to start of T1, T2 */
int NumEntry; /* Number of entries in the hash table (# keys) */
int EntryLen; /* Size (bytes) of each entry (size of keys) */
int SetSize; /* Size of the char set */
char SetMin; /* First char in the set */
int NumVert; /* c times NumEntry */
int *graphNode; /* The array of edges */
int *graphNext; /* Linked list of edges */
int *graphFirst;/* First edge at a vertex */
public:
word *readT1(void); /* Returns a pointer to the T1 table */
word *readT2(void); /* Returns a pointer to the T2 table */
word *readG(void); /* Returns a pointer to the g table */
void init(int _NumEntry, int _EntryLen, int _SetSize, char _SetMin,int _NumVert); /* Set the parameters for the hash table */
void cleanup();
int hash(unsigned char *string); //!< Hash the string to an int 0 .. NUMENTRY-1
};
extern PatternHasher g_pattern_hasher;
/* Macro reads a LH word from the image regardless of host convention */
#ifndef LH
#define LH(p) ((int)((byte *)(p))[0] + ((int)((byte *)(p))[1] << 8))

View File

@@ -36,15 +36,6 @@ enum tableType /* The table types */
void createSymTables(void);
void destroySymTables(void);
void enterSym(char *symName, dword symOff, Function *symProc, boolT bSymToo);
boolT readSym (char *symName, dword *pSymOff, Function **pSymProc);
boolT readVal (char *symName, dword symOff, Function *symProc);
void deleteSym(char *symName);
void deleteVal(dword symOff, Function * symProc, boolT bSymToo);
std::string findVal(dword symOff, Function * symProc, word *pIndex);
word symHash(char *name, word *pre);
word valHash(dword off, Function * proc, word *pre);
void selectTable(tableType); /* Select a particular table */
char *addStrTbl(char *pStr); /* Add string to string table */