X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCicode.h;h=1c77db9203ad08604dcdeea4fd3773771b818cca;hb=7b0cd93b7bd04b332f409c2ece675f3943bbd70a;hp=a6f656a67606500c01a8aed4b5bf8d6fd5805852;hpb=54f886ab573f40c4356bbc4dc97c4196da96871b;p=fw%2Fsdcc diff --git a/src/SDCCicode.h b/src/SDCCicode.h index a6f656a6..1c77db92 100644 --- a/src/SDCCicode.h +++ b/src/SDCCicode.h @@ -49,6 +49,9 @@ typedef enum OPTYPE; #define IS_SYMOP(op) (op && op->type == SYMBOL) +#define IS_VALOP(op) (op && op->type == VALUE) +#define IS_TYPOP(op) (op && op->type == TYPE) + #define ADDTOCHAIN(x) addSetHead(&iCodeChain,x) #define LRFTYPE sym_link *ltype = operandType(left), \ @@ -67,11 +70,13 @@ OPTYPE; #define OP_SYMBOL(op) op->operand.symOperand #define OP_SYM_TYPE(op) op->operand.symOperand->type #define OP_SYM_ETYPE(op) op->operand.symOperand->etype +#define OP_VALUE(op) op->operand.valOperand #define SPIL_LOC(op) op->operand.symOperand->usl.spillLoc #define OP_LIVEFROM(op) op->operand.symOperand->liveFrom #define OP_LIVETO(op) op->operand.symOperand->liveTo #define OP_REQV(op) op->operand.symOperand->reqv #define OP_ISLIVE_FCALL(op) (IS_ITEMP(op) && OP_SYMBOL(op)->isLiveFcall) +#define SYM_SPIL_LOC(sym) sym->usl.spillLoc /* typedef for operand */ typedef struct operand @@ -84,7 +89,6 @@ typedef struct operand unsigned int isGptr:1; /* is a generic pointer */ unsigned int isParm:1; /* is a parameter */ unsigned int isLiteral:1; /* operand is literal */ - unsigned int noSpilLoc:1; /* cannot be assigned a spil location */ unsigned key; union @@ -108,10 +112,11 @@ operand; #define IC_TRUE(x) (x)->ulrrcnd.cnd.trueLabel #define IC_FALSE(x) (x)->ulrrcnd.cnd.falseLabel #define IC_LABEL(x) (x)->argLabel.label -#define IC_ARGS(x) (x)->argLabel.args +// jwk #define IC_ARGS(x) (x)->argLabel.args #define IC_JTCOND(x) (x)->ulrrcnd.jmpTab.condition #define IC_JTLABELS(x) (x)->ulrrcnd.jmpTab.labels #define IC_INLINE(x) (x)->inlineAsm +#define IC_ARRAYILIST(x) (x)->arrayInitList typedef struct iCode { @@ -127,6 +132,7 @@ typedef struct iCode unsigned supportRtn:1; /* will cause a call to a support routine */ unsigned regsSaved:1; /* registers have been saved */ unsigned bankSaved:1; /* register bank has been saved */ + unsigned builtinSEND:1; /* SEND for parameter of builtin function */ struct iCode *next; /* next in chain */ struct iCode *prev; /* previous in chain */ @@ -167,17 +173,20 @@ typedef struct iCode union { symbol *label; /* for a goto statement */ - value *args; + // jwk value *args; /* for a function */ } argLabel; char *inlineAsm; /* pointer to inline assembler code */ + literalList *arrayInitList; /* point to array initializer list. */ int lineno; /* file & lineno for debug information */ char *filename; int parmBytes; /* if call/pcall, count of parameter bytes on stack */ + int argreg; /* argument regno for SEND/RECEIVE */ + int eBBlockNum; /* belongs to which eBBlock */ } iCode; @@ -206,9 +215,13 @@ iCodeTable; x->op == IPOP || \ x->op == JUMPTABLE || \ x->op == RECEIVE || \ + x->op == ARRAYINIT || \ SKIP_IC1(x)|| \ x->op == SEND ) +#define SKIP_IC3(x) (SKIP_IC2(x) || \ + x->op == JUMPTABLE ) + #define IS_CONDITIONAL(x) (x->op == EQ_OP || \ x->op == '<' || \ x->op == '>' || \ @@ -258,11 +271,20 @@ iCodeTable; #define ASSIGNMENT_TO_SELF(ic) (!POINTER_SET(ic) && !POINTER_GET(ic) && \ ic->op == '=' && IC_RESULT(ic)->key == IC_RIGHT(ic)->key ) +#define IS_CAST_ICODE(ic) (ic && ic->op == CAST) #define SET_ISADDR(op,v) {op = operandFromOperand(op); op->isaddr = v;} #define SET_RESULT_RIGHT(ic) {SET_ISADDR(IC_RIGHT(ic),0); SET_ISADDR(IC_RESULT(ic),0);} - -#define OP_DEFS(op) op->operand.symOperand->defs -#define OP_USES(op) op->operand.symOperand->uses +#define IS_ASSIGN_ICODE(ic) (ASSIGNMENT(ic) && !POINTER_SET(ic)) + +#if 0 // this causes too much, extremely difficult to find, bugs + #define OP_DEFS(op) op->operand.symOperand->defs + #define OP_USES(op) op->operand.symOperand->uses +#else + struct bitVect *OP_DEFS(struct operand *); + struct bitVect *OP_DEFS_SET(struct operand *, struct bitVect *); + struct bitVect *OP_USES(struct operand *); + struct bitVect *OP_USES_SET(struct operand *, struct bitVect *); +#endif /*-----------------------------------------------------------------*/ /* forward references for functions */ /*-----------------------------------------------------------------*/ @@ -271,7 +293,7 @@ bool isOperandOnStack (operand *); int isOperandVolatile (operand *, bool); int isOperandGlobal (operand *); void printiCChain (iCode *, FILE *); -operand *ast2iCode (ast *); +operand *ast2iCode (ast *,int); operand *geniCodeCast (sym_link *, operand *, bool); operand *geniCodePtrPtrSubtract (operand *, operand *); void initiCode (); @@ -282,7 +304,7 @@ iCodeTable *getTableEntry (int); int isOperandLiteral (operand *); operand *operandOperation (operand *, operand *, int, sym_link *); double operandLitValue (operand *); -operand *operandFromLit (float); +operand *operandFromLit (double); operand *operandFromOperand (operand *); int isParameterToCall (value *, operand *); iCode *newiCodeLabelGoto (int, symbol *); @@ -298,9 +320,12 @@ int piCode (void *, FILE *); int printOperand (operand *, FILE *); void setOperandType (operand *, sym_link *); bool isOperandInFarSpace (operand *); +bool isOperandInDirSpace (operand *); +bool isOperandInCodeSpace (operand *); operand *opFromOpWithDU (operand *, bitVect *, bitVect *); iCode *copyiCode (iCode *); operand *newiTempFromOp (operand *); +iCode *getBuiltinParms (iCode *,int *, operand **); /*-----------------------------------------------------------------*/ /* declaration of exported variables */ /*-----------------------------------------------------------------*/