Extracted commonalities between SYM and STKSYM into SymbolCommon and

between SYMTAB and STKFRAME into SymbolTableCommon<STKSYM>
This commit is contained in:
Artur K
2012-03-13 01:22:13 +01:00
parent d3e62a99aa
commit 902a5ec3d8
15 changed files with 311 additions and 290 deletions

View File

@@ -3,39 +3,22 @@
#include <cstring>
#include "types.h"
#include "Enums.h"
struct COND_EXPR;
/* STACK FRAME */
struct STKSYM
{
COND_EXPR *actual; /* Expression tree of actual parameter */
COND_EXPR *regs; /* For register arguments only */
int16_t off; /* Immediate off from BP (+:args, -:params) */
uint8_t regOff; /* Offset is a register (e.g. SI, DI) */
int size; /* Size */
hlType type; /* Probable type */
eDuVal duVal; /* DEF, USE, VAL */
boolT hasMacro; /* This type needs a macro */
char macro[10]; /* Macro name */
char name[10]; /* Name for this symbol/argument */
bool invalid; /* Boolean: invalid entry in formal arg list*/
STKSYM()
{
memset(this,0,sizeof(STKSYM));
}
};
#include "symtab.h"
struct STKFRAME
struct STKFRAME : public SymbolTableCommon<STKSYM>
{
std::vector<STKSYM> sym;
//std::vector<STKSYM> sym;
//STKSYM * sym; /* Symbols */
int16_t m_minOff; /* Initial offset in stack frame*/
int16_t maxOff; /* Maximum offset in stack frame*/
int cb; /* Number of bytes in arguments */
int numArgs; /* No. of arguments in the table*/
void adjustForArgType(int numArg_, hlType actType_);
STKFRAME() : sym(0),m_minOff(0),maxOff(0),cb(0),numArgs(0)
STKFRAME() : m_minOff(0),maxOff(0),cb(0),numArgs(0)
{
}
size_t getLocVar(int off);
public:
void updateFrameOff(int16_t off, int size, uint16_t duFlag);
};