CIcodeRec is no longer an Array, it's now a list, will help with iterator stability

This commit is contained in:
Artur K
2012-02-28 03:06:34 +01:00
parent f131b7e619
commit 3cb26d99d2
26 changed files with 426 additions and 770 deletions

View File

@@ -108,7 +108,7 @@ static BB * Create(Int start, Int ip, byte nodeType, Int numOutEdges, Function *
///
const Function *getParent() const { return Parent; }
Function *getParent() { return Parent; }
void writeBB(ICODE *hli, Int lev, Function *pProc, Int *numLoc);
void writeBB(Int lev, Function *pProc, Int *numLoc);
BB *rmJMP(Int marker, BB *pBB);
private:
Function *Parent;

View File

@@ -1,39 +0,0 @@
#pragma once
#include "idiom.h"
#include "icode.h"
#include <deque>
struct EpilogIdiom : public Idiom
{
protected:
std::deque<iICODE> m_icodes; // deque to push_front optional icodes from popStkVars
void popStkVars (iICODE pIcode);
public:
virtual ~EpilogIdiom() {}
EpilogIdiom(Function *f) : Idiom(f)
{
}
};
struct Idiom2 : public EpilogIdiom
{
virtual ~Idiom2() {}
Idiom2(Function *f) : EpilogIdiom(f)
{
}
uint8_t minimum_match_length() {return 3;}
bool match(iICODE pIcode);
int action();
};
struct Idiom4 : public EpilogIdiom
{
protected:
int m_param_count;
public:
virtual ~Idiom4() {}
Idiom4(Function *f) : EpilogIdiom(f)
{
}
uint8_t minimum_match_length() {return 1;}
bool match(iICODE pIcode);
int action();
};

View File

@@ -4,6 +4,7 @@
****************************************************************************/
#pragma once
#include <vector>
#include <list>
#include <bitset>
#include <llvm/MC/MCInst.h>
#include <llvm/MC/MCAsmInfo.h>
@@ -276,8 +277,8 @@ struct HLTYPE
struct { /* for HLI_CALL */
Function *proc;
STKFRAME *args; /* actual arguments */
} call;
} oper; /* operand */
} call;
} oper; /* operand */
} ;
/* LOW_LEVEL icode operand record */
struct LLOperand //: public llvm::MCOperand
@@ -344,9 +345,9 @@ struct ICODE
{
struct DU1
{
Int numRegsDef; /* # registers defined by this inst */
Int numRegsDef; /* # registers defined by this inst */
byte regi[MAX_REGS_DEF]; /* registers defined by this inst */
Int idx[MAX_REGS_DEF][MAX_USES]; /* inst that uses this def */
Int idx[MAX_REGS_DEF][MAX_USES]; /* inst that uses this def */
};
icodeType type; /* Icode type */
bool invalid; /* Has no HIGH_LEVEL equivalent */
@@ -387,7 +388,7 @@ public:
};
// This is the icode array object.
class CIcodeRec : public std::vector<ICODE>
class CIcodeRec : public std::list<ICODE>
{
public:
CIcodeRec(); // Constructor

View File

@@ -1,15 +0,0 @@
#pragma once
#include "icode.h"
#include "Procedure.h"
struct Idiom
{
protected:
Function *m_func;
iICODE m_end;
public:
Idiom(Function *f) : m_func(f),m_end(f->Icode.end())
{
}
virtual uint8_t minimum_match_length()=0;
virtual bool match(iICODE at)=0;
};

View File

@@ -1,16 +0,0 @@
#pragma once
#include "idiom.h"
struct Idiom1 : public Idiom
{
protected:
std::vector<iICODE> m_icodes;
int m_min_off;
Int checkStkVars (iICODE pIcode);
public:
Idiom1(Function *f) : Idiom(f)
{
}
uint8_t minimum_match_length() {return 1;}
bool match(iICODE picode);
int action();
};

View File

@@ -99,14 +99,13 @@ struct ID
dword l; /* low word */
} longKte;
} id;
ID()
ID() : type(TYPE_UNKNOWN),illegal(false),loc(STK_FRAME),hasMacro(false)
{
memset(this,0,sizeof(ID));
memset(&id,0,sizeof(id));
}
ID(hlType t, frameType f)
ID(hlType t, frameType f) : type(t),illegal(false),hasMacro(false)
{
memset(this,0,sizeof(ID));
type=t;
memset(&id,0,sizeof(id));
loc=f;
}
bool isSigned() const { return (type==TYPE_BYTE_SIGN)||(type==TYPE_WORD_SIGN)||(type==TYPE_LONG_SIGN);}
@@ -133,7 +132,7 @@ public:
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, iICODE ix_);
Int newLong(opLoc sd, ICODE *pIcode, hlFirst f, iICODE ix, operDu du, Int off);
Int newLong(opLoc sd, iICODE 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);