X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCicode.h;h=d2c69a1f10ef2537ff3b1138dfeb8f7918bffa02;hb=26d3d7e98ba650e8474421c54097ee135108dd15;hp=2968911f04d037a4276af6add82262cb67c81862;hpb=6a370e6ab695babec796a8f30b7a03a6bc9dc77d;p=fw%2Fsdcc diff --git a/src/SDCCicode.h b/src/SDCCicode.h index 2968911f..d2c69a1f 100644 --- a/src/SDCCicode.h +++ b/src/SDCCicode.h @@ -61,7 +61,7 @@ OPTYPE; #define LRTYPE LRFTYPE LRETYPE #define IS_ITEMP(op) (IS_SYMOP(op) && op->operand.symOperand->isitmp == 1) #define IS_PARM(op) (IS_SYMOP(op) && op->operand.symOperand->_isparm) -#define IS_ITEMPLBL(op) (IS_ITEMP(op) && op->operand.symOperand->isilbl == 1); +#define IS_ITEMPLBL(op) (IS_ITEMP(op) && op->operand.symOperand->isilbl == 1) #define IS_OP_VOLATILE(op) (IS_SYMOP(op) && op->isvolatile) #define IS_OP_LITERAL(op) (op && op->isLiteral) #define IS_OP_GLOBAL(op) (IS_SYMOP(op) && op->isGlobal) @@ -75,7 +75,8 @@ typedef struct operand { OPTYPE type; /* type of operand */ unsigned int isaddr:1; /* is an address */ - unsigned int aggr2ptr:1; /* must change aggregate to pointer to aggregate */ + unsigned int aggr2ptr:2; /* 1: must change aggregate to pointer to aggregate */ + /* 2: aggregate has been changed to pointer to aggregate */ unsigned int isvolatile:1; /* is a volatile operand */ unsigned int isGlobal:1; /* is a global operand */ unsigned int isPtr:1; /* is assigned a pointer */ @@ -104,8 +105,8 @@ extern operand *validateOpType(operand *op, const char *file, unsigned line); -#define OP_SYMBOL(op) validateOpType(op, "OP_SYMBOL", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand -#define OP_VALUE(op) validateOpType(op, "OP_VALUE", #op, VALUE, __FILE__, __LINE__)->operand.valOperand +#define OP_SYMBOL(op) validateOpType(op, "OP_SYMBOL", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand +#define OP_VALUE(op) validateOpType(op, "OP_VALUE", #op, VALUE, __FILE__, __LINE__)->operand.valOperand #define OP_SYM_TYPE(op) validateOpType(op, "OP_SYM_TYPE", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->type #define OP_SYM_ETYPE(op) validateOpType(op, "OP_SYM_ETYPE", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->etype #define SPIL_LOC(op) validateOpType(op, "SPIL_LOC", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->usl.spillLoc @@ -201,7 +202,7 @@ typedef struct icodeFuncTable { int icode; char *printName; - void (*iCodePrint) (FILE *, iCode *, char *); + void (*iCodePrint) (struct dbuf_s *, iCode *, char *); iCode *(*iCodeCopy) (iCode *); } iCodeTable; @@ -211,9 +212,7 @@ iCodeTable; x->op == LABEL || \ x->op == FUNCTION || \ x->op == INLINEASM || \ - x->op == ENDFUNCTION || \ - x->op == CRITICAL || \ - x->op == ENDCRITICAL ) + x->op == ENDFUNCTION ) #define SKIP_IC1(x) (x->op == CALL || \ SKIP_IC2(x) ) @@ -225,6 +224,8 @@ iCodeTable; x->op == RECEIVE || \ x->op == ARRAYINIT || \ SKIP_IC1(x) || \ + x->op == CRITICAL || \ + x->op == ENDCRITICAL || \ x->op == SEND ) #define SKIP_IC3(x) (SKIP_IC2(x) || \ @@ -240,12 +241,12 @@ iCodeTable; #define IS_TRUE_SYMOP(op) (op && IS_SYMOP(op) && !IS_ITEMP(op)) #define POINTER_SET(ic) ( ic && ic->op == '=' \ - && IS_ITEMP(IC_RESULT(ic)) \ + && (IS_ITEMP(IC_RESULT(ic)) || IS_OP_LITERAL(IC_RESULT(ic)))\ && IC_RESULT(ic)->isaddr ) #define POINTER_GET(ic) ( ic && ic->op == GET_VALUE_AT_ADDRESS \ - && (IS_ITEMP(IC_LEFT(ic)) || IS_OP_LITERAL(IC_LEFT(ic)))\ - && IC_LEFT(ic)->isaddr ) + && (IS_ITEMP(IC_LEFT(ic)) || IS_OP_LITERAL(IC_LEFT(ic)))\ + && IC_LEFT(ic)->isaddr ) #define IS_ARITHMETIC_OP(x) (x && (x->op == '+' || \ x->op == '-' || \ @@ -256,6 +257,14 @@ iCodeTable; x->op == '|' || \ x->op == '^')) +#define IS_ASSOCIATIVE(x) (x && (x->op == EQ_OP || \ + x->op == NE_OP || \ + x->op == '+' || \ + x->op == '*' || \ + x->op == BITWISEAND || \ + x->op == '|' || \ + x->op == '^')) + #define ASSIGNMENT(ic) ( ic && ic->op == '=') #define ASSIGN_SYM_TO_ITEMP(ic) (ic && ic->op == '=' && \ @@ -310,22 +319,27 @@ int isParameterToCall (value *, operand *); iCode *newiCodeLabelGoto (int, symbol *); symbol *newiTemp (char *); symbol *newiTempLabel (char *); -symbol *newiTempPreheaderLabel (); +#define LOOPEXITLBL "loopExitLbl" +symbol *newiTempLoopHeaderLabel (bool); iCode *newiCode (int, operand *, operand *); sym_link *operandType (operand *); +unsigned int operandSize (operand *); operand *operandFromValue (value *); operand *operandFromSymbol (symbol *); operand *operandFromLink (sym_link *); sym_link *aggrToPtr (sym_link *, bool); int aggrToPtrDclType (sym_link *, bool); int piCode (void *, FILE *); +int dbuf_printOperand (operand *, struct dbuf_s *); int printOperand (operand *, FILE *); void setOperandType (operand *, sym_link *); bool isOperandInFarSpace (operand *); +bool isOperandInPagedSpace (operand *); bool isOperandInDirSpace (operand *); bool isOperandInCodeSpace (operand *); operand *opFromOpWithDU (operand *, bitVect *, bitVect *); iCode *copyiCode (iCode *); +operand *newiTempOperand (sym_link *, char); operand *newiTempFromOp (operand *); iCode *getBuiltinParms (iCode *,int *, operand **); int isiCodeInFunctionCall (iCode *);