-typedef struct operand {
- unsigned int type: 6 ; /* type of operand */
- unsigned int isaddr : 1; /* is an address */
- unsigned int isvolatile: 1; /* is a volatile operand */
- unsigned int isGlobal :1 ; /* is a global operand */
- unsigned int isPtr :1 ; /* is assigned a pointer */
- 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 ;
- int parmBytes;
- union {
- struct symbol *symOperand ; /* operand is of type symbol */
- struct value *valOperand ; /* operand is of type value */
- struct link *typeOperand; /* operand is of type typechain */
- } operand ;
-
- bitVect *usesDefs; /* which definitions are used by this */
- struct asmop *aop ; /* asm op for this operand */
-} operand ;
-
-/* definition for intermediate code */
-#define IC_RESULT(x) x->ulrrcnd.lrr.result
-#define IC_LEFT(x) x->ulrrcnd.lrr.left
-#define IC_RIGHT(x) x->ulrrcnd.lrr.right
-#define IC_COND(x) x->ulrrcnd.cnd.condition
-#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
-#define IC_JTCOND(x) x->ulrrcnd.jmpTab.condition
-#define IC_JTLABELS(x) x->ulrrcnd.jmpTab.labels
-#define IC_INLINE(x) x->inlineAsm
-
-typedef struct iCode
-{
- unsigned int op ; /* operation defined */
- int key ; /* running key for this iCode */
- int seq ; /* sequence number within routine */
- short depth ; /* loop depth of this iCode */
- short level ; /* scope level */
- short block ; /* sequential block number */
- unsigned nosupdate:1; /* don't update spillocation with this */
- unsigned generated:1; /* code generated for this one */
- unsigned parmPush :1; /* parameter push Vs spill push */
- 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 */
-
- struct iCode *next ; /* next in chain */
- struct iCode *prev ; /* previous in chain */
- set *movedFrom; /* if this iCode gets moved to another block */
- bitVect *rlive ; /* ranges that are live at this point */
- int defKey ; /* key for the operand being defined */
- bitVect *uses ; /* vector of key of used symbols */
- bitVect *rUsed ; /* registers used by this instruction */
- bitVect *rMask ; /* registers in use during this instruction */
- union {
- struct {
- operand *left ; /* left if any */
- operand *right ; /* right if any */
- operand *result ; /* result of this op */
- } lrr ;
-
- struct {
- operand *condition ; /* if this is a conditional */
- symbol *trueLabel ; /* true for conditional */
- symbol *falseLabel; /* false for conditional */
- } cnd;
-
- struct {
- operand *condition ; /* condition for the jump */
- set *labels ; /* ordered set of labels */
- } jmpTab ;
-
- } ulrrcnd;
-
- union {
- symbol *label ; /* for a goto statement */
- value *args ;
- } argLabel ;
-
- char *inlineAsm ; /* pointer to inline assembler code */
-
- int lineno ; /* file & lineno for debug information */
- char *filename ;
-} iCode ;
+typedef struct operand
+ {
+ OPTYPE type; /* type of operand */
+ unsigned int isaddr:1; /* is an address */
+ 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 */
+ unsigned int isGptr:1; /* is a generic pointer */
+ unsigned int isParm:1; /* is a parameter */
+ unsigned int isLiteral:1; /* operand is literal */
+
+ int key;
+ union
+ {
+ struct symbol *symOperand; /* operand is of type symbol */
+ struct value *valOperand; /* operand is of type value */
+ struct sym_link *typeOperand; /* operand is of type typechain */
+ }
+ operand;
+
+ bitVect *usesDefs; /* which definitions are used by this */
+ struct asmop *aop; /* asm op for this operand */
+ }
+operand;
+
+extern operand *validateOpType(operand *op,
+ const char *macro,
+ const char *args,
+ OPTYPE type,
+ 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_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
+#define OP_LIVEFROM(op) validateOpType(op, "OP_LIVEFROM", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->liveFrom
+#define OP_LIVETO(op) validateOpType(op, "OP_LIVETO", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->liveTo
+#define OP_REQV(op) validateOpType(op, "OP_REQV", #op, SYMBOL, __FILE__, __LINE__)->operand.symOperand->reqv
+
+/* definition for intermediate code */
+#define IC_RESULT(x) (x)->ulrrcnd.lrr.result
+#define IC_LEFT(x) (x)->ulrrcnd.lrr.left
+#define IC_RIGHT(x) (x)->ulrrcnd.lrr.right
+#define IC_COND(x) (x)->ulrrcnd.cnd.condition
+#define IC_TRUE(x) (x)->ulrrcnd.cnd.trueLabel
+#define IC_FALSE(x) (x)->ulrrcnd.cnd.falseLabel
+#define IC_LABEL(x) (x)->label
+#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
+ {
+ unsigned int op; /* operation defined */
+ int key; /* running key for this iCode */
+ int seq; /* sequence number within routine */
+ int seqPoint; /* sequence point */
+ short depth; /* loop depth of this iCode */
+ short level; /* scope level */
+ short block; /* sequential block number */
+ unsigned nosupdate:1; /* don't update spillocation with this */
+ unsigned generated:1; /* code generated for this one */
+ unsigned parmPush:1; /* parameter push Vs spill push */
+ 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 */
+ set *movedFrom; /* if this iCode gets moved to another block */
+ bitVect *rlive; /* ranges that are live at this point */
+ int defKey; /* key for the operand being defined */
+ bitVect *uses; /* vector of key of used symbols */
+ bitVect *rUsed; /* registers used by this instruction */
+ bitVect *rMask; /* registers in use during this instruction */
+ union
+ {
+ struct
+ {
+ operand *left; /* left if any */
+ operand *right; /* right if any */
+ operand *result; /* result of this op */
+ }
+ lrr;
+
+ struct
+ {
+ operand *condition; /* if this is a conditional */
+ symbol *trueLabel; /* true for conditional */
+ symbol *falseLabel; /* false for conditional */
+ }
+ cnd;
+
+ struct
+ {
+ operand *condition; /* condition for the jump */
+ set *labels; /* ordered set of labels */
+ }
+ jmpTab;
+
+ }
+ ulrrcnd;
+
+ symbol *label; /* for a goto statement */
+
+ 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 */
+ char riu; /* after ralloc, the registers in use */
+ struct ast * tree; /* ast node for this iCode (if not NULL) */
+ }
+iCode;