removed ip dword from findIdioms, it's using iterators now, also switched to using iterators in IDX_ARRAY

This commit is contained in:
Artur K
2012-02-25 22:38:22 +01:00
parent 95ec23eceb
commit 9a6788fd2d
23 changed files with 428 additions and 433 deletions

View File

@@ -57,7 +57,7 @@ private:
public:
dword procEntry; /* label number */
char name[SYMLEN]; /* Meaningful name for this proc */
std::string name; /* Meaningful name for this proc */
STATE state; /* Entry state */
Int depth; /* Depth at which we found it - for printing */
flags32 flg; /* Combination of Icode & Proc flags */
@@ -84,13 +84,12 @@ public:
Function(void *ty=0) : procEntry(0),depth(0),flg(0),cbParam(0),cfg(0),dfsLast(0),numBBs(0),
hasCase(false),liveIn(0),liveOut(0),liveAnal(0)//,next(0),prev(0)
{
memset(name,0,SYMLEN);
}
public:
static Function *Create(void *ty=0,int Linkage=0,const std::string &nm="",void *module=0)
{
Function *r=new Function(ty);
strncpy(r->name,nm.c_str(),SYMLEN);
r->name = nm;
return r;
}
void compoundCond();

View File

@@ -60,10 +60,10 @@ public:
static COND_EXPR *idOther(byte seg, byte regi, int16 off);
static COND_EXPR *idParam(Int off, const STKFRAME *argSymtab);
static COND_EXPR *unary(condNodeType t, COND_EXPR *sub_expr);
static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, Int ix, operDu du, Int off);
static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, Int off);
static COND_EXPR *idFunc(Function *pproc, STKFRAME *args);
static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, Int ix);
static COND_EXPR *id(const ICODE &pIcode, opLoc sd, Function *pProc, Int i, ICODE &duIcode, operDu du);
static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, iICODE ix_);
static COND_EXPR *id(const ICODE &pIcode, opLoc sd, Function *pProc, iICODE ix_, ICODE &duIcode, operDu du);
static COND_EXPR *boolOp(COND_EXPR *lhs, COND_EXPR *rhs, condOp op);
public:
COND_EXPR *clone();

View File

@@ -4,6 +4,8 @@
****************************************************************************/
#pragma once
#include <llvm/ADT/ilist.h>
#include <bitset>
#include "types.h"
#include "ast.h"
#include "icode.h"
@@ -123,6 +125,8 @@ struct PROG /* Loaded program image parameters */
extern PROG prog; /* Loaded program image parameters */
extern dword duReg[30]; /* def/use bits for registers */
//extern dword duReg[30]; /* def/use bits for registers */
extern dword maskDuReg[30]; /* masks off du bits for regs */
/* Registers used by icode instructions */

View File

@@ -10,9 +10,9 @@
#include <algorithm>
#include "icode.h"
/* Type definition */
struct IDX_ARRAY : public std::vector<int>
struct IDX_ARRAY : public std::vector<iICODE>
{
bool inList(int idx)
bool inList(iICODE idx)
{
return std::find(begin(),end(),idx)!=end();
}
@@ -70,6 +70,7 @@ struct ID
{
hlType type; /* Probable type */
boolT illegal; /* Boolean: not a valid field any more */
//std::vector<iICODE> idx;
IDX_ARRAY idx; /* Index into icode array (REG_FRAME only) */
frameType loc; /* Frame location */
boolT hasMacro; /* Identifier requires a macro */
@@ -118,15 +119,15 @@ public:
Int newByteWordReg(hlType t, byte regi);
Int newByteWordStk(hlType t, Int off, byte regOff);
Int newIntIdx(int16 seg, int16 off, byte regi, Int ix, hlType t);
Int newLongReg(hlType t, byte regH, byte regL, Int ix);
Int newLong(opLoc sd, ICODE *pIcode, hlFirst f, Int ix, operDu du, Int off);
Int newLongReg(hlType t, byte regH, byte regL, iICODE ix_);
Int newLong(opLoc sd, ICODE *pIcode, hlFirst f, iICODE ix, operDu du, Int off);
void newIdent(hlType t, frameType f);
void flagByteWordId(Int off);
void propLongId(byte regL, byte regH, const char *name);
size_t csym() const {return id_arr.size();}
protected:
Int newLongIdx(int16 seg, int16 offH, int16 offL, byte regi, Int ix, hlType t);
Int newLongGlb(int16 seg, int16 offH, int16 offL, Int ix, hlType t);
Int newLongIdx(int16 seg, int16 offH, int16 offL, byte regi, hlType t);
Int newLongGlb(int16 seg, int16 offH, int16 offL, hlType t);
Int newLongStk(hlType t, Int offH, Int offL);
};

View File

@@ -2,9 +2,10 @@
* dcc project header
* (C) Cristina Cifuentes, Mike van Emmerik
****************************************************************************/
/* STATE TABLE */
#pragma once
#include <cstring>
#include "types.h"
/* STATE TABLE */
struct STATE
{
dword IP; /* Offset into Image */
@@ -16,7 +17,6 @@ struct STATE
int16 immed; /* Contents of the previous register */
} JCond;
void setState(word reg, int16 value);
public:
void checkStartup();
STATE() : IP(0)
{