Browse Source

Started separation between Low level and higher level instructions

Artur K 12 years ago
parent
commit
6b7d3f6209

+ 3 - 0
base_regression.sh

@@ -1,3 +1,6 @@
 #!/bin/bash
+cd bld
+make -j5
+cd ..
 ./test_use_base.sh
 ./regression_tester.rb ./bld/dcc_original -s -c 2>stderr >stdout; diff tests/prev/ tests/outputs/

+ 36 - 19
include/icode.h

@@ -45,7 +45,7 @@ struct DU
 
 /* Definition-use chain for level 1 (within a basic block) */
 #define MAX_REGS_DEF	2		/* 2 regs def'd for long-reg vars */
-#define MAX_USES		5
+//#define MAX_USES		5
 
 
 struct COND_EXPR;
@@ -162,11 +162,14 @@ struct LLOperand //: public llvm::MCOperand
     void SetImmediateOp(uint32_t dw) {opz=dw;}
 
 };
-struct LLInst : public llvm::MCInst
+struct LLInst : public llvm::ilist_node<LLInst>
 {
+protected:
+    uint32_t     flg;            /* icode flags                  */
+public:
+    int          codeIdx;    	/* Index into cCode.code            */
     llIcode      opcode;         /* llIcode instruction          */
     uint8_t      numBytes;       /* Number of bytes this instr   */
-    uint32_t     flg;            /* icode flags                  */
     uint32_t     label;          /* offset in image (20-bit adr) */
     LLOperand    dst;            /* destination operand          */
     LLOperand    src;            /* source operand               */
@@ -181,7 +184,18 @@ struct LLInst : public llvm::MCInst
     {
         return (opcode >= iJB) && (opcode < iJCXZ);
     }
-    bool anyFlagSet(uint32_t x) const { return (flg & x)!=0;}
+    bool isLlFlag(uint32_t x) const { return (flg & x)!=0;}
+    void  SetLlFlag(uint32_t flag) {flg |= flag;}
+    void  ClrLlFlag(uint32_t flag) {flg &= ~flag;}
+
+    uint32_t GetLlFlag() const {return flg;}
+    llIcode GetLlOpcode() const { return opcode; }
+
+    uint32_t  GetLlLabel() const { return label;}
+
+    void SetImmediateOp(uint32_t dw) {src.SetImmediateOp(dw);}
+
+
     bool match(llIcode op)
     {
         return (opcode==op);
@@ -190,6 +204,10 @@ struct LLInst : public llvm::MCInst
     {
         return (opcode==op)&&dst.regi==dest;
     }
+    bool match(llIcode op,eReg dest,uint32_t flgs)
+    {
+        return (opcode==op) and (dst.regi==dest) and isLlFlag(flgs);
+    }
     bool match(llIcode op,eReg dest,eReg src_reg)
     {
         return (opcode==op)&&(dst.regi==dest)&&(src.regi==src_reg);
@@ -202,16 +220,25 @@ struct LLInst : public llvm::MCInst
     {
         return (dst.regi==dest);
     }
+    bool match(llIcode op,uint32_t flgs)
+    {
+        return (opcode==op) and isLlFlag(flgs);
+    }
     void set(llIcode op,uint32_t flags)
     {
         opcode = op;
         flg =flags;
     }
+    void emitGotoLabel(int indLevel);
 };
 
 /* Icode definition: LOW_LEVEL and HIGH_LEVEL */
 struct ICODE
 {
+protected:
+    LLInst m_ll;
+    HLTYPE m_hl;
+public:
     /* Def/Use of registers and stack variables */
     struct DU_ICODE
     {
@@ -273,22 +300,12 @@ struct ICODE
     BB			*inBB;      	/* BB to which this icode belongs   */
     DU_ICODE		du;             /* Def/use regs/vars                */
     DU1			du1;        	/* du chain 1                       */
-    int			codeIdx;    	/* Index into cCode.code            */
-    struct IC {         /* Different types of icodes    */
-        LLInst ll;
-        HLTYPE hl;  	/* For HIGH_LEVEL icodes    */
-    };
-    IC ic;/* intermediate code        */
+    LLInst *            ll() { return &m_ll;}
+    const LLInst *      ll() const { return &m_ll;}
+    HLTYPE *            hl() { return &m_hl;}
+    const HLTYPE *      hl() const { return &m_hl;}
     int loc_ip; // used by CICodeRec to number ICODEs
 
-    void  ClrLlFlag(uint32_t flag) {ic.ll.flg &= ~flag;}
-    void  SetLlFlag(uint32_t flag) {ic.ll.flg |= flag;}
-    uint32_t GetLlFlag() {return ic.ll.flg;}
-    bool isLlFlag(uint32_t flg) {return (ic.ll.flg&flg)!=0;}
-    llIcode GetLlOpcode() const { return ic.ll.opcode; }
-    uint32_t  GetLlLabel() const { return ic.ll.label;}
-    void SetImmediateOp(uint32_t dw) {ic.ll.src.SetImmediateOp(dw);}
-
     void writeIntComment(std::ostringstream &s);
     void setRegDU(uint8_t regi, operDu du_in);
     void invalidate();
@@ -307,7 +324,7 @@ public:
     void checkHlCall();
     bool newStkArg(COND_EXPR *exp, llIcode opcode, Function *pproc)
     {
-        return ic.hl.call.newStkArg(exp,opcode,pproc);
+        return hl()->call.newStkArg(exp,opcode,pproc);
     }
 };
 

+ 15 - 16
src/BasicBlock.cpp

@@ -146,7 +146,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
                 picode = &this->back();
 
                 /* Check for error in while condition */
-                if (picode->ic.hl.opcode != HLI_JCOND)
+                if (picode->hl()->opcode != HLI_JCOND)
                     reportError (WHILE_FAIL);
 
                 /* Check if condition is more than 1 HL instruction */
@@ -161,13 +161,13 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
                  * the THEN path of the header node */
                 if (edges[ELSE].BBptr->dfsLastNum == loopFollow)
                 {
-                    COND_EXPR *old_expr=picode->ic.hl.expr();
+                    COND_EXPR *old_expr=picode->hl()->expr();
                     string e=walkCondExpr (old_expr, pProc, numLoc);
-                    picode->ic.hl.expr(picode->ic.hl.expr()->inverse());
+                    picode->hl()->expr(picode->hl()->expr()->inverse());
                     delete old_expr;
                 }
                 {
-                    string e=walkCondExpr (picode->ic.hl.expr(), pProc, numLoc);
+                    string e=walkCondExpr (picode->hl()->expr(), pProc, numLoc);
                     cCode.appendCode( "\n%swhile (%s) {\n", indent(indLevel),e.c_str());
                 }
                 picode->invalidate();
@@ -213,7 +213,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
             if (succ->traversed != DFS_ALPHA)
                 succ->writeCode (indLevel, pProc, numLoc, latch->dfsLastNum,_ifFollow);
             else	/* has been traversed so we need a goto */
-                succ->front().emitGotoLabel (indLevel);
+                succ->front().ll()->emitGotoLabel (indLevel);
         }
 
         /* Loop epilogue: generate the loop trailer */
@@ -230,10 +230,10 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
             cCode.appendCode( "%s}	/* end of loop */\n",indent(indLevel));
         else if (_loopType == REPEAT_TYPE)
         {
-            if (picode->ic.hl.opcode != HLI_JCOND)
+            if (picode->hl()->opcode != HLI_JCOND)
                 reportError (REPEAT_FAIL);
             {
-                string e=walkCondExpr (picode->ic.hl.expr(), pProc, numLoc);
+                string e=walkCondExpr (picode->hl()->expr(), pProc, numLoc);
                 cCode.appendCode( "%s} while (%s);\n", indent(indLevel),e.c_str());
             }
         }
@@ -245,7 +245,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
             if (succ->traversed != DFS_ALPHA)
                 succ->writeCode (indLevel, pProc, numLoc, latchNode, _ifFollow);
             else		/* has been traversed so we need a goto */
-                succ->front().emitGotoLabel (indLevel);
+                succ->front().ll()->emitGotoLabel (indLevel);
         }
     }
 
@@ -266,20 +266,20 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
                 {
                     if (succ->dfsLastNum != follow)	/* THEN part */
                     {
-                        l = writeJcond ( back().ic.hl, pProc, numLoc);
+                        l = writeJcond ( *back().hl(), pProc, numLoc);
                         cCode.appendCode( "\n%s%s", indent(indLevel-1), l);
                         succ->writeCode (indLevel, pProc, numLoc, latchNode,follow);
                     }
                     else		/* empty THEN part => negate ELSE part */
                     {
-                        l = writeJcondInv ( back().ic.hl, pProc, numLoc);
+                        l = writeJcondInv ( *back().hl(), pProc, numLoc);
                         cCode.appendCode( "\n%s%s", indent(indLevel-1), l);
                         edges[ELSE].BBptr->writeCode (indLevel, pProc, numLoc, latchNode, follow);
                         emptyThen = true;
                     }
                 }
                 else	/* already visited => emit label */
-                    succ->front().emitGotoLabel(indLevel);
+                    succ->front().ll()->emitGotoLabel(indLevel);
 
                 /* process the ELSE part */
                 succ = edges[ELSE].BBptr;
@@ -297,7 +297,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
                 {
                     cCode.appendCode( "%s}\n%selse {\n",
                                       indent(indLevel-1), indent(indLevel - 1));
-                    succ->front().emitGotoLabel (indLevel);
+                    succ->front().ll()->emitGotoLabel (indLevel);
                 }
                 cCode.appendCode( "%s}\n", indent(--indLevel));
 
@@ -308,8 +308,7 @@ void BB::writeCode (int indLevel, Function * pProc , int *numLoc,int latchNode,
             }
             else		/* no follow => if..then..else */
             {
-                l = writeJcond (
-                        back().ic.hl, pProc, numLoc);
+                l = writeJcond ( *back().hl(), pProc, numLoc);
                 cCode.appendCode( "%s%s", indent(indLevel-1), l);
                 edges[THEN].BBptr->writeCode (indLevel, pProc, numLoc, latchNode, _ifFollow);
                 cCode.appendCode( "%s}\n%selse {\n", indent(indLevel-1), indent(indLevel - 1));
@@ -334,7 +333,7 @@ void BB::writeBB(int lev, Function * pProc, int *numLoc)
 {
     /* Save the index into the code table in case there is a later goto
   * into this instruction (first instruction of the BB) */
-    front().codeIdx = nextBundleIdx (&cCode.code);
+    front().ll()->codeIdx = nextBundleIdx (&cCode.code);
     //hli[start].codeIdx = nextBundleIdx (&cCode.code);
     //for (i = start, last = i + length; i < last; i++)
 
@@ -344,7 +343,7 @@ void BB::writeBB(int lev, Function * pProc, int *numLoc)
     {
         if ((hli->type == HIGH_LEVEL) && (hli->invalid == FALSE))
         {
-            std::string line = hli->ic.hl.write1HlIcode(pProc, numLoc);
+            std::string line = hli->hl()->write1HlIcode(pProc, numLoc);
             if (!line.empty())
             {
                 cCode.appendCode( "%s%s", indent(lev), line.c_str());

+ 17 - 16
src/ast.cpp

@@ -66,7 +66,7 @@ void ICODE::setRegDU (uint8_t regi, operDu du_in)
 /* Copies the def, use, or def and use fields of duIcode into pIcode */
 void ICODE::copyDU(const ICODE &duIcode, operDu _du, operDu duDu)
 {
-    //    printf("%s %d,%d from %d to %d\n",__FUNCTION__,int(du),int(duDu),duIcode->ic.ll.opcode,pIcode->ic.ll.opcode);
+    //    printf("%s %d,%d from %d to %d\n",__FUNCTION__,int(du),int(duDu),duIcode->ll()->opcode,pIcode->ll()->opcode);
     switch (_du)
     {
     case eDEF:
@@ -258,17 +258,17 @@ COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst
     int idx;
     COND_EXPR *newExp = new COND_EXPR(IDENTIFIER);
     /* Check for long constant and save it as a constant expression */
-    if ((sd == SRC) && ((pIcode->ic.ll.flg & I) == I))  /* constant */
+    if ((sd == SRC) && pIcode->ll()->isLlFlag(I))  /* constant */
     {
         iICODE atOffset=pIcode;
         advance(atOffset,off);
         newExp->expr.ident.idType = CONSTANT;
         if (f == HIGH_FIRST)
-            newExp->expr.ident.idNode.kte.kte = (pIcode->ic.ll.src.op() << 16) +
-                    atOffset->ic.ll.src.op();
+            newExp->expr.ident.idNode.kte.kte = (pIcode->ll()->src.op() << 16) +
+                    atOffset->ll()->src.op();
         else        /* LOW_FIRST */
             newExp->expr.ident.idNode.kte.kte =
-                    (atOffset->ic.ll.src.op() << 16)+ pIcode->ic.ll.src.op();
+                    (atOffset->ll()->src.op() << 16)+ pIcode->ll()->src.op();
         newExp->expr.ident.idNode.kte.size = 4;
     }
     /* Save it as a long expression (reg, stack or glob) */
@@ -337,7 +337,7 @@ COND_EXPR *COND_EXPR::idID (const ID *retVal, LOCAL_ID *locsym, iICODE ix_)
 
 /* Returns an identifier conditional expression node, according to the given
  * type.
- * Arguments: i : index into the icode array, used for newLongRegId only.
+ * Arguments:
  *            duIcode: icode instruction that needs the du set.
  *            du: operand is defined or used in current instruction.    */
 COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE ix_,ICODE &duIcode, operDu du)
@@ -346,10 +346,10 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE
 
     int idx;          /* idx into pIcode->localId table */
 
-    const LLOperand &pm((sd == SRC) ? pIcode.ic.ll.src : pIcode.ic.ll.dst);
+    const LLOperand &pm((sd == SRC) ? pIcode.ll()->src : pIcode.ll()->dst);
 
-    if (    ((sd == DST) && pIcode.ic.ll.anyFlagSet(IM_DST)) or
-            ((sd == SRC) && pIcode.ic.ll.anyFlagSet(IM_SRC)) or
+    if (    ((sd == DST) && pIcode.ll()->isLlFlag(IM_DST)) or
+            ((sd == SRC) && pIcode.ll()->isLlFlag(IM_SRC)) or
             (sd == LHS_OP))             /* for MUL lhs */
     {                                                   /* implicit dx:ax */
         idx = pProc->localId.newLongReg (TYPE_LONG_SIGN, rDX, rAX, ix_);
@@ -358,20 +358,21 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE
         duIcode.setRegDU (rAX, du);
     }
 
-    else if ((sd == DST) && pIcode.ic.ll.anyFlagSet(IM_TMP_DST))
+    else if ((sd == DST) && pIcode.ll()->isLlFlag(IM_TMP_DST))
     {                                                   /* implicit tmp */
         newExp = COND_EXPR::idReg (rTMP, 0, &pProc->localId);
         duIcode.setRegDU(rTMP, (operDu)eUSE);
     }
 
-    else if ((sd == SRC) && pIcode.ic.ll.anyFlagSet(I)) /* constant */
-        newExp = COND_EXPR::idKte (pIcode.ic.ll.src.op(), 2);
+    else if ((sd == SRC) && pIcode.ll()->isLlFlag(I)) /* constant */
+        newExp = COND_EXPR::idKte (pIcode.ll()->src.op(), 2);
     else if (pm.regi == 0)                             /* global variable */
         newExp = COND_EXPR::idGlob(pm.segValue, pm.off);
     else if (pm.regi < INDEXBASE)                      /* register */
     {
-        newExp = COND_EXPR::idReg (pm.regi, (sd == SRC) ? pIcode.ic.ll.flg :
-                                                           pIcode.ic.ll.flg & NO_SRC_B, &pProc->localId);
+        newExp = COND_EXPR::idReg (pm.regi, (sd == SRC) ? pIcode.ll()->GetLlFlag() :
+                                                           pIcode.ll()->GetLlFlag() & NO_SRC_B,
+                                   &pProc->localId);
         duIcode.setRegDU( pm.regi, du);
     }
 
@@ -430,9 +431,9 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, iICODE
 /* Returns the identifier type */
 condId ICODE::idType(opLoc sd)
 {
-    LLOperand &pm((sd == SRC) ? ic.ll.src : ic.ll.dst);
+    LLOperand &pm((sd == SRC) ? ll()->src : ll()->dst);
 
-    if ((sd == SRC) && ((ic.ll.flg & I) == I))
+    if ((sd == SRC) && ll()->isLlFlag(I))
         return (CONSTANT);
     else if (pm.regi == 0)
         return (GLOB_VAR);

+ 6 - 7
src/backend.cpp

@@ -64,8 +64,8 @@ static void fixupLabels (PPROC pProc)
     dfsLast = pProc->dfsLast;
     for (i = 0; i < pProc->numBBs; i++)
         if (dfsLast[i]->flg/* & BB_HAS_LABEL*/) {
-            pProc->Icode.icode[dfsLast[i]->start].ic.ll.flg |= HLL_LABEL;
-            pProc->Icode.icode[dfsLast[i]->start].ic.ll.hllLabNum = getNextLabel();
+            pProc->Icode.icode[dfsLast[i]->start].ll()->flg |= HLL_LABEL;
+            pProc->Icode.icode[dfsLast[i]->start].ll()->hllLabNum = getNextLabel();
         }
 }
 #endif
@@ -225,14 +225,13 @@ static void writeBitVector (const std::bitset<32> &regi)
  *		 the code; that is, the target code has not been traversed yet. */
 static void emitFwdGotoLabel (ICODE * pt, int indLevel)
 {
-    if (! (pt->ic.ll.flg & HLL_LABEL)) /* node hasn't got a lab */
+    if ( not pt->ll()->isLlFlag(HLL_LABEL)) /* node hasn't got a lab */
     {
         /* Generate new label */
-        pt->ic.ll.hllLabNum = getNextLabel();
-        pt->ic.ll.flg |= HLL_LABEL;
+        pt->ll()->hllLabNum = getNextLabel();
+        pt->ll()->SetLlFlag(HLL_LABEL);
     }
-    cCode.appendCode( "%sgoto l%ld;\n", indent(indLevel),
-                      pt->ic.ll.hllLabNum);
+    cCode.appendCode( "%sgoto l%ld;\n", indent(indLevel), pt->ll()->hllLabNum);
 }
 
 

+ 6 - 6
src/comwrite.cpp

@@ -150,17 +150,17 @@ static const char *intOthers[] = {
 void ICODE::writeIntComment (std::ostringstream &s)
 {
     s<<"\t/* ";
-    if (ic.ll.src.op() == 0x21)
+    if (ll()->src.op() == 0x21)
     {
-        s <<int21h[ic.ll.dst.off];
+        s <<int21h[ll()->dst.off];
     }
-    else if (ic.ll.src.op() > 0x1F && ic.ll.src.op() < 0x2F)
+    else if (ll()->src.op() > 0x1F && ll()->src.op() < 0x2F)
     {
-        s <<intOthers[ic.ll.src.op() - 0x20];
+        s <<intOthers[ll()->src.op() - 0x20];
     }
-    else if (ic.ll.src.op() == 0x2F)
+    else if (ll()->src.op() == 0x2F)
     {
-        switch (ic.ll.dst.off)
+        switch (ll()->dst.off)
         {
             case 0x01 :
                 s << "Print spooler";

+ 14 - 14
src/control.cpp

@@ -180,7 +180,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
                     head->loopFollow = latchNode->edges[ELSE].BBptr->dfsLastNum;
                 else
                     head->loopFollow = latchNode->edges[THEN].BBptr->dfsLastNum;
-                latchNode->back().SetLlFlag(JX_LOOP);
+                latchNode->back().ll()->SetLlFlag(JX_LOOP);
             }
             else
             {
@@ -189,7 +189,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
                     head->loopFollow = head->edges[ELSE].BBptr->dfsLastNum;
                 else
                     head->loopFollow = head->edges[THEN].BBptr->dfsLastNum;
-                head->back().SetLlFlag(JX_LOOP);
+                head->back().ll()->SetLlFlag(JX_LOOP);
             }
         else /* head = anything besides 2-way, latch = 2-way */
         {
@@ -198,7 +198,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
                 head->loopFollow = latchNode->edges[ELSE].BBptr->dfsLastNum;
             else
                 head->loopFollow = latchNode->edges[THEN].BBptr->dfsLastNum;
-            latchNode->back().SetLlFlag(JX_LOOP);
+            latchNode->back().ll()->SetLlFlag(JX_LOOP);
         }
     else	/* latch = 1-way */
         if (latchNode->nodeType == LOOP_NODE)
@@ -237,7 +237,7 @@ static void findNodesInLoop(BB * latchNode,BB * head,Function * pProc,queue &int
             }
             if (pbb->dfsLastNum > head->dfsLastNum)
                 pProc->m_dfsLast[head->loopFollow]->loopHead = NO_NODE;	/*****/
-            head->back().SetLlFlag(JX_LOOP);
+            head->back().ll()->SetLlFlag(JX_LOOP);
         }
         else
         {
@@ -450,7 +450,7 @@ void Function::structIfs ()
         if (currNode->flg & INVALID_BB)		/* Do not process invalid BBs */
             continue;
 
-        if ((currNode->nodeType == TWO_BRANCH) && (!currNode->back().isLlFlag(JX_LOOP)))
+        if ((currNode->nodeType == TWO_BRANCH) && (!currNode->back().ll()->isLlFlag(JX_LOOP)))
         {
             followInEdges = 0;
             follow = 0;
@@ -526,7 +526,7 @@ void Function::compoundCond()
                 /* Construct compound DBL_OR expression */
                 picode = &pbb->back();
                 ticode = &t->back();
-                picode->ic.hl.expr(COND_EXPR::boolOp (picode->ic.hl.expr(), ticode->ic.hl.expr(), DBL_OR));
+                picode->hl()->expr(COND_EXPR::boolOp (picode->hl()->expr(), ticode->hl()->expr(), DBL_OR));
 
                 /* Replace in-edge to obb from t to pbb */
                 {
@@ -562,11 +562,11 @@ void Function::compoundCond()
                 picode = &pbb->back();
                 ticode = &t->back();
 
-                COND_EXPR *oldexpr=picode->ic.hl.expr();
-                picode->ic.hl.expr(picode->ic.hl.expr()->inverse());
+                COND_EXPR *oldexpr=picode->hl()->expr();
+                picode->hl()->expr(picode->hl()->expr()->inverse());
                 delete oldexpr;
 
-                picode->ic.hl.expr(COND_EXPR::boolOp (picode->ic.hl.expr(), ticode->ic.hl.expr(), DBL_AND));
+                picode->hl()->expr(COND_EXPR::boolOp (picode->hl()->expr(), ticode->hl()->expr(), DBL_AND));
 
                 /* Replace in-edge to obb from t to pbb */
                 auto iter=std::find(obb->inEdges.begin(),obb->inEdges.end(),t);
@@ -600,7 +600,7 @@ void Function::compoundCond()
                 /* Construct compound DBL_AND expression */
                 picode = &pbb->back();
                 ticode = &t->back();
-                picode->ic.hl.expr(COND_EXPR::boolOp (picode->ic.hl.expr(),ticode->ic.hl.expr(), DBL_AND));
+                picode->hl()->expr(COND_EXPR::boolOp (picode->hl()->expr(),ticode->hl()->expr(), DBL_AND));
 
                 /* Replace in-edge to obb from e to pbb */
                 auto iter = std::find(obb->inEdges.begin(),obb->inEdges.end(),e);
@@ -632,11 +632,11 @@ void Function::compoundCond()
                 /* Construct compound DBL_OR expression */
                 picode = &pbb->back();
                 ticode = &t->back();
-                COND_EXPR *oldexp=picode->ic.hl.expr();
-                picode->ic.hl.expr(picode->ic.hl.expr()->inverse());
+                COND_EXPR *oldexp=picode->hl()->expr();
+                picode->hl()->expr(picode->hl()->expr()->inverse());
                 delete oldexp;
-                picode->ic.hl.expr(COND_EXPR::boolOp (picode->ic.hl.expr(), ticode->ic.hl.expr(), DBL_OR));
-                //picode->ic.hl.expr() = exp;
+                picode->hl()->expr(COND_EXPR::boolOp (picode->hl()->expr(), ticode->hl()->expr(), DBL_OR));
+                //picode->hl()->expr() = exp;
 
                 /* Replace in-edge to obb from e to pbb */
                 auto iter = std::find(obb->inEdges.begin(),obb->inEdges.end(),e);

+ 103 - 100
src/dataflow.cpp

@@ -83,11 +83,11 @@ int STKFRAME::getLocVar(int off)
 /* Returns a string with the source operand of Icode */
 static COND_EXPR *srcIdent (const ICODE &Icode, Function * pProc, iICODE i, ICODE & duIcode, operDu du)
 {
-    if (Icode.ic.ll.flg & I)   /* immediate operand */
+    if (Icode.ll()->isLlFlag(I))   /* immediate operand */
     {
-        if (Icode.ic.ll.flg & B)
-            return COND_EXPR::idKte (Icode.ic.ll.src.op(), 1);
-        return COND_EXPR::idKte (Icode.ic.ll.src.op(), 2);
+        if (Icode.ll()->isLlFlag(B))
+            return COND_EXPR::idKte (Icode.ll()->src.op(), 1);
+        return COND_EXPR::idKte (Icode.ll()->src.op(), 2);
     }
     // otherwise
     return COND_EXPR::id (Icode, SRC, pProc, i, duIcode, du);
@@ -99,7 +99,7 @@ static COND_EXPR *dstIdent (const ICODE & Icode, Function * pProc, iICODE i, ICO
 {
     COND_EXPR *n;
     n = COND_EXPR::id (Icode, DST, pProc, i, duIcode, du);
-    /** Is it needed? (pIcode->ic.ll.flg) & NO_SRC_B **/
+    /** Is it needed? (pIcode->ll()->flg) & NO_SRC_B **/
     return (n);
 }
 /* Eliminates all condition codes and generates new hlIcode instructions */
@@ -124,21 +124,22 @@ void Function::elimCondCodes ()
 
         for (useAt = pBB->rbegin2(); useAt != pBB->rend2(); useAt++)
         {
-            if ((useAt->type == LOW_LEVEL) && (useAt->valid()) && (use = useAt->ic.ll.flagDU.u))
+            llIcode useAtOp = useAt->ll()->GetLlOpcode();
+            if ((useAt->type == LOW_LEVEL) && (useAt->valid()) && (use = useAt->ll()->flagDU.u))
             {
                 /* Find definition within the same basic block */
                 defAt=useAt;
                 ++defAt;
                 for (; defAt != pBB->rend2(); defAt++)
                 {
-                    def = defAt->ic.ll.flagDU.d;
+                    def = defAt->ll()->flagDU.d;
                     if ((use & def) != use)
                         continue;
                     notSup = FALSE;
-                    if ((useAt->GetLlOpcode() >= iJB) && (useAt->GetLlOpcode() <= iJNS))
+                    if ((useAtOp >= iJB) && (useAtOp <= iJNS))
                     {
                         iICODE befDefAt = (++riICODE(defAt)).base();
-                        switch (defAt->GetLlOpcode())
+                        switch (defAt->ll()->GetLlOpcode())
                         {
                         case iCMP:
                             rhs = srcIdent (*defAt, this, befDefAt,*useAt, eUSE);
@@ -146,9 +147,9 @@ void Function::elimCondCodes ()
                             break;
 
                         case iOR:
-                            lhs = defAt->ic.hl.asgn.lhs->clone();
+                            lhs = defAt->hl()->asgn.lhs->clone();
                             useAt->copyDU(*defAt, eUSE, eDEF);
-                            if (defAt->isLlFlag(B))
+                            if (defAt->ll()->isLlFlag(B))
                                 rhs = COND_EXPR::idKte (0, 1);
                             else
                                 rhs = COND_EXPR::idKte (0, 2);
@@ -158,7 +159,7 @@ void Function::elimCondCodes ()
                             rhs = srcIdent (*defAt,this, befDefAt,*useAt, eUSE);
                             lhs = dstIdent (*defAt,this, befDefAt,*useAt, eUSE);
                             lhs = COND_EXPR::boolOp (lhs, rhs, AND);
-                            if (defAt->isLlFlag(B))
+                            if (defAt->ll()->isLlFlag(B))
                                 rhs = COND_EXPR::idKte (0, 1);
                             else
                                 rhs = COND_EXPR::idKte (0, 2);
@@ -167,17 +168,17 @@ void Function::elimCondCodes ()
                         default:
                             notSup = TRUE;
                             std::cout << hex<<defAt->loc_ip;
-                            reportError (JX_NOT_DEF, defAt->GetLlOpcode());
+                            reportError (JX_NOT_DEF, defAt->ll()->GetLlOpcode());
                             flg |= PROC_ASM;		/* generate asm */
                         }
                         if (! notSup)
                         {
-                            exp = COND_EXPR::boolOp (lhs, rhs,condOpJCond[useAt->GetLlOpcode()-iJB]);
+                            exp = COND_EXPR::boolOp (lhs, rhs,condOpJCond[useAtOp-iJB]);
                             useAt->setJCond(exp);
                         }
                     }
 
-                    else if (useAt->GetLlOpcode() == iJCXZ)
+                    else if (useAtOp == iJCXZ)
                     {
                         lhs = COND_EXPR::idReg (rCX, 0, &localId);
                         useAt->setRegDU (rCX, eUSE);
@@ -191,7 +192,7 @@ void Function::elimCondCodes ()
 //                        ICODE &b(*useAt);
 //                        if(a.GetLlOpcode() == iRCL)
 //                        {
-//                            if ((b.ic.ll.flg & NO_SRC) != NO_SRC)   /* if there is src op */
+//                            if ((b.ll()->flg & NO_SRC) != NO_SRC)   /* if there is src op */
 //                                rhs = COND_EXPR::id (*useAt, SRC, this, Icode.end(), *useAt, NONE);
 //                            lhs = COND_EXPR::id (*useAt, DST, this, Icode.end(), *useAt, USE_DEF);
 
@@ -205,20 +206,20 @@ void Function::elimCondCodes ()
                     {
                         ICODE &a(*defAt);
                         ICODE &b(*useAt);
-                        reportError (NOT_DEF_USE,a.GetLlOpcode(),b.GetLlOpcode());
+                        reportError (NOT_DEF_USE,a.ll()->GetLlOpcode(),b.ll()->GetLlOpcode());
                         flg |= PROC_ASM;		/* generate asm */
                     }
                     break;
                 }
 
                 /* Check for extended basic block */
-                if ((pBB->size() == 1) &&(useAt->GetLlOpcode() >= iJB) && (useAt->GetLlOpcode() <= iJNS))
+                if ((pBB->size() == 1) &&(useAtOp >= iJB) && (useAtOp <= iJNS))
                 {
                     ICODE & prev(pBB->back()); /* For extended basic blocks - previous icode inst */
-                    if (prev.ic.hl.opcode == HLI_JCOND)
+                    if (prev.hl()->opcode == HLI_JCOND)
                     {
-                        exp = prev.ic.hl.expr()->clone();
-                        exp->changeBoolOp (condOpJCond[useAt->GetLlOpcode()-iJB]);
+                        exp = prev.hl()->expr()->clone();
+                        exp->changeBoolOp (condOpJCond[useAtOp-iJB]);
                         useAt->copyDU(prev, eUSE, eUSE);
                         useAt->setJCond(exp);
                     }
@@ -226,7 +227,7 @@ void Function::elimCondCodes ()
                 /* Error - definition not found for use of a cond code */
                 else if (defAt == pBB->rend2())
                 {
-                    reportError(DEF_NOT_FOUND,useAt->GetLlOpcode());
+                    reportError(DEF_NOT_FOUND,useAtOp);
                     //fatalError (DEF_NOT_FOUND, Icode.GetLlOpcode(useAt-1));
                 }
             }
@@ -311,10 +312,10 @@ void Function::liveRegAnalysis (std::bitset<32> &in_liveOut)
                 if (flg & PROC_IS_FUNC)
                 {
                     auto picode = pbb->rbegin2(); /* icode of function return */
-                    if (picode->ic.hl.opcode == HLI_RET)
+                    if (picode->hl()->opcode == HLI_RET)
                     {
                         //pbb->back().loc_ip
-                        picode->ic.hl.expr(COND_EXPR::idID (&retVal, &localId, (++pbb->rbegin2()).base()));
+                        picode->hl()->expr(COND_EXPR::idID (&retVal, &localId, (++pbb->rbegin2()).base()));
                         picode->du.use = in_liveOut;
                     }
                 }
@@ -328,7 +329,7 @@ void Function::liveRegAnalysis (std::bitset<32> &in_liveOut)
                 if (pbb->nodeType == CALL_NODE)
                 {
                     ICODE &ticode(pbb->back());
-                    pcallee = ticode.ic.hl.call.proc;
+                    pcallee = ticode.hl()->call.proc;
 
                     /* user/runtime routine */
                     if (! (pcallee->flg & PROC_ISLIB))
@@ -414,10 +415,13 @@ void BB::genDU1()
         regi = 0;
         defRegIdx = 0;
         // foreach defined register
+        bitset<32> processed=0;
         for (k = 0; k < INDEXBASE; k++)
         {
             if (not picode->du.def.test(k))
                 continue;
+            //printf("Processing reg")
+            processed |= duReg[k];
             regi = (uint8_t)(k + 1);       /* defined register */
             picode->du1.regi[defRegIdx] = regi;
 
@@ -443,7 +447,6 @@ void BB::genDU1()
                     if ((ricode->du.def & duReg[regi]).any())
                         break;
                 }
-
                 /* Check if last definition of this register */
                 if ((not (ticode->du.def & duReg[regi]).any()) and (this->liveOut & duReg[regi]).any())
                     picode->du.lastDefRegi |= duReg[regi];
@@ -459,8 +462,8 @@ void BB::genDU1()
              * that are functions.  The target icode is in the
              * next basic block (unoptimized code) or somewhere else
              * on optimized code. */
-            if ((picode->ic.hl.opcode == HLI_CALL) &&
-                    (picode->ic.hl.call.proc->flg & PROC_IS_FUNC))
+            if ((picode->hl()->opcode == HLI_CALL) &&
+                    (picode->hl()->call.proc->flg & PROC_IS_FUNC))
             {
                 tbb = this->edges[0].BBptr;
                 for (ticode = tbb->begin2(); ticode != tbb->end2(); ticode++)
@@ -490,8 +493,8 @@ void BB::genDU1()
              * account by the programmer). 	*/
             if (picode->valid() and not picode->du1.used(defRegIdx) and
                     (not (picode->du.lastDefRegi & duReg[regi]).any()) &&
-                    (not ((picode->ic.hl.opcode == HLI_CALL) &&
-                          (picode->ic.hl.call.proc->flg & PROC_ISLIB))))
+                    (not ((picode->hl()->opcode == HLI_CALL) &&
+                          (picode->hl()->call.proc->flg & PROC_ISLIB))))
             {
                 if (! (this->liveOut & duReg[regi]).any())	/* not liveOut */
                 {
@@ -553,7 +556,7 @@ static void forwardSubs (COND_EXPR *lhs, COND_EXPR *rhs, iICODE picode,
         return;
 
     /* Insert on rhs of ticode, if possible */
-    res = insertSubTreeReg (rhs, &ticode->ic.hl.asgn.rhs,
+    res = insertSubTreeReg (rhs, &ticode->hl()->asgn.rhs,
                             locsym->id_arr[lhs->expr.ident.idNode.regiIdx].id.regi,
                             locsym);
     if (res)
@@ -564,7 +567,7 @@ static void forwardSubs (COND_EXPR *lhs, COND_EXPR *rhs, iICODE picode,
     else
     {
         /* Try to insert it on lhs of ticode*/
-        res = insertSubTreeReg (rhs, &ticode->ic.hl.asgn.lhs,
+        res = insertSubTreeReg (rhs, &ticode->hl()->asgn.lhs,
                                 locsym->id_arr[lhs->expr.ident.idNode.regiIdx].id.regi,
                                 locsym);
         if (res)
@@ -587,7 +590,7 @@ static void forwardSubsLong (int longIdx, COND_EXPR *exp, iICODE picode,
         return;
 
     /* Insert on rhs of ticode, if possible */
-    res = insertSubTreeLongReg (exp, &ticode->ic.hl.asgn.rhs, longIdx);
+    res = insertSubTreeLongReg (exp, &ticode->hl()->asgn.rhs, longIdx);
     if (res)
     {
         picode->invalidate();
@@ -596,7 +599,7 @@ static void forwardSubsLong (int longIdx, COND_EXPR *exp, iICODE picode,
     else
     {
         /* Try to insert it on lhs of ticode*/
-        res = insertSubTreeLongReg (exp, &ticode->ic.hl.asgn.lhs, longIdx);
+        res = insertSubTreeLongReg (exp, &ticode->hl()->asgn.lhs, longIdx);
         if (res)
         {
             picode->invalidate();
@@ -677,13 +680,13 @@ static void processCArg (Function * pp, Function * pProc, ICODE * picode, int nu
             }
             else
                 adjustActArgType (exp, pp->args.sym[numArgs].type, pProc);
-        res = picode->newStkArg (exp, picode->ic.ll.opcode, pProc);
+        res = picode->newStkArg (exp, picode->ll()->opcode, pProc);
     }
     else			/* user function */
     {
         if (pp->args.numArgs > 0)
             pp->args.adjustForArgType (numArgs, expType (exp, pProc));
-        res = picode->newStkArg (exp, picode->ic.ll.opcode, pProc);
+        res = picode->newStkArg (exp, picode->ll()->opcode, pProc);
     }
 
     /* Do not update the size of k if the expression was a segment register
@@ -738,33 +741,33 @@ void Function::findExps()
                         regi = picode->du1.regi[0];
 
                         /* Check if we can forward substitute this register */
-                        switch (picode->ic.hl.opcode)
+                        switch (picode->hl()->opcode)
                         {
                         case HLI_ASSIGN:
                             /* Replace rhs of current icode into target
                              * icode expression */
                             ticode = picode->du1.idx[0].uses.front();
                             if ((picode->du.lastDefRegi & duReg[regi]).any() &&
-                                    ((ticode->ic.hl.opcode != HLI_CALL) &&
-                                     (ticode->ic.hl.opcode != HLI_RET)))
+                                    ((ticode->hl()->opcode != HLI_CALL) &&
+                                     (ticode->hl()->opcode != HLI_RET)))
                                 continue;
 
-                            if (xClear (picode->ic.hl.asgn.rhs, picode,
+                            if (xClear (picode->hl()->asgn.rhs, picode,
                                         picode->du1.idx[0].uses[0],  lastInst, this))
                             {
-                                switch (ticode->ic.hl.opcode) {
+                                switch (ticode->hl()->opcode) {
                                 case HLI_ASSIGN:
-                                    forwardSubs (picode->ic.hl.asgn.lhs,
-                                                 picode->ic.hl.asgn.rhs,
+                                    forwardSubs (picode->hl()->asgn.lhs,
+                                                 picode->hl()->asgn.rhs,
                                                  picode, ticode, &localId,
                                                  numHlIcodes);
                                     break;
 
                                 case HLI_JCOND: case HLI_PUSH: case HLI_RET:
                                     res = insertSubTreeReg (
-                                                picode->ic.hl.asgn.rhs,
-                                                &ticode->ic.hl.exp.v,
-                                                localId.id_arr[picode->ic.hl.asgn.lhs->expr.ident.idNode.regiIdx].id.regi,
+                                                picode->hl()->asgn.rhs,
+                                                &ticode->hl()->exp.v,
+                                                localId.id_arr[picode->hl()->asgn.lhs->expr.ident.idNode.regiIdx].id.regi,
                                                 &localId);
                                     if (res)
                                     {
@@ -785,22 +788,22 @@ void Function::findExps()
                         case HLI_POP:
                             ticode = picode->du1.idx[0].uses.front();
                             if ((picode->du.lastDefRegi & duReg[regi]).any() &&
-                                    ((ticode->ic.hl.opcode != HLI_CALL) &&
-                                     (ticode->ic.hl.opcode != HLI_RET)))
+                                    ((ticode->hl()->opcode != HLI_CALL) &&
+                                     (ticode->hl()->opcode != HLI_RET)))
                                 continue;
 
                             exp = g_exp_stk.pop();  /* pop last exp pushed */
-                            switch (ticode->ic.hl.opcode) {
+                            switch (ticode->hl()->opcode) {
                             case HLI_ASSIGN:
-                                forwardSubs (picode->ic.hl.expr(), exp,
+                                forwardSubs (picode->hl()->expr(), exp,
                                              picode, ticode, &localId,
                                              numHlIcodes);
                                 break;
 
                             case HLI_JCOND: case HLI_PUSH: case HLI_RET:
                                 res = insertSubTreeReg (exp,
-                                                        &ticode->ic.hl.exp.v,
-                                                        localId.id_arr[picode->ic.hl.expr()->expr.ident.idNode.regiIdx].id.regi,
+                                                        &ticode->hl()->exp.v,
+                                                        localId.id_arr[picode->hl()->expr()->expr.ident.idNode.regiIdx].id.regi,
                                                         &localId);
                                 if (res)
                                 {
@@ -819,19 +822,19 @@ void Function::findExps()
 
                         case HLI_CALL:
                             ticode = picode->du1.idx[0].uses.front();
-                            switch (ticode->ic.hl.opcode) {
+                            switch (ticode->hl()->opcode) {
                             case HLI_ASSIGN:
                                 exp = COND_EXPR::idFunc (
-                                            picode->ic.hl.call.proc,
-                                            picode->ic.hl.call.args);
+                                            picode->hl()->call.proc,
+                                            picode->hl()->call.args);
                                 res = insertSubTreeReg (exp,
-                                                        &ticode->ic.hl.asgn.rhs,
-                                                        picode->ic.hl.call.proc->retVal.id.regi,
+                                                        &ticode->hl()->asgn.rhs,
+                                                        picode->hl()->call.proc->retVal.id.regi,
                                                         &localId);
                                 if (! res)
                                     insertSubTreeReg (exp,
-                                                      &ticode->ic.hl.asgn.lhs,
-                                                      picode->ic.hl.call.proc->retVal.id.regi,
+                                                      &ticode->hl()->asgn.lhs,
+                                                      picode->hl()->call.proc->retVal.id.regi,
                                                       &localId);
                                 /*** TODO: HERE missing: 2 regs ****/
                                 picode->invalidate();
@@ -839,16 +842,16 @@ void Function::findExps()
                                 break;
 
                             case HLI_PUSH: case HLI_RET:
-                                ticode->ic.hl.expr( COND_EXPR::idFunc ( picode->ic.hl.call.proc, picode->ic.hl.call.args) );
+                                ticode->hl()->expr( COND_EXPR::idFunc ( picode->hl()->call.proc, picode->hl()->call.args) );
                                 picode->invalidate();
                                 numHlIcodes--;
                                 break;
 
                             case HLI_JCOND:
-                                exp = COND_EXPR::idFunc ( picode->ic.hl.call.proc, picode->ic.hl.call.args);
-                                retVal = &picode->ic.hl.call.proc->retVal,
+                                exp = COND_EXPR::idFunc ( picode->hl()->call.proc, picode->hl()->call.args);
+                                retVal = &picode->hl()->call.proc->retVal,
                                         res = insertSubTreeReg (exp,
-                                                                &ticode->ic.hl.exp.v,
+                                                                &ticode->hl()->exp.v,
                                                                 retVal->id.regi, &localId);
                                 if (res)	/* was substituted */
                                 {
@@ -873,7 +876,7 @@ void Function::findExps()
                     /* Check for only one use of these registers */
                     if ((picode->du1.numUses(0) == 1) and (picode->du1.numUses(1) == 1))
                     {
-                        switch (picode->ic.hl.opcode) {
+                        switch (picode->hl()->opcode) {
                         case HLI_ASSIGN:
                             /* Replace rhs of current icode into target
                              * icode expression */
@@ -881,22 +884,22 @@ void Function::findExps()
                             {
                                 ticode = picode->du1.idx[0].uses.front();
                                 if ((picode->du.lastDefRegi & duReg[regi]).any() &&
-                                        ((ticode->ic.hl.opcode != HLI_CALL) &&
-                                         (ticode->ic.hl.opcode != HLI_RET)))
+                                        ((ticode->hl()->opcode != HLI_CALL) &&
+                                         (ticode->hl()->opcode != HLI_RET)))
                                     continue;
 
-                                switch (ticode->ic.hl.opcode) {
+                                switch (ticode->hl()->opcode) {
                                 case HLI_ASSIGN:
-                                    forwardSubsLong (picode->ic.hl.asgn.lhs->expr.ident.idNode.longIdx,
-                                                     picode->ic.hl.asgn.rhs, picode,ticode,
+                                    forwardSubsLong (picode->hl()->asgn.lhs->expr.ident.idNode.longIdx,
+                                                     picode->hl()->asgn.rhs, picode,ticode,
                                                      &numHlIcodes);
                                     break;
 
                                 case HLI_JCOND:  case HLI_PUSH:  case HLI_RET:
                                     res = insertSubTreeLongReg (
-                                                picode->ic.hl.asgn.rhs,
-                                                &ticode->ic.hl.exp.v,
-                                                picode->ic.hl.asgn.lhs->expr.ident.idNode.longIdx);
+                                                picode->hl()->asgn.rhs,
+                                                &ticode->hl()->exp.v,
+                                                picode->hl()->asgn.lhs->expr.ident.idNode.longIdx);
                                     if (res)
                                     {
                                         picode->invalidate();
@@ -918,20 +921,20 @@ void Function::findExps()
                             {
                                 ticode = picode->du1.idx[0].uses.front();
                                 if ((picode->du.lastDefRegi & duReg[regi]).any() &&
-                                        ((ticode->ic.hl.opcode != HLI_CALL) &&
-                                         (ticode->ic.hl.opcode != HLI_RET)))
+                                        ((ticode->hl()->opcode != HLI_CALL) &&
+                                         (ticode->hl()->opcode != HLI_RET)))
                                     continue;
 
                                 exp = g_exp_stk.pop(); /* pop last exp pushed */
-                                switch (ticode->ic.hl.opcode) {
+                                switch (ticode->hl()->opcode) {
                                 case HLI_ASSIGN:
-                                    forwardSubsLong (picode->ic.hl.expr()->expr.ident.idNode.longIdx,
+                                    forwardSubsLong (picode->hl()->expr()->expr.ident.idNode.longIdx,
                                                      exp, picode, ticode, &numHlIcodes);
                                     break;
                                 case HLI_JCOND: case HLI_PUSH:
                                     res = insertSubTreeLongReg (exp,
-                                                                &ticode->ic.hl.exp.v,
-                                                                picode->ic.hl.asgn.lhs->expr.ident.idNode.longIdx);
+                                                                &ticode->hl()->exp.v,
+                                                                picode->hl()->asgn.lhs->expr.ident.idNode.longIdx);
                                     if (res)
                                     {
                                         picode->invalidate();
@@ -946,30 +949,30 @@ void Function::findExps()
 
                         case HLI_CALL:    /* check for function return */
                             ticode = picode->du1.idx[0].uses.front();
-                            switch (ticode->ic.hl.opcode)
+                            switch (ticode->hl()->opcode)
                             {
                             case HLI_ASSIGN:
                                 exp = COND_EXPR::idFunc (
-                                            picode->ic.hl.call.proc,
-                                            picode->ic.hl.call.args);
-                                ticode->ic.hl.asgn.lhs =
+                                            picode->hl()->call.proc,
+                                            picode->hl()->call.args);
+                                ticode->hl()->asgn.lhs =
                                         COND_EXPR::idLong(&localId, DST, ticode,HIGH_FIRST, picode, eDEF, 1);
-                                ticode->ic.hl.asgn.rhs = exp;
+                                ticode->hl()->asgn.rhs = exp;
                                 picode->invalidate();
                                 numHlIcodes--;
                                 break;
 
                             case HLI_PUSH:  case HLI_RET:
-                                ticode->ic.hl.expr( COND_EXPR::idFunc ( picode->ic.hl.call.proc, picode->ic.hl.call.args) );
+                                ticode->hl()->expr( COND_EXPR::idFunc ( picode->hl()->call.proc, picode->hl()->call.args) );
                                 picode->invalidate();
                                 numHlIcodes--;
                                 break;
 
                             case HLI_JCOND:
-                                exp = COND_EXPR::idFunc ( picode->ic.hl.call.proc, picode->ic.hl.call.args);
-                                retVal = &picode->ic.hl.call.proc->retVal;
+                                exp = COND_EXPR::idFunc ( picode->hl()->call.proc, picode->hl()->call.args);
+                                retVal = &picode->hl()->call.proc->retVal;
                                 res = insertSubTreeLongReg (exp,
-                                                            &ticode->ic.hl.exp.v,
+                                                            &ticode->hl()->exp.v,
                                                             localId.newLongReg ( retVal->type, retVal->id.longId.h,
                                                                                  retVal->id.longId.l, picode));
                                 if (res)	/* was substituted */
@@ -991,9 +994,9 @@ void Function::findExps()
                 /* HLI_PUSH doesn't define any registers, only uses registers.
                  * Push the associated expression to the register on the local
                  * expression stack */
-                else if (picode->ic.hl.opcode == HLI_PUSH)
+                else if (picode->hl()->opcode == HLI_PUSH)
                 {
-                    g_exp_stk.push(picode->ic.hl.expr());
+                    g_exp_stk.push(picode->hl()->expr());
                     picode->invalidate();
                     numHlIcodes--;
                 }
@@ -1001,13 +1004,13 @@ void Function::findExps()
                 /* For HLI_CALL instructions that use arguments from the stack,
                                  * pop them from the expression stack and place them on the
                                  * procedure's argument list */
-                if ((picode->ic.hl.opcode == HLI_CALL) &&
-                        ! (picode->ic.hl.call.proc->flg & REG_ARGS))
+                if ((picode->hl()->opcode == HLI_CALL) &&
+                        ! (picode->hl()->call.proc->flg & REG_ARGS))
                 { Function * pp;
                     int cb, numArgs;
                     boolT res;
 
-                    pp = picode->ic.hl.call.proc;
+                    pp = picode->hl()->call.proc;
                     if (pp->flg & CALL_PASCAL)
                     {
                         cb = pp->cbParam;	/* fixed # arguments */
@@ -1018,13 +1021,13 @@ void Function::findExps()
                             {
                                 if (pp->args.numArgs > 0)
                                     adjustActArgType(exp, pp->args.sym[numArgs].type, this);
-                                res = picode->newStkArg (exp, picode->ic.ll.opcode, this);
+                                res = picode->newStkArg (exp, picode->ll()->opcode, this);
                             }
                             else			/* user function */
                             {
                                 if (pp->args.numArgs >0)
                                     pp->args.adjustForArgType (numArgs,expType (exp, this));
-                                res = picode->newStkArg (exp,picode->ic.ll.opcode, this);
+                                res = picode->newStkArg (exp,picode->ll()->opcode, this);
                             }
                             if (res == FALSE)
                                 k += hlTypeSize (exp, this);
@@ -1032,12 +1035,12 @@ void Function::findExps()
                     }
                     else		/* CALL_C */
                     {
-                        cb = picode->ic.hl.call.args->cb;
+                        cb = picode->hl()->call.args->cb;
                         numArgs = 0;
                         if (cb)
                             for (k = 0; k < cb; numArgs++)
                                 processCArg (pp, this, &(*picode), numArgs, &k);
-                        else if ((cb == 0) && (picode->ic.ll.flg & REST_STK))
+                        else if ((cb == 0) && picode->ll()->isLlFlag(REST_STK))
                             while (! g_exp_stk.empty())
                             {
                                 processCArg (pp, this, &(*picode), numArgs, &k);
@@ -1048,13 +1051,13 @@ void Function::findExps()
 
                 /* If we could not substitute the result of a function,
                  * assign it to the corresponding registers */
-                if ((picode->ic.hl.opcode == HLI_CALL) &&
-                        ((picode->ic.hl.call.proc->flg & PROC_ISLIB) !=
+                if ((picode->hl()->opcode == HLI_CALL) &&
+                        ((picode->hl()->call.proc->flg & PROC_ISLIB) !=
                          PROC_ISLIB) && (not picode->du1.used(0)) &&
                         (picode->du1.numRegsDef > 0))
                 {
-                    exp = COND_EXPR::idFunc (picode->ic.hl.call.proc, picode->ic.hl.call.args);
-                    lhs = COND_EXPR::idID (&picode->ic.hl.call.proc->retVal, &localId, picode);
+                    exp = COND_EXPR::idFunc (picode->hl()->call.proc, picode->hl()->call.args);
+                    lhs = COND_EXPR::idID (&picode->hl()->call.proc->retVal, &localId, picode);
                     picode->setAsgn(lhs, exp);
                 }
             }

+ 53 - 53
src/disassem.cpp

@@ -213,22 +213,22 @@ void disassem(int pass, Function * ppProc)
         //for (i = 0; i < numIcode; i++)
         for( ICODE &icode : pc)
         {
-            if ((icode.ic.ll.flg & I) && !(icode.ic.ll.flg & JMP_ICODE) &&
-                    JmpInst(icode.ic.ll.opcode))
+            LLInst *ll=icode.ll();
+            if (ll->isLlFlag(I) && ! ll->isLlFlag(JMP_ICODE) && JmpInst(ll->opcode))
             {
                 /* Replace the immediate operand with an icode index */
-                iICODE labTgt=pc.labelSrch(icode.ic.ll.src.op());
+                iICODE labTgt=pc.labelSrch(ll->src.op());
                 if (labTgt!=pc.end())
                 {
-                    icode.ic.ll.src.SetImmediateOp(labTgt->loc_ip);
+                    ll->src.SetImmediateOp(labTgt->loc_ip);
                     /* This icode is the target of a jump */
-                    labTgt->ic.ll.flg |= TARGET;
-                    icode.ic.ll.flg |= JMP_ICODE;   /* So its not done twice */
+                    labTgt->ll()->SetLlFlag(TARGET);
+                    ll->SetLlFlag(JMP_ICODE);   /* So its not done twice */
                 }
                 else
                 {
                     /* This jump cannot be linked to a label */
-                    icode.ic.ll.flg |= NO_LABEL;
+                    ll->SetLlFlag(NO_LABEL);
                 }
             }
         }
@@ -271,21 +271,21 @@ static void dis1Line(ICODE &icode_iter, int pass)
 
     oper_stream << uppercase;
     hex_bytes << uppercase;
-    LLInst &_IcLL(icode_iter.ic.ll);
+    LLInst &_IcLL(*icode_iter.ll());
     /* Disassembly stage 1 --
          * Do not try to display NO_CODE entries or synthetic instructions,
          * other than JMPs, that have been introduced for def/use analysis. */
     if ((option.asm1) &&
-            ((_IcLL.flg & NO_CODE) ||
-             ((_IcLL.flg & SYNTHETIC) && (_IcLL.opcode != iJMP))))
+            ( _IcLL.isLlFlag(NO_CODE) ||
+             (_IcLL.isLlFlag(SYNTHETIC) && (_IcLL.opcode != iJMP))))
     {
         return;
     }
-    else if (_IcLL.flg & NO_CODE)
+    else if (_IcLL.isLlFlag(NO_CODE))
     {
         return;
     }
-    if (_IcLL.flg & (TARGET | CASE))
+    if (_IcLL.isLlFlag(TARGET | CASE))
     {
         if (pass == 3)
             cCode.appendCode("\n"); /* Print to c code buffer */
@@ -294,7 +294,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
     }
 
     /* Find next instruction label and print hex bytes */
-    if (_IcLL.flg & SYNTHETIC)
+    if (_IcLL.isLlFlag(SYNTHETIC))
         nextInst = _IcLL.label;
     else
     {
@@ -321,7 +321,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
         {
             lab_contents << ':';             /* Also removes the null */
         }
-        else if (_IcLL.flg & TARGET)    /* Symbols override Lnn labels */
+        else if (_IcLL.isLlFlag(TARGET))    /* Symbols override Lnn labels */
         {
             /* Print label */
             if (pl.count(icode_iter.loc_ip)==0)
@@ -332,7 +332,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
         }
         oper_stream<< lab_contents.str();
     }
-    if (_IcLL.opcode == iSIGNEX && (_IcLL.flg & B))
+    if (_IcLL.opcode == iSIGNEX && _IcLL.isLlFlag(B))
     {
         _IcLL.opcode = iCBW;
     }
@@ -342,7 +342,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
     {
         case iADD:  case iADC:  case iSUB:  case iSBB:  case iAND:  case iOR:
         case iXOR:  case iTEST: case iCMP:  case iMOV:  case iLEA:  case iXCHG:
-            strDst(oper_stream,_IcLL.flg, _IcLL.dst);
+            strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst);
             strSrc(oper_stream,_IcLL);
             break;
 
@@ -352,42 +352,42 @@ static void dis1Line(ICODE &icode_iter, int pass)
 
         case iSAR:  case iSHL:  case iSHR:  case iRCL:  case iRCR:  case iROL:
         case iROR:
-            strDst(oper_stream,_IcLL.flg | I, _IcLL.dst);
-            if(_IcLL.flg & I)
+            strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
+            if(_IcLL.isLlFlag(I))
                 strSrc(oper_stream,_IcLL);
             else
                 oper_stream<<", cl";
             break;
 
         case iINC:  case iDEC:  case iNEG:  case iNOT:  case iPOP:
-            strDst(oper_stream,_IcLL.flg | I, _IcLL.dst);
+            strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
             break;
 
         case iPUSH:
-            if (_IcLL.flg & I)
+            if (_IcLL.isLlFlag(I))
             {
                 oper_stream<<strHex(_IcLL.src.op());
-//                strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
+//                strcpy(p + WID_PTR, strHex(pIcode->ll()->immed.op));
             }
             else
             {
-                strDst(oper_stream,_IcLL.flg | I, _IcLL.dst);
+                strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.dst);
             }
             break;
 
         case iDIV:  case iIDIV:  case iMUL: case iIMUL: case iMOD:
-            if (_IcLL.flg & I)
+            if (_IcLL.isLlFlag(I))
             {
-                strDst(oper_stream,_IcLL.flg, _IcLL.dst) <<", ";
-                formatRM(oper_stream, _IcLL.flg, _IcLL.src);
+                strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst) <<", ";
+                formatRM(oper_stream, _IcLL.GetLlFlag(), _IcLL.src);
                 strSrc(oper_stream,_IcLL);
             }
             else
-                strDst(oper_stream,_IcLL.flg | I, _IcLL.src);
+                strDst(oper_stream,_IcLL.GetLlFlag() | I, _IcLL.src);
             break;
 
         case iLDS:  case iLES:  case iBOUND:
-            strDst(oper_stream,_IcLL.flg, _IcLL.dst)<<", dword ptr";
+            strDst(oper_stream,_IcLL.GetLlFlag(), _IcLL.dst)<<", dword ptr";
             strSrc(oper_stream,_IcLL,true);
             break;
 
@@ -403,18 +403,18 @@ static void dis1Line(ICODE &icode_iter, int pass)
         ICODE *lab=pc.GetIcode(_IcLL.src.op());
             selectTable(Label);
         if ((_IcLL.src.op() < (uint32_t)numIcode) &&  /* Ensure in range */
-                readVal(oper_stream, lab->ic.ll.label, 0))
+                readVal(oper_stream, lab->ll()->label, 0))
             {
                 break;                          /* Symbolic label. Done */
         }
             }
 
-            if (_IcLL.flg & NO_LABEL)
+            if (_IcLL.isLlFlag(NO_LABEL))
             {
-                //strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
+                //strcpy(p + WID_PTR, strHex(pIcode->ll()->immed.op));
                 oper_stream<<strHex(_IcLL.src.op());
             }
-            else if (_IcLL.flg & I)
+            else if (_IcLL.isLlFlag(I) )
             {
                 j = _IcLL.src.op();
                 if (pl.count(j)==0)       /* Forward jump */
@@ -439,7 +439,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
             break;
 
         case iCALL: case iCALLF:
-            if (_IcLL.flg & I)
+            if (_IcLL.isLlFlag(I))
             {
                 if((_IcLL.opcode == iCALL))
                     oper_stream<< "near";
@@ -462,7 +462,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
             break;
 
         case iRET:  case iRETF:  case iINT:
-            if (_IcLL.flg & I)
+            if (_IcLL.isLlFlag(I))
             {
                 oper_stream<<strHex(_IcLL.src.op());
             }
@@ -479,9 +479,9 @@ static void dis1Line(ICODE &icode_iter, int pass)
             {
                 bool is_dx_src=(_IcLL.opcode == iOUTS || _IcLL.opcode == iREP_OUTS);
                 if(is_dx_src)
-                    oper_stream<<"dx, "<<szPtr[_IcLL.flg & B];
+                    oper_stream<<"dx, "<<szPtr[_IcLL.GetLlFlag() & B];
                 else
-                    oper_stream<<szPtr[_IcLL.flg & B];
+                    oper_stream<<szPtr[_IcLL.GetLlFlag() & B];
                 if (_IcLL.opcode == iLODS ||
                     _IcLL.opcode == iREP_LODS ||
                     _IcLL.opcode == iOUTS ||
@@ -496,7 +496,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
                 oper_stream<<":[si]";
             }
             else
-                oper_stream<<(_IcLL.flg & B)? "B": "W";
+                oper_stream<<(_IcLL.GetLlFlag() & B)? "B": "W";
             break;
 
         case iXLAT:
@@ -508,13 +508,13 @@ static void dis1Line(ICODE &icode_iter, int pass)
             break;
 
         case iIN:
-            oper_stream<<(_IcLL.flg & B)?"al, ": "ax, ";
-            oper_stream<<(_IcLL.flg & I)? strHex(_IcLL.src.op()): "dx";
+            oper_stream<<(_IcLL.GetLlFlag() & B)?"al, ": "ax, ";
+            oper_stream<<(_IcLL.isLlFlag(I))? strHex(_IcLL.src.op()): "dx";
             break;
 
         case iOUT:
-            oper_stream<<(_IcLL.flg & I)? strHex(_IcLL.src.op()): "dx";
-            oper_stream<<(_IcLL.flg & B)?", al": ", ax";
+            oper_stream<<(_IcLL.isLlFlag(I))? strHex(_IcLL.src.op()): "dx";
+            oper_stream<<(_IcLL.GetLlFlag() & B)?", al": ", ax";
             break;
 
         default:
@@ -522,7 +522,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
     }
 
     /* Comments */
-    if (_IcLL.flg & SYNTHETIC)
+    if (_IcLL.isLlFlag(SYNTHETIC))
     {
         fImpure = FALSE;
     }
@@ -542,13 +542,13 @@ static void dis1Line(ICODE &icode_iter, int pass)
     {
         result_stream <<"; "<<cbuf.str();
     }
-    else if (fImpure || (_IcLL.flg & (SWITCH | CASE | SEG_IMMED | IMPURE | SYNTHETIC | TERMINATES)))
+    else if (fImpure || (_IcLL.isLlFlag(SWITCH | CASE | SEG_IMMED | IMPURE | SYNTHETIC | TERMINATES)))
     {
-        if (_IcLL.flg & CASE)
+        if (_IcLL.isLlFlag(CASE))
         {
             result_stream << ";Case l"<< _IcLL.caseTbl.numEntries;
         }
-        if (_IcLL.flg & SWITCH)
+        if (_IcLL.isLlFlag(SWITCH))
         {
             result_stream << ";Switch ";
         }
@@ -556,15 +556,15 @@ static void dis1Line(ICODE &icode_iter, int pass)
         {
             result_stream << ";Accessed as data ";
         }
-        if (_IcLL.flg & IMPURE)
+        if (_IcLL.isLlFlag(IMPURE))
         {
             result_stream << ";Impure operand ";
         }
-        if (_IcLL.flg & SEG_IMMED)
+        if (_IcLL.isLlFlag(SEG_IMMED))
         {
             result_stream << ";Segment constant";
         }
-        if (_IcLL.flg & TERMINATES)
+        if (_IcLL.isLlFlag(TERMINATES))
         {
             result_stream << ";Exit to DOS";
         }
@@ -578,7 +578,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
     if(pass==3)
     {
         /* output to .b code buffer */
-        if (_IcLL.anyFlagSet(SYNTHETIC))
+        if (_IcLL.isLlFlag(SYNTHETIC))
             result_stream<<";Synthetic inst";
         if (pass == 3)		/* output to .b code buffer */
             cCode.appendCode("%s\n", result_stream.str().c_str());
@@ -586,7 +586,7 @@ static void dis1Line(ICODE &icode_iter, int pass)
     }
     else
     {
-        if (not _IcLL.anyFlagSet(SYNTHETIC) )
+        if (not _IcLL.isLlFlag(SYNTHETIC) )
         {
             /* output to .a1 or .a2 file */
             fprintf (fp, "%03ld %06lX %s\n", icode_iter.loc_ip, _IcLL.label, result_stream.str().c_str());
@@ -670,12 +670,12 @@ static ostringstream &strSrc(ostringstream &os,const LLInst &l_ins,bool skip_com
     static char buf[30] = {", "};
     if(false==skip_comma)
         os<<", ";
-    if (l_ins.flg & I)
+    if (l_ins.isLlFlag(I))
         os<<strHex(l_ins.src.op());
-    else if (l_ins.flg & IM_SRC)		/* level 2 */
+    else if (l_ins.isLlFlag(IM_SRC))		/* level 2 */
         os<<"dx:ax";
     else
-        formatRM(os, l_ins.flg, l_ins.src);
+        formatRM(os, l_ins.GetLlFlag(), l_ins.src);
 
     return os;
 }
@@ -748,7 +748,7 @@ void flops(LLInst &pIcode,std::ostringstream &out)
                 }
         }
 
-        formatRM(out, pIcode.flg, pIcode.dst);
+        formatRM(out, pIcode.GetLlFlag(), pIcode.dst);
     }
     else
     {

+ 28 - 27
src/graph.cpp

@@ -41,20 +41,21 @@ void Function::createCFG()
     stats.numBBbef = stats.numBBaft = 0;
     for (ip = start = 0; pIcode!=Icode.end(); ip++, pIcode++)
     {
+        LLInst *ll = pIcode->ll();
         /* Stick a NOWHERE_NODE on the end if we terminate
                  * with anything other than a ret, jump or terminate */
         if (ip + 1 == Icode.size() &&
-                ! (pIcode->ic.ll.flg & TERMINATES) &&
-                pIcode->ic.ll.opcode != iJMP && pIcode->ic.ll.opcode != iJMPF &&
-                pIcode->ic.ll.opcode != iRET && pIcode->ic.ll.opcode != iRETF)
+                (not ll->isLlFlag(TERMINATES)) &&
+                ll->opcode != iJMP && ll->opcode != iJMPF &&
+                ll->opcode != iRET && ll->opcode != iRETF)
         {
             pBB=BB::Create(start, ip, NOWHERE_NODE, 0, this);
         }
 
         /* Only process icodes that have valid instructions */
-        else if ((pIcode->ic.ll.flg & NO_CODE) != NO_CODE)
+        else if (not ll->isLlFlag(NO_CODE) )
         {
-            switch (pIcode->ic.ll.opcode) {
+            switch (ll->opcode) {
                 case iJB:  case iJBE:  case iJAE:  case iJA:
                 case iJL:  case iJLE:  case iJGE:  case iJG:
                 case iJE:  case iJNE:  case iJS:   case iJNS:
@@ -65,12 +66,12 @@ CondJumps:
                     start = ip + 1;
                     pBB->edges[0].ip = (uint32_t)start;
                     /* This is for jumps off into nowhere */
-                    if (pIcode->ic.ll.flg & NO_LABEL)
+                    if ( ll->isLlFlag(NO_LABEL) )
                     {
                         pBB->edges.pop_back();
                     }
                     else
-                        pBB->edges[1].ip = pIcode->ic.ll.src.op();
+                        pBB->edges[1].ip = ll->src.op();
                     break;
 
                 case iLOOP: case iLOOPE: case iLOOPNE:
@@ -78,17 +79,17 @@ CondJumps:
                     goto CondJumps;
 
                 case iJMPF: case iJMP:
-                    if (pIcode->ic.ll.flg & SWITCH)
+                    if (ll->isLlFlag(SWITCH))
                     {
-                        pBB = BB::Create(start, ip, MULTI_BRANCH, pIcode->ic.ll.caseTbl.numEntries, this);
-                        for (i = 0; i < pIcode->ic.ll.caseTbl.numEntries; i++)
-                            pBB->edges[i].ip = pIcode->ic.ll.caseTbl.entries[i];
+                        pBB = BB::Create(start, ip, MULTI_BRANCH, ll->caseTbl.numEntries, this);
+                        for (i = 0; i < ll->caseTbl.numEntries; i++)
+                            pBB->edges[i].ip = ll->caseTbl.entries[i];
                         hasCase = TRUE;
                     }
-                    else if ((pIcode->ic.ll.flg & (I | NO_LABEL)) == I)
+                    else if ((ll->GetLlFlag() & (I | NO_LABEL)) == I) //TODO: WHY NO_LABEL TESTIT
                     {
                         pBB = BB::Create(start, ip, ONE_BRANCH, 1, this);
-                        pBB->edges[0].ip = pIcode->ic.ll.src.op();
+                        pBB->edges[0].ip = ll->src.op();
                     }
                     else
                         BB::Create(start, ip, NOWHERE_NODE, 0, this);
@@ -97,7 +98,7 @@ CondJumps:
 
                 case iCALLF: case iCALL:
                 {
-                    Function * p = pIcode->ic.ll.src.proc.proc;
+                    Function * p = ll->src.proc.proc;
                     if (p)
                         i = ((p->flg) & TERMINATES) ? 0 : 1;
                     else
@@ -117,7 +118,7 @@ CondJumps:
                 default:
                     /* Check for exit to DOS */
                     iICODE next1=++iICODE(pIcode);
-                    if (pIcode->ic.ll.flg & TERMINATES)
+                    if ( ll->isLlFlag(TERMINATES) )
                     {
                         pBB = BB::Create(start, ip, TERMINATE_NODE, 0, this);
                         start = ip + 1;
@@ -126,7 +127,7 @@ CondJumps:
                     else if (next1 != Icode.end())
                     {
                         assert(next1->loc_ip==ip+1);
-                        if (next1->ic.ll.flg & (TARGET | CASE))
+                        if (next1->ll()->isLlFlag(TARGET | CASE))
                         {
                             pBB = BB::Create(start, ip, FALL_NODE, 1, this);
                             start = ip + 1;
@@ -166,14 +167,14 @@ void Function::markImpure()
     SYM * psym;
     for(ICODE &icod : Icode)
     {
-        if ( not icod.isLlFlag(SYM_USE | SYM_DEF))
+        if ( not icod.ll()->isLlFlag(SYM_USE | SYM_DEF))
             continue;
-        psym = &symtab[icod.ic.ll.caseTbl.numEntries];
+        psym = &symtab[icod.ll()->caseTbl.numEntries];
         for (int c = (int)psym->label; c < (int)psym->label+psym->size; c++)
         {
             if (BITMAP(c, BM_CODE))
             {
-                icod.SetLlFlag(IMPURE);
+                icod.ll()->SetLlFlag(IMPURE);
                 flg |= IMPURE;
                 break;
             }
@@ -223,7 +224,7 @@ void Function::compressCFG()
             {
                 pBB->edges[i].BBptr = pNxt;
                 assert(pBB->back().loc_ip==ip);
-                pBB->back().SetImmediateOp((uint32_t)pNxt->begin());
+                pBB->back().ll()->SetImmediateOp((uint32_t)pNxt->begin());
                 //Icode[ip].SetImmediateOp((uint32_t)pNxt->begin());
             }
         }
@@ -286,7 +287,7 @@ BB *BB::rmJMP(int marker, BB * pBB)
             }
             else
             {
-                pBB->front().SetLlFlag(NO_CODE);
+                pBB->front().ll()->SetLlFlag(NO_CODE);
                 pBB->front().invalidate(); //pProc->Icode.SetLlInvalid(pBB->begin(), TRUE);
             }
 
@@ -296,14 +297,14 @@ BB *BB::rmJMP(int marker, BB * pBB)
         {
             /* We are going around in circles */
             pBB->nodeType = NOWHERE_NODE;
-            pBB->front().ic.ll.src.SetImmediateOp(pBB->front().loc_ip);
-            //pBB->front().ic.ll.src.immed.op = pBB->front().loc_ip;
+            pBB->front().ll()->src.SetImmediateOp(pBB->front().loc_ip);
+            //pBB->front().ll()->src.immed.op = pBB->front().loc_ip;
             do {
                 pBB = pBB->edges[0].BBptr;
                 pBB->inEdges.pop_back(); // was --numInedges
                 if (! pBB->inEdges.empty())
                 {
-                    pBB->front().SetLlFlag(NO_CODE);
+                    pBB->front().ll()->SetLlFlag(NO_CODE);
                     pBB->front().invalidate();
 //                    pProc->Icode.SetLlFlag(pBB->start, NO_CODE);
 //                    pProc->Icode.SetLlInvalid(pBB->start, TRUE);
@@ -339,11 +340,11 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
             if(back().loc_ip>pChild->front().loc_ip) // back edege
                 break;
             auto iter=std::find_if(this->end2(),pChild->begin2(),[](ICODE &c)
-                {return not c.isLlFlag(NO_CODE);});
+                {return not c.ll()->isLlFlag(NO_CODE);});
 
             if (iter != pChild->begin2())
                 break;
-            back().SetLlFlag(NO_CODE);
+            back().ll()->SetLlFlag(NO_CODE);
             back().invalidate();
             nodeType = FALL_NODE;
             length--;
@@ -355,7 +356,7 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
 
         nodeType = pChild->nodeType;
         length = (pChild->start - start) + pChild->length ;
-        pChild->front().ClrLlFlag(TARGET);
+        pChild->front().ll()->ClrLlFlag(TARGET);
         edges.swap(pChild->edges);
 
         pChild->inEdges.clear();

+ 27 - 24
src/hlicode.cpp

@@ -31,29 +31,29 @@ static char buf[lineSize];     /* Line buffer for hl icode output */
 void ICODE::setAsgn(COND_EXPR *lhs, COND_EXPR *rhs)
 {
     type = HIGH_LEVEL;
-    ic.hl.set(lhs,rhs);
+    hl()->set(lhs,rhs);
 
 }
 void ICODE::checkHlCall()
 {
-    //assert((ic.ll.immed.proc.cb != 0)||ic.ll.immed.proc.proc!=0);
+    //assert((ll()->immed.proc.cb != 0)||ll()->immed.proc.proc!=0);
 }
 /* Places the new HLI_CALL high-level operand in the high-level icode array */
 void ICODE::newCallHl()
 {
     type = HIGH_LEVEL;
-    ic.hl.opcode = HLI_CALL;
-    ic.hl.call.proc = ic.ll.src.proc.proc;
-    ic.hl.call.args = new STKFRAME;
-
-    if (ic.ll.src.proc.cb != 0)
-        ic.hl.call.args->cb = ic.ll.src.proc.cb;
-    else if(ic.hl.call.proc)
-        ic.hl.call.args->cb =ic.hl.call.proc->cbParam;
+    hl()->opcode = HLI_CALL;
+    hl()->call.proc = ll()->src.proc.proc;
+    hl()->call.args = new STKFRAME;
+
+    if (ll()->src.proc.cb != 0)
+        hl()->call.args->cb = ll()->src.proc.cb;
+    else if(hl()->call.proc)
+        hl()->call.args->cb =hl()->call.proc->cbParam;
     else
     {
         printf("Function with no cb set, and no valid oper.call.proc , probaby indirect call\n");
-        ic.hl.call.args->cb = 0;
+        hl()->call.args->cb = 0;
     }
 }
 
@@ -63,7 +63,7 @@ void ICODE::newCallHl()
 void ICODE::setUnary(hlIcode op, COND_EXPR *exp)
 {
     type = HIGH_LEVEL;
-    ic.hl.set(op,exp);
+    hl()->set(op,exp);
 }
 
 
@@ -71,7 +71,7 @@ void ICODE::setUnary(hlIcode op, COND_EXPR *exp)
 void ICODE::setJCond(COND_EXPR *cexp)
 {
     type = HIGH_LEVEL;
-    ic.hl.set(HLI_JCOND,cexp);
+    hl()->set(HLI_JCOND,cexp);
 }
 
 
@@ -116,7 +116,7 @@ bool ICODE::removeDefRegi (uint8_t regi, int thisDefIdx, LOCAL_ID *locId)
         invalidate();
         return true;
     }
-    HlTypeSupport *p=ic.hl.get();
+    HlTypeSupport *p=hl()->get();
     if(p and p->removeRegFromLong(regi,locId))
     {
         du1.numRegsDef--;
@@ -141,11 +141,12 @@ void Function::highLevelGen()
     {
         assert(numIcode==Icode.size());
         pIcode = i; //Icode.GetIcode(i)
-        if ((pIcode->ic.ll.flg & NOT_HLL) == NOT_HLL)
+        LLInst *ll = pIcode->ll();
+        if ( ll->isLlFlag(NOT_HLL) )
             pIcode->invalidate();
-        if ((pIcode->type == LOW_LEVEL) && (pIcode->invalid == FALSE))
+        if ((pIcode->type == LOW_LEVEL) && pIcode->valid() )
         {
-            flg = pIcode->ic.ll.flg;
+            flg = ll->GetLlFlag();
             if ((flg & IM_OPS) != IM_OPS)   /* not processing IM_OPS yet */
                 if ((flg & NO_OPS) != NO_OPS)       /* if there are opers */
                 {
@@ -154,7 +155,7 @@ void Function::highLevelGen()
                     lhs = COND_EXPR::id (*pIcode, DST, this, i, *pIcode, NONE);
                 }
 
-            switch (pIcode->ic.ll.opcode)
+            switch (ll->opcode)
             {
                 case iADD:
                     rhs = COND_EXPR::boolOp (lhs, rhs, ADD);
@@ -181,7 +182,7 @@ void Function::highLevelGen()
                 case iDIV:
                 case iIDIV:/* should be signed div */
                     rhs = COND_EXPR::boolOp (lhs, rhs, DIV);
-                    if (pIcode->ic.ll.flg & B)
+                    if ( ll->isLlFlag(B) )
                     {
                         lhs = COND_EXPR::idReg (rAL, 0, &localId);
                         pIcode->setRegDU( rAL, eDEF);
@@ -206,12 +207,14 @@ void Function::highLevelGen()
                     pIcode->setAsgn(lhs, rhs);
                     break;
 
-                case iLEA:    rhs = COND_EXPR::unary (ADDRESSOF, rhs);
+                case iLEA:
+                    rhs = COND_EXPR::unary (ADDRESSOF, rhs);
                     pIcode->setAsgn(lhs, rhs);
                     break;
 
-                case iMOD:    rhs = COND_EXPR::boolOp (lhs, rhs, MOD);
-                    if (pIcode->ic.ll.flg & B)
+                case iMOD:
+                    rhs = COND_EXPR::boolOp (lhs, rhs, MOD);
+                    if ( ll->isLlFlag(B) )
                     {
                         lhs = COND_EXPR::idReg (rAH, 0, &localId);
                         pIcode->setRegDU( rAH, eDEF);
@@ -494,8 +497,8 @@ void ICODE::writeDU(int idx)
     }
 
     /* For HLI_CALL, print # parameter bytes */
-    if (ic.hl.opcode == HLI_CALL)
-        printf ("# param bytes = %d\n", ic.hl.call.args->cb);
+    if (hl()->opcode == HLI_CALL)
+        printf ("# param bytes = %d\n", hl()->call.args->cb);
     printf ("\n");
 }
 

+ 7 - 7
src/icode.cpp

@@ -50,7 +50,7 @@ bool CIcodeRec::labelSrch(uint32_t target, uint32_t &pIndex)
 CIcodeRec::iterator CIcodeRec::labelSrch(uint32_t target)
 {
     int  i;
-    return find_if(begin(),end(),[target](ICODE &l) -> bool {return l.ic.ll.label==target;});
+    return find_if(begin(),end(),[target](ICODE &l) -> bool {return l.ll()->label==target;});
 }
 ICODE * CIcodeRec::GetIcode(int ip)
 {
@@ -68,19 +68,19 @@ extern bundle cCode;
  * is created and a goto is also emitted.
  * Note: this procedure is to be used when the label is to be backpatched
  *       onto code in cCode.code */
-void ICODE::emitGotoLabel (int indLevel)
+void LLInst::emitGotoLabel (int indLevel)
 {
-    if (! (ic.ll.flg & HLL_LABEL)) /* node hasn't got a lab */
+    if ( not isLlFlag(HLL_LABEL) ) /* node hasn't got a lab */
     {
         /* Generate new label */
-        ic.ll.hllLabNum = getNextLabel();
-        ic.ll.flg |= HLL_LABEL;
+        hllLabNum = getNextLabel();
+        SetLlFlag(HLL_LABEL);
 
         /* Node has been traversed already, so backpatch this label into
                  * the code */
-        addLabelBundle (cCode.code, codeIdx, ic.ll.hllLabNum);
+        addLabelBundle (cCode.code, codeIdx, hllLabNum);
     }
-    cCode.appendCode( "%sgoto L%ld;\n", indent(indLevel), ic.ll.hllLabNum);
+    cCode.appendCode( "%sgoto L%ld;\n", indent(indLevel), hllLabNum);
     stats.numHLIcode++;
 }
 

+ 19 - 24
src/idioms.cpp

@@ -77,7 +77,7 @@ void Function::findIdioms()
     typedef boost::filter_iterator<is_valid,iICODE> ifICODE;
     while (pIcode != pEnd)
     {
-        switch (pIcode->ic.ll.opcode)
+        switch (pIcode->ll()->opcode)
         {
             case iDEC: case iINC:
             if (i18.match(pIcode))
@@ -114,12 +114,12 @@ void Function::findIdioms()
             case iCALL:  case iCALLF:
                 /* Check for library functions that return a long register.
                          * Propagate this result */
-                if (pIcode->ic.ll.src.proc.proc != 0)
-                    if ((pIcode->ic.ll.src.proc.proc->flg & PROC_ISLIB) &&
-                        (pIcode->ic.ll.src.proc.proc->flg & PROC_IS_FUNC))
+                if (pIcode->ll()->src.proc.proc != 0)
+                    if ((pIcode->ll()->src.proc.proc->flg & PROC_ISLIB) &&
+                        (pIcode->ll()->src.proc.proc->flg & PROC_IS_FUNC))
                     {
-                        if ((pIcode->ic.ll.src.proc.proc->retVal.type==TYPE_LONG_SIGN)
-                            || (pIcode->ic.ll.src.proc.proc->retVal.type == TYPE_LONG_UNSIGN))
+                        if ((pIcode->ll()->src.proc.proc->retVal.type==TYPE_LONG_SIGN)
+                            || (pIcode->ll()->src.proc.proc->retVal.type == TYPE_LONG_UNSIGN))
                             localId.newLongReg(TYPE_LONG_SIGN, rDX, rAX, pIcode/*ip*/);
                     }
 
@@ -230,20 +230,14 @@ void Function::bindIcodeOff()
     /* Flag all jump targets for BB construction and disassembly stage 2 */
     for(ICODE &c : Icode)
         {
-        if ((c.ic.ll.flg & I) && JmpInst(c.ic.ll.opcode))
+        LLInst *ll=c.ll();
+        if (ll->isLlFlag(I) && JmpInst(ll->opcode))
         {
-            iICODE loc=Icode.labelSrch(c.ic.ll.src.op());
+            iICODE loc=Icode.labelSrch(ll->src.op());
             if (loc!=Icode.end())
-                loc->ic.ll.flg |= TARGET;
+                loc->ll()->SetLlFlag(TARGET);
         }
     }
-//    for (i = 0; i < Icode.size(); i++)
-//        if ((pIcode[i].ic.ll.flg & I) && JmpInst(pIcode[i].ic.ll.opcode))
-//        {
-//            iICODE loc=Icode.labelSrch(pIcode[i].ic.ll.src.op());
-//            if (loc!=Icode.end())
-//                loc->ic.ll.flg |= TARGET;
-//        }
 
     /* Finally bind jump targets to Icode offsets.  Jumps for which no label
      * is found (no code at dest. of jump) are simply left unlinked and
@@ -251,21 +245,22 @@ void Function::bindIcodeOff()
     //for (pIcode = Icode.begin(); pIcode!= Icode.end(); pIcode++)
     for(ICODE &icode : Icode)
         {
-        if (not JmpInst(icode.ic.ll.opcode))
+        LLInst *ll=icode.ll();
+        if (not JmpInst(ll->opcode))
             continue;
-        if (icode.ic.ll.flg & I)
+        if (ll->isLlFlag(I) )
             {
                 uint32_t found;
-            if (! Icode.labelSrch(icode.ic.ll.src.op(), found))
-                icode.ic.ll.flg |= NO_LABEL;
+            if (! Icode.labelSrch(ll->src.op(), found))
+                ll->SetLlFlag( NO_LABEL );
                 else
-                icode.ic.ll.src.SetImmediateOp(found);
+                ll->src.SetImmediateOp(found);
 
             }
-        else if (icode.ic.ll.flg & SWITCH)
+        else if (ll->isLlFlag(SWITCH) )
             {
-            p = icode.ic.ll.caseTbl.entries;
-            for (int j = 0; j < icode.ic.ll.caseTbl.numEntries; j++, p++)
+            p = ll->caseTbl.entries;
+            for (int j = 0; j < ll->caseTbl.numEntries; j++, p++)
                     Icode.labelSrch(*p, *p);
             }
         }

+ 43 - 43
src/idioms/arith_idioms.cpp

@@ -18,7 +18,7 @@ bool Idiom5::match(iICODE pIcode)
         return false;
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
-    if (m_icodes[1]->ic.ll.match(iADC))
+    if (m_icodes[1]->ll()->match(iADC))
         return true;
     return false;
 }
@@ -51,7 +51,7 @@ bool Idiom6::match(iICODE pIcode)
         return false;
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
-    if (m_icodes[1]->ic.ll.match(iSBB))
+    if (m_icodes[1]->ll()->match(iSBB))
         return true;
     return false;
 }
@@ -93,24 +93,24 @@ bool Idiom18::match(iICODE picode)
     for(int i=0; i<4; ++i)
         m_icodes[i] =picode++;
 
-    m_is_dec = m_icodes[1]->ic.ll.match(iDEC);
+    m_is_dec = m_icodes[1]->ll()->match(iDEC);
     int type = -1;	/* type of variable: 1 = reg-var, 2 = local */
     uint8_t regi;		/* register of the MOV */
 
     /* Get variable */
-    if (m_icodes[1]->ic.ll.dst.regi == 0)	/* global variable */
+    if (m_icodes[1]->ll()->dst.regi == 0)	/* global variable */
     {
         /* not supported yet */
         type = 0;
     }
-    else if (m_icodes[1]->ic.ll.dst.regi < INDEXBASE)	/* register */
+    else if (m_icodes[1]->ll()->dst.regi < INDEXBASE)	/* register */
     {
-        if ((m_icodes[1]->ic.ll.dst.regi == rSI) && (m_func->flg & SI_REGVAR))
+        if ((m_icodes[1]->ll()->dst.regi == rSI) && (m_func->flg & SI_REGVAR))
             type = 1;
-        else if ((m_icodes[1]->ic.ll.dst.regi == rDI) && (m_func->flg & DI_REGVAR))
+        else if ((m_icodes[1]->ll()->dst.regi == rDI) && (m_func->flg & DI_REGVAR))
             type = 1;
     }
-    else if (m_icodes[1]->ic.ll.dst.off)		/* local variable */
+    else if (m_icodes[1]->ll()->dst.off)		/* local variable */
         type = 2;
     else		/* indexed */
     {
@@ -126,25 +126,25 @@ bool Idiom18::match(iICODE picode)
         break;
     case 1:  /* register variable */
         /* Check previous instruction for a MOV */
-        if (m_icodes[0]->ic.ll.match(iMOV) && (m_icodes[0]->ic.ll.src.regi == m_icodes[1]->ic.ll.dst.regi))
+        if (m_icodes[0]->ll()->match(iMOV) && (m_icodes[0]->ll()->src.regi == m_icodes[1]->ll()->dst.regi))
         {
-            regi = m_icodes[0]->ic.ll.dst.regi;
+            regi = m_icodes[0]->ll()->dst.regi;
             if ((regi > 0) && (regi < INDEXBASE))
             {
-                if ( m_icodes[2]->ic.ll.match(iCMP) && (m_icodes[2]->ic.ll.dst.regi == regi) &&
-                     m_icodes[3]->ic.ll.conditionalJump() )
+                if ( m_icodes[2]->ll()->match(iCMP) && (m_icodes[2]->ll()->dst.regi == regi) &&
+                     m_icodes[3]->ll()->conditionalJump() )
                     return true;
             }
         }
         break;
     case 2: /* local */
-        if (m_icodes[0]->ic.ll.match(iMOV) && (m_icodes[0]->ic.ll.src.off == m_icodes[1]->ic.ll.dst.off))
+        if (m_icodes[0]->ll()->match(iMOV) && (m_icodes[0]->ll()->src.off == m_icodes[1]->ll()->dst.off))
         {
-            regi = m_icodes[0]->ic.ll.dst.regi;
+            regi = m_icodes[0]->ll()->dst.regi;
             if ((regi > 0) && (regi < INDEXBASE))
             {
-                if ( m_icodes[2]->ic.ll.match(iCMP) && (m_icodes[2]->ic.ll.dst.regi == regi) &&
-                     m_icodes[3]->ic.ll.conditionalJump() )
+                if ( m_icodes[2]->ll()->match(iCMP) && (m_icodes[2]->ll()->dst.regi == regi) &&
+                     m_icodes[3]->ll()->conditionalJump() )
                     return true;
             }
         }
@@ -163,7 +163,7 @@ int Idiom18::action() // action length
     lhs     = COND_EXPR::id (*m_icodes[0], SRC, m_func, m_icodes[1], *m_icodes[1], eUSE);
     lhs     = COND_EXPR::unary ( m_is_dec ? POST_DEC : POST_INC, lhs);
     rhs     = COND_EXPR::id (*m_icodes[2], SRC, m_func, m_icodes[1], *m_icodes[3], eUSE);
-    expr    = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[3]->ic.ll.opcode - iJB]);
+    expr    = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[3]->ll()->opcode - iJB]);
     m_icodes[3]->setJCond(expr);
 
     m_icodes[0]->invalidate();
@@ -189,19 +189,19 @@ bool Idiom19::match(iICODE picode)
 
     for(int i=0; i<2; ++i)
         m_icodes[i] =picode++;
-    m_is_dec = m_icodes[0]->ic.ll.match(iDEC);
-    if (m_icodes[0]->ic.ll.dst.regi == 0)	/* global variable */
+    m_is_dec = m_icodes[0]->ll()->match(iDEC);
+    if (m_icodes[0]->ll()->dst.regi == 0)	/* global variable */
         /* not supported yet */ ;
-    else if (m_icodes[0]->ic.ll.dst.regi < INDEXBASE) /* register */
+    else if (m_icodes[0]->ll()->dst.regi < INDEXBASE) /* register */
     {
-        //        if (((picode->ic.ll.dst.regi == rSI) && (pproc->flg & SI_REGVAR)) ||
-        //            ((picode->ic.ll.dst.regi == rDI) && (pproc->flg & DI_REGVAR)))
-        if (m_icodes[1]->ic.ll.conditionalJump())
+        //        if (((picode->ll()->dst.regi == rSI) && (pproc->flg & SI_REGVAR)) ||
+        //            ((picode->ll()->dst.regi == rDI) && (pproc->flg & DI_REGVAR)))
+        if (m_icodes[1]->ll()->conditionalJump())
             return true;
     }
-    else if (m_icodes[0]->ic.ll.dst.off)		/* stack variable */
+    else if (m_icodes[0]->ll()->dst.off)		/* stack variable */
     {
-        if ( m_icodes[1]->ic.ll.conditionalJump() )
+        if ( m_icodes[1]->ll()->conditionalJump() )
             return true;
     }
     else	/* indexed */
@@ -214,7 +214,7 @@ int Idiom19::action()
     lhs = COND_EXPR::id (*m_icodes[1], DST, m_func, m_icodes[0], *m_icodes[1], eUSE);
     lhs = COND_EXPR::unary (m_is_dec ? PRE_DEC : PRE_INC, lhs);
     rhs = COND_EXPR::idKte (0, 2);
-    expr = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[1]->ic.ll.opcode - iJB]);
+    expr = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[1]->ll()->opcode - iJB]);
     m_icodes[1]->setJCond(expr);
     m_icodes[0]->invalidate();
     return 2;
@@ -244,21 +244,21 @@ bool Idiom20::match(iICODE picode)
     for(int i=0; i<4; ++i)
         m_icodes[i] =picode++;
 
-    m_is_dec = m_icodes[0]->ic.ll.match(iDEC);
+    m_is_dec = m_icodes[0]->ll()->match(iDEC);
 
     /* Get variable */
-    if (m_icodes[0]->ic.ll.dst.regi == 0)	/* global variable */
+    if (m_icodes[0]->ll()->dst.regi == 0)	/* global variable */
     {
         /* not supported yet */ ;
     }
-    else if (m_icodes[0]->ic.ll.dst.regi < INDEXBASE)	/* register */
+    else if (m_icodes[0]->ll()->dst.regi < INDEXBASE)	/* register */
     {
-        if ((m_icodes[0]->ic.ll.dst.regi == rSI) && (m_func->flg & SI_REGVAR))
+        if ((m_icodes[0]->ll()->dst.regi == rSI) && (m_func->flg & SI_REGVAR))
             type = 1;
-        else if ((m_icodes[0]->ic.ll.dst.regi == rDI) && (m_func->flg & DI_REGVAR))
+        else if ((m_icodes[0]->ll()->dst.regi == rDI) && (m_func->flg & DI_REGVAR))
             type = 1;
     }
-    else if (m_icodes[0]->ic.ll.dst.off)		/* local variable */
+    else if (m_icodes[0]->ll()->dst.off)		/* local variable */
         type = 2;
     else		/* indexed */
     {
@@ -269,28 +269,28 @@ bool Idiom20::match(iICODE picode)
     /* Check previous instruction for a MOV */
     if (type == 1)			/* register variable */
     {
-        if (m_icodes[1]->ic.ll.match(iMOV) &&
-                (m_icodes[1]->ic.ll.src.regi == m_icodes[0]->ic.ll.dst.regi))
+        if (m_icodes[1]->ll()->match(iMOV) &&
+                (m_icodes[1]->ll()->src.regi == m_icodes[0]->ll()->dst.regi))
         {
-            regi = m_icodes[1]->ic.ll.dst.regi;
+            regi = m_icodes[1]->ll()->dst.regi;
             if ((regi > 0) && (regi < INDEXBASE))
             {
-                if (m_icodes[2]->ic.ll.match(iCMP,(eReg)regi) &&
-                        m_icodes[3]->ic.ll.conditionalJump())
+                if (m_icodes[2]->ll()->match(iCMP,(eReg)regi) &&
+                        m_icodes[3]->ll()->conditionalJump())
                     return true;
             }
         }
     }
     else if (type == 2)		/* local */
     {
-        if ( m_icodes[0]->ic.ll.match(iMOV) &&
-             (m_icodes[1]->ic.ll.src.off == m_icodes[0]->ic.ll.dst.off))
+        if ( m_icodes[0]->ll()->match(iMOV) &&
+             (m_icodes[1]->ll()->src.off == m_icodes[0]->ll()->dst.off))
         {
-            regi = m_icodes[1]->ic.ll.dst.regi;
+            regi = m_icodes[1]->ll()->dst.regi;
             if ((regi > 0) && (regi < INDEXBASE))
             {
-                if (m_icodes[2]->ic.ll.match(iCMP,(eReg)regi) &&
-                        m_icodes[3]->ic.ll.conditionalJump())
+                if (m_icodes[2]->ll()->match(iCMP,(eReg)regi) &&
+                        m_icodes[3]->ll()->conditionalJump())
                     return true;
             }
         }
@@ -303,7 +303,7 @@ int Idiom20::action()
     lhs  = COND_EXPR::id (*m_icodes[1], SRC, m_func, m_icodes[0], *m_icodes[0], eUSE);
     lhs  = COND_EXPR::unary (m_is_dec ? PRE_DEC : PRE_INC, lhs);
     rhs  = COND_EXPR::id (*m_icodes[2], SRC, m_func, m_icodes[0], *m_icodes[3], eUSE);
-    expr = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[3]->ic.ll.opcode - iJB]);
+    expr = COND_EXPR::boolOp (lhs, rhs, condOpJCond[m_icodes[3]->ll()->opcode - iJB]);
     m_icodes[3]->setJCond(expr);
     for(int i=0; i<3; ++i)
         m_icodes[i]->invalidate();

+ 16 - 16
src/idioms/call_idioms.cpp

@@ -22,25 +22,25 @@ bool Idiom3::match(iICODE picode)
     /* Match ADD  SP, immed */
     for(int i=0; i<2; ++i)
         m_icodes[i] = picode++;
-    if ( (m_icodes[1]->ic.ll.flg & I) && m_icodes[1]->ic.ll.match(iADD,rSP))
+    if ( m_icodes[1]->ll()->isLlFlag(I) && m_icodes[1]->ll()->match(iADD,rSP))
     {
-        m_param_count = m_icodes[1]->ic.ll.src.op();
+        m_param_count = m_icodes[1]->ll()->src.op();
         return true;
     }
-    else if (m_icodes[1]->ic.ll.match(iMOV,rSP,rBP))
+    else if (m_icodes[1]->ll()->match(iMOV,rSP,rBP))
     {
-        m_icodes[0]->ic.ll.flg |= REST_STK;
+        m_icodes[0]->ll()->SetLlFlag(REST_STK);
         return true;
     }
     return 0;
 }
 int Idiom3::action()
 {
-    if (m_icodes[0]->ic.ll.flg & I)
+    if (m_icodes[0]->ll()->isLlFlag(I) )
     {
-        m_icodes[0]->ic.ll.src.proc.proc->cbParam = (int16_t)m_param_count;
-        m_icodes[0]->ic.ll.src.proc.cb = m_param_count;
-        m_icodes[0]->ic.ll.src.proc.proc->flg |= CALL_C;
+        m_icodes[0]->ll()->src.proc.proc->cbParam = (int16_t)m_param_count;
+        m_icodes[0]->ll()->src.proc.cb = m_param_count;
+        m_icodes[0]->ll()->src.proc.proc->flg |= CALL_C;
     }
     else
     {
@@ -76,16 +76,16 @@ bool Idiom17::match(iICODE picode)
     uint8_t regi;
 
     /* Match POP reg */
-    if (m_icodes[1]->ic.ll.match(iPOP))
+    if (m_icodes[1]->ll()->match(iPOP))
     {
         int i=0;
-        regi = m_icodes[1]->ic.ll.dst.regi;
+        regi = m_icodes[1]->ll()->dst.regi;
         if ((regi >= rAX) && (regi <= rBX))
             i++;
 
-        while (picode != m_end && picode->ic.ll.match(iPOP))
+        while (picode != m_end && picode->ll()->match(iPOP))
         {
-            if (picode->ic.ll.dst.regi != regi)
+            if (picode->ll()->dst.regi != regi)
                 break;
             i++;
             m_icodes.push_back(picode++);
@@ -96,11 +96,11 @@ bool Idiom17::match(iICODE picode)
 }
 int Idiom17::action()
 {
-    if (m_icodes[0]->isLlFlag(I))
+    if (m_icodes[0]->ll()->isLlFlag(I))
     {
-        m_icodes[0]->ic.ll.src.proc.proc->cbParam = (int16_t)m_param_count;
-        m_icodes[0]->ic.ll.src.proc.cb = m_param_count;
-        m_icodes[0]->ic.ll.src.proc.proc->flg |= CALL_C;
+        m_icodes[0]->ll()->src.proc.proc->cbParam = (int16_t)m_param_count;
+        m_icodes[0]->ll()->src.proc.cb = m_param_count;
+        m_icodes[0]->ll()->src.proc.proc->flg |= CALL_C;
         for(int idx=1; idx<m_icodes.size(); ++idx)
         {
             m_icodes[idx]->invalidate();

+ 14 - 14
src/idioms/epilogue_idioms.cpp

@@ -12,22 +12,22 @@ void EpilogIdiom::popStkVars(iICODE pIcode)
 {
     // TODO : only process SI-DI DI-SI pairings, no SI-SI, DI-DI like it's now
     /* Match [POP DI] */
-    if (pIcode->ic.ll.match(iPOP))
+    if (pIcode->ll()->match(iPOP))
     {
-        if ((m_func->flg & DI_REGVAR) && pIcode->ic.ll.match(rDI))
+        if ((m_func->flg & DI_REGVAR) && pIcode->ll()->match(rDI))
             m_icodes.push_front(pIcode);
-        else if ((m_func->flg & SI_REGVAR) && pIcode->ic.ll.match(rSI))
+        else if ((m_func->flg & SI_REGVAR) && pIcode->ll()->match(rSI))
             m_icodes.push_front(pIcode);
     }
     ++pIcode;
     if(pIcode==m_end)
         return;
     /* Match [POP SI] */
-    if (pIcode->ic.ll.match(iPOP))
+    if (pIcode->ll()->match(iPOP))
     {
-        if ((m_func->flg & SI_REGVAR) && pIcode->ic.ll.match(rSI))
+        if ((m_func->flg & SI_REGVAR) && pIcode->ll()->match(rSI))
             m_icodes.push_front(pIcode);
-        else if ((m_func->flg & DI_REGVAR) && pIcode->ic.ll.match(rDI))
+        else if ((m_func->flg & DI_REGVAR) && pIcode->ll()->match(rDI))
             m_icodes.push_front(pIcode);
     }
 }
@@ -46,7 +46,7 @@ bool Idiom2::match(iICODE pIcode)
     iICODE nicode;
     if(pIcode==m_func->Icode.begin()) // pIcode->loc_ip == 0
         return false;
-    if ( ((pIcode->ic.ll.flg & I) == I) || not pIcode->ic.ll.match(rSP,rBP))
+    if ( pIcode->ll()->isLlFlag(I) || (not pIcode->ll()->match(rSP,rBP)) )
         return false;
     if(distance(pIcode,m_end)<3)
         return false;
@@ -55,21 +55,21 @@ bool Idiom2::match(iICODE pIcode)
     m_icodes.push_back(pIcode);
     /* Get next icode, skip over holes in the icode array */
     nicode = ++iICODE(pIcode);
-    while (nicode->ic.ll.flg & NO_CODE && (nicode != m_end))
+    while (nicode->ll()->isLlFlag(NO_CODE) && (nicode != m_end))
     {
         nicode++;
     }
     if(nicode == m_end)
         return false;
 
-    if (nicode->ic.ll.match(iPOP,rBP) && ! (nicode->ic.ll.flg & (I | TARGET | CASE)) )
+    if (nicode->ll()->match(iPOP,rBP) && ! (nicode->ll()->isLlFlag(I | TARGET | CASE)) )
     {
         m_icodes.push_back(nicode++); // Matched POP BP
 
         /* Match RET(F) */
         if (    nicode != m_end &&
-                !(nicode->ic.ll.flg & (I | TARGET | CASE)) &&
-                (nicode->ic.ll.match(iRET) || nicode->ic.ll.match(iRETF))
+                !(nicode->ll()->isLlFlag(I | TARGET | CASE)) &&
+                (nicode->ll()->match(iRET) || nicode->ll()->match(iRETF))
                 )
         {
             m_icodes.push_back(nicode); // Matched RET
@@ -118,7 +118,7 @@ bool Idiom4::match(iICODE pIcode)
     {
         iICODE prev1 = --iICODE(pIcode);
         /* Check for POP BP */
-        if (prev1->ic.ll.match(iPOP,rBP) && not prev1->ic.ll.anyFlagSet(I) )
+        if (prev1->ll()->match(iPOP,rBP) && not prev1->ll()->isLlFlag(I) )
             m_icodes.push_back(prev1);
         else if(prev1!=m_func->Icode.begin())
         {
@@ -129,9 +129,9 @@ bool Idiom4::match(iICODE pIcode)
     }
 
     /* Check for RET(F) immed */
-    if (pIcode->ic.ll.flg & I)
+    if (pIcode->ll()->isLlFlag(I) )
     {
-        m_param_count = (int16_t)pIcode->ic.ll.src.op();
+        m_param_count = (int16_t)pIcode->ll()->src.op();
     }
 }
 int Idiom4::action()

+ 9 - 9
src/idioms/idiom1.cpp

@@ -15,18 +15,18 @@ int Idiom1::checkStkVars (iICODE pIcode)
     int di_matched=0;
     if(pIcode==m_end)
         return 0;
-    if (pIcode->ic.ll.match(iPUSH,rSI))
+    if (pIcode->ll()->match(iPUSH,rSI))
     {
         si_matched = 1;
         ++pIcode;
-        if ((pIcode != m_end) && pIcode->ic.ll.match(iPUSH,rDI)) // Look for PUSH DI
+        if ((pIcode != m_end) && pIcode->ll()->match(iPUSH,rDI)) // Look for PUSH DI
             di_matched = 1;
     }
-    else if (pIcode->ic.ll.match(iPUSH,rDI))
+    else if (pIcode->ll()->match(iPUSH,rDI))
     {
         di_matched = 1;
         ++pIcode;
-        if ((pIcode != m_end) && pIcode->ic.ll.match(iPUSH,rSI)) // Look for PUSH SI
+        if ((pIcode != m_end) && pIcode->ll()->match(iPUSH,rSI)) // Look for PUSH SI
             si_matched = 1;
     }
     m_func->flg |= (si_matched ? SI_REGVAR : 0) | (di_matched ? DI_REGVAR : 0);
@@ -60,13 +60,13 @@ bool Idiom1::match(iICODE picode)
     m_icodes.clear();
     m_min_off = 0;
     /* PUSH BP as first instruction of procedure */
-    if ( !(picode->ic.ll.flg & I) && picode->ic.ll.src.regi == rBP)
+    if ( (not picode->ll()->isLlFlag(I)) && picode->ll()->src.regi == rBP)
     {
         m_icodes.push_back( picode++ ); // insert iPUSH
         if(picode==m_end)
             return false;
         /* MOV BP, SP as next instruction */
-        if ( !picode->ic.ll.anyFlagSet(I | TARGET | CASE) && picode->ic.ll.match(iMOV ,rBP,rSP) )
+        if ( !picode->ll()->isLlFlag(I | TARGET | CASE) && picode->ll()->match(iMOV ,rBP,rSP) )
         {
             m_icodes.push_back( picode++ ); // insert iMOV
             if(picode==m_end)
@@ -75,7 +75,7 @@ bool Idiom1::match(iICODE picode)
 
             /* Look for SUB SP, immed */
             if (
-                picode->ic.ll.anyFlagSet(I | TARGET | CASE) && picode->ic.ll.match(iSUB,rSP)
+                picode->ll()->isLlFlag(I | TARGET | CASE) && picode->ll()->match(iSUB,rSP)
                 )
             {
                 m_icodes.push_back( picode++ ); // insert iSUB
@@ -99,8 +99,8 @@ bool Idiom1::match(iICODE picode)
                     return false;
                 /* Look for MOV BP, SP */
                 if ( picode != m_end &&
-                    !picode->ic.ll.anyFlagSet(I | TARGET | CASE) &&
-                     picode->ic.ll.match(iMOV,rBP,rSP))
+                    !picode->ll()->isLlFlag(I | TARGET | CASE) &&
+                     picode->ll()->match(iMOV,rBP,rSP))
                 {
                     m_icodes.push_back(picode);
                     m_min_off = 2 + (n * 2);

+ 9 - 9
src/idioms/mov_idioms.cpp

@@ -28,14 +28,14 @@ bool Idiom14::match(iICODE pIcode)
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
     /* Check for regL */
-    m_regL = m_icodes[0]->ic.ll.dst.regi;
-    if (not m_icodes[0]->isLlFlag(I) && ((m_regL == rAX) || (m_regL ==rBX)))
+    m_regL = m_icodes[0]->ll()->dst.regi;
+    if (not m_icodes[0]->ll()->isLlFlag(I) && ((m_regL == rAX) || (m_regL ==rBX)))
     {
         /* Check for XOR regH, regH */
-        if (m_icodes[1]->ic.ll.match(iXOR) && not m_icodes[1]->isLlFlag(I))
+        if (m_icodes[1]->ll()->match(iXOR) && not m_icodes[1]->ll()->isLlFlag(I))
         {
-            m_regH = m_icodes[1]->ic.ll.dst.regi;
-            if (m_regH == m_icodes[1]->ic.ll.src.regi)
+            m_regH = m_icodes[1]->ll()->dst.regi;
+            if (m_regH == m_icodes[1]->ll()->src.regi)
             {
                 if ((m_regL == rAX) && (m_regH == rDX))
                     return true;
@@ -80,13 +80,13 @@ bool Idiom13::match(iICODE pIcode)
     uint8_t regi;
 
     /* Check for regL */
-    regi = m_icodes[0]->ic.ll.dst.regi;
-    if (not m_icodes[0]->isLlFlag(I) && (regi >= rAL) && (regi <= rBH))
+    regi = m_icodes[0]->ll()->dst.regi;
+    if (not m_icodes[0]->ll()->isLlFlag(I) && (regi >= rAL) && (regi <= rBH))
     {
         /* Check for MOV regH, 0 */
-        if (m_icodes[1]->ic.ll.match(iMOV) && m_icodes[1]->isLlFlag(I) && (m_icodes[1]->ic.ll.src.op() == 0))
+        if (m_icodes[1]->ll()->match(iMOV) && m_icodes[1]->ll()->isLlFlag(I) && (m_icodes[1]->ll()->src.op() == 0))
         {
-            if (m_icodes[1]->ic.ll.dst.regi == (regi + 4)) //TODO: based on distance between AH-AL,BH-BL etc.
+            if (m_icodes[1]->ll()->dst.regi == (regi + 4)) //TODO: based on distance between AH-AL,BH-BL etc.
             {
                 m_loaded_reg=(regi - rAL + rAX);
                 return true;

+ 11 - 11
src/idioms/neg_idioms.cpp

@@ -27,22 +27,22 @@ bool Idiom11::match (iICODE picode)
         return false;
     /* Check NEG reg/mem
      *       SBB reg/mem, 0*/
-    if (not m_icodes[1]->ic.ll.match(iNEG) or not m_icodes[2]->ic.ll.match(iSBB))
+    if (not m_icodes[1]->ll()->match(iNEG) or not m_icodes[2]->ll()->match(iSBB))
         return false;
     switch (type)
     {
     case GLOB_VAR:
-        if ((m_icodes[2]->ic.ll.dst.segValue == m_icodes[0]->ic.ll.dst.segValue) &&
-                (m_icodes[2]->ic.ll.dst.off == m_icodes[0]->ic.ll.dst.off))
+        if ((m_icodes[2]->ll()->dst.segValue == m_icodes[0]->ll()->dst.segValue) &&
+                (m_icodes[2]->ll()->dst.off == m_icodes[0]->ll()->dst.off))
             return true;
         break;
     case REGISTER:
-        if (m_icodes[2]->ic.ll.dst.regi == m_icodes[0]->ic.ll.dst.regi)
+        if (m_icodes[2]->ll()->dst.regi == m_icodes[0]->ll()->dst.regi)
             return true;
         break;
     case PARAM:
     case LOCAL_VAR:
-        if (m_icodes[2]->ic.ll.dst.off == m_icodes[0]->ic.ll.dst.off)
+        if (m_icodes[2]->ll()->dst.off == m_icodes[0]->ll()->dst.off)
             return true;
         break;
     }
@@ -79,13 +79,13 @@ bool Idiom16::match (iICODE picode)
     for(int i=0; i<3; ++i)
         m_icodes[i]=picode++;
 
-    uint8_t regi = m_icodes[0]->ic.ll.dst.regi;
+    uint8_t regi = m_icodes[0]->ll()->dst.regi;
     if ((regi >= rAX) && (regi < INDEXBASE))
     {
-        if (m_icodes[1]->ic.ll.match(iSBB) && m_icodes[2]->ic.ll.match(iINC))
-            if ((m_icodes[1]->ic.ll.dst.regi == (m_icodes[1]->ic.ll.src.regi)) &&
-                    m_icodes[1]->ic.ll.match((eReg)regi) &&
-                    m_icodes[2]->ic.ll.match((eReg)regi))
+        if (m_icodes[1]->ll()->match(iSBB) && m_icodes[2]->ll()->match(iINC))
+            if ((m_icodes[1]->ll()->dst.regi == (m_icodes[1]->ll()->src.regi)) &&
+                    m_icodes[1]->ll()->match((eReg)regi) &&
+                    m_icodes[2]->ll()->match((eReg)regi))
                 return true;
     }
     return false;
@@ -93,7 +93,7 @@ bool Idiom16::match (iICODE picode)
 int Idiom16::action()
 {
     COND_EXPR *lhs,*rhs;
-    lhs = COND_EXPR::idReg (m_icodes[0]->ic.ll.dst.regi, m_icodes[0]->ic.ll.flg,&m_func->localId);
+    lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi, m_icodes[0]->ll()->GetLlFlag(),&m_func->localId);
     rhs = COND_EXPR::unary (NEGATION, lhs->clone());
     m_icodes[0]->setAsgn(lhs, rhs);
     m_icodes[1]->invalidate();

+ 20 - 24
src/idioms/shift_idioms.cpp

@@ -18,10 +18,9 @@ bool Idiom8::match(iICODE pIcode)
         return false;
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
-    if (m_icodes[0]->isLlFlag(I) && (m_icodes[0]->ic.ll.src.op() == 1))
-        if (m_icodes[1]->ic.ll.match(iRCR) &&
-            m_icodes[1]->isLlFlag(I) &&
-            (m_icodes[1]->ic.ll.src.op() == 1))
+    if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
+        if ( m_icodes[1]->ll()->match(iRCR,I) &&
+            (m_icodes[1]->ll()->src.op() == 1))
             return true;
     return false;
 }
@@ -31,8 +30,8 @@ int Idiom8::action()
     int idx;
     COND_EXPR *rhs,*lhs,*expr;
     uint8_t regH,regL;
-    regH=m_icodes[0]->ic.ll.dst.regi;
-    regL=m_icodes[1]->ic.ll.dst.regi;
+    regH=m_icodes[0]->ll()->dst.regi;
+    regL=m_icodes[1]->ll()->dst.regi;
     idx = m_func->localId.newLongReg (TYPE_LONG_SIGN, regH, regL, m_icodes[0]);
     lhs = COND_EXPR::idLongIdx (idx);
     m_icodes[0]->setRegDU( regL, USE_DEF);
@@ -64,15 +63,14 @@ bool Idiom15::match(iICODE pIcode)
     if(distance(pIcode,m_end)<2)
         return false;
     /* Match SHL reg, 1 */
-    if (not pIcode->isLlFlag(I) or (pIcode->ic.ll.src.op() != 1))
+    if (not pIcode->ll()->isLlFlag(I) or (pIcode->ll()->src.op() != 1))
         return false;
     m_icodes.clear();
-    regi = pIcode->ic.ll.dst.regi;
+    regi = pIcode->ll()->dst.regi;
     m_icodes.push_back(pIcode++);
     while(  (pIcode!=m_end) and
-            pIcode->ic.ll.match(iSHL,(eReg)regi) and
-            pIcode->isLlFlag(I) and
-            (pIcode->ic.ll.src.op() == 1) )
+            pIcode->ll()->match(iSHL,(eReg)regi,I) and
+            (pIcode->ll()->src.op() == 1) )
     {
         n++;
         m_icodes.push_back(pIcode++);
@@ -83,9 +81,9 @@ bool Idiom15::match(iICODE pIcode)
 int Idiom15::action()
 {
     COND_EXPR *lhs,*rhs,*exp;
-    lhs = COND_EXPR::idReg (m_icodes[0]->ic.ll.dst.regi,
-                            m_icodes[0]->ic.ll.flg & NO_SRC_B,
-                            &m_func->localId);
+    lhs = COND_EXPR::idReg (m_icodes[0]->ll()->dst.regi,
+                            m_icodes[0]->ll()->GetLlFlag() & NO_SRC_B,
+                             &m_func->localId);
     rhs = COND_EXPR::idKte (m_icodes.size(), 2);
     exp = COND_EXPR::boolOp (lhs, rhs, SHL);
     m_icodes[0]->setAsgn(lhs, exp);
@@ -111,9 +109,8 @@ bool Idiom12::match(iICODE pIcode)
         return false;
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
-    if (m_icodes[0]->isLlFlag(I) && (m_icodes[0]->ic.ll.src.op() == 1))
-        if (m_icodes[1]->ic.ll.match(iRCL) &&
-                m_icodes[1]->isLlFlag(I) && (m_icodes[1]->ic.ll.src.op() == 1))
+    if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
+        if (m_icodes[1]->ll()->match(iRCL,I) && (m_icodes[1]->ll()->src.op() == 1))
             return true;
     return false;
 }
@@ -123,8 +120,8 @@ int Idiom12::action()
     int idx;
     COND_EXPR *rhs,*lhs,*expr;
     uint8_t regH,regL;
-    regL=m_icodes[0]->ic.ll.dst.regi;
-    regH=m_icodes[1]->ic.ll.dst.regi;
+    regL=m_icodes[0]->ll()->dst.regi;
+    regH=m_icodes[1]->ll()->dst.regi;
 
     idx = m_func->localId.newLongReg (TYPE_LONG_UNSIGN, regH, regL,m_icodes[0]);
     lhs = COND_EXPR::idLongIdx (idx);
@@ -151,9 +148,8 @@ bool Idiom9::match(iICODE pIcode)
         return false;
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
-    if (m_icodes[0]->isLlFlag(I) && (m_icodes[0]->ic.ll.src.op() == 1))
-        if (m_icodes[1]->ic.ll.match(iRCR) &&
-                m_icodes[1]->isLlFlag(I) && (m_icodes[1]->ic.ll.src.op() == 1))
+    if (m_icodes[0]->ll()->isLlFlag(I) && (m_icodes[0]->ll()->src.op() == 1))
+        if (m_icodes[1]->ll()->match(iRCR,I) && (m_icodes[1]->ll()->src.op() == 1))
             return true;
     return false;
 }
@@ -163,8 +159,8 @@ int Idiom9::action()
     int idx;
     COND_EXPR *rhs,*lhs,*expr;
     uint8_t regH,regL;
-    regL=m_icodes[1]->ic.ll.dst.regi;
-    regH=m_icodes[0]->ic.ll.dst.regi;
+    regL=m_icodes[1]->ll()->dst.regi;
+    regH=m_icodes[0]->ll()->dst.regi;
     idx = m_func->localId.newLongReg (TYPE_LONG_UNSIGN,regH,regL,m_icodes[0]);
     lhs = COND_EXPR::idLongIdx (idx);
     m_icodes[0]->setRegDU(regL, USE_DEF);

+ 17 - 17
src/idioms/xor_idioms.cpp

@@ -23,16 +23,16 @@ bool Idiom21::match (iICODE picode)
     m_icodes[0]=picode++;
     m_icodes[1]=picode++;
 
-    if (not m_icodes[1]->isLlFlag(I))
+    if (not m_icodes[1]->ll()->isLlFlag(I))
         return false;
 
-    dst = &m_icodes[0]->ic.ll.dst;
-    src = &m_icodes[0]->ic.ll.src;
+    dst = &m_icodes[0]->ll()->dst;
+    src = &m_icodes[0]->ll()->src;
     if ((dst->regi == src->regi) && (dst->regi > 0) && (dst->regi < INDEXBASE))
     {
-        if ((dst->regi == rDX) && m_icodes[1]->ic.ll.match(rAX))
+        if ((dst->regi == rDX) && m_icodes[1]->ll()->match(rAX))
             return true;
-        if ((dst->regi == rCX) && m_icodes[1]->ic.ll.match(rBX))
+        if ((dst->regi == rCX) && m_icodes[1]->ll()->match(rBX))
             return true;
     }
     return false;
@@ -41,7 +41,7 @@ int Idiom21::action()
 {
     COND_EXPR *lhs,*rhs;
     lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, 1);
-    rhs = COND_EXPR::idKte (m_icodes[1]->ic.ll.src.op() , 4);
+    rhs = COND_EXPR::idKte (m_icodes[1]->ll()->src.op() , 4);
     m_icodes[0]->setAsgn(lhs, rhs);
     m_icodes[0]->du.use = 0;		/* clear register used in iXOR */
     m_icodes[1]->invalidate();
@@ -61,8 +61,8 @@ bool Idiom7::match(iICODE picode)
         return false;
     LLOperand *dst, *src;
     m_icode=picode;
-    dst = &picode->ic.ll.dst;
-    src = &picode->ic.ll.src;
+    dst = &picode->ll()->dst;
+    src = &picode->ll()->src;
     if (dst->regi == 0)                 /* global variable */
     {
         if ((dst->segValue == src->segValue) && (dst->off == src->off))
@@ -87,7 +87,7 @@ int Idiom7::action()
     rhs = COND_EXPR::idKte (0, 2);
     m_icode->setAsgn(lhs, rhs);
     m_icode->du.use = 0;    /* clear register used in iXOR */
-    m_icode->ic.ll.flg |= I;
+    m_icode->ll()->SetLlFlag(I);
     return 1;
 }
 
@@ -113,11 +113,11 @@ bool Idiom10::match(iICODE pIcode)
     m_icodes[0]=pIcode++;
     m_icodes[1]=pIcode++;
     /* Check OR reg, reg */
-    if (not m_icodes[0]->isLlFlag(I)  &&
-            (m_icodes[0]->ic.ll.src.regi > 0) &&
-            (m_icodes[0]->ic.ll.src.regi < INDEXBASE) &&
-            (m_icodes[0]->ic.ll.src.regi == m_icodes[0]->ic.ll.dst.regi))
-        if (m_icodes[1]->ic.ll.match(iJNE)) //.conditionalJump()
+    if (not m_icodes[0]->ll()->isLlFlag(I)  &&
+            (m_icodes[0]->ll()->src.regi > 0) &&
+            (m_icodes[0]->ll()->src.regi < INDEXBASE) &&
+            (m_icodes[0]->ll()->src.regi == m_icodes[0]->ll()->dst.regi))
+        if (m_icodes[1]->ll()->match(iJNE)) //.conditionalJump()
         {
             return true;
         }
@@ -126,9 +126,9 @@ bool Idiom10::match(iICODE pIcode)
 
 int Idiom10::action()
 {
-    m_icodes[0]->ic.ll.opcode = iCMP;
-    m_icodes[0]->ic.ll.flg |= I;
-    m_icodes[0]->ic.ll.src.SetImmediateOp(0); // todo check if proc should be zeroed too
+    m_icodes[0]->ll()->opcode = iCMP;
+    m_icodes[0]->ll()->SetLlFlag(I);
+      m_icodes[0]->ll()->src.SetImmediateOp(0); // todo check if proc should be zeroed too
     m_icodes[0]->du.def = 0;
     m_icodes[0]->du1.numRegsDef = 0;
     return 2;

+ 14 - 14
src/locident.cpp

@@ -273,13 +273,13 @@ int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, i
 
     if (f == LOW_FIRST)
     {
-        pmL = (sd == SRC) ? &pIcode->ic.ll.src : &pIcode->ic.ll.dst;
-        pmH = (sd == SRC) ? &atOffset->ic.ll.src : &atOffset->ic.ll.dst;
+        pmL = (sd == SRC) ? &pIcode->ll()->src : &pIcode->ll()->dst;
+        pmH = (sd == SRC) ? &atOffset->ll()->src : &atOffset->ll()->dst;
     }
     else        /* HIGH_FIRST */
     {
-        pmH = (sd == SRC) ? &pIcode->ic.ll.src : &pIcode->ic.ll.dst;
-        pmL = (sd == SRC) ? &atOffset->ic.ll.src : &atOffset->ic.ll.dst;
+        pmH = (sd == SRC) ? &pIcode->ll()->src : &pIcode->ll()->dst;
+        pmL = (sd == SRC) ? &atOffset->ll()->src : &atOffset->ll()->dst;
     }
 
     if (pmL->regi == 0)                                 /* global variable */
@@ -330,16 +330,16 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i,
     iICODE atOffset(pIcode);
     advance(atOffset,off);
 
-    pmHdst = &pIcode->ic.ll.dst;
-    pmLdst = &atOffset->ic.ll.dst;
-    pmHsrc = &pIcode->ic.ll.src;
-    pmLsrc = &atOffset->ic.ll.src;
+    pmHdst = &pIcode->ll()->dst;
+    pmLdst = &atOffset->ll()->dst;
+    pmHsrc = &pIcode->ll()->src;
+    pmLsrc = &atOffset->ll()->src;
 
     if ((longId.offH == pmHdst->off) && (longId.offL == pmLdst->off))
     {
         asgn.lhs = COND_EXPR::idLongIdx (i);
 
-        if ((pIcode->ic.ll.flg & NO_SRC) != NO_SRC)
+        if ( not pIcode->ll()->isLlFlag(NO_SRC) )
         {
             asgn.rhs = COND_EXPR::idLong (&pProc->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, off);
         }
@@ -371,15 +371,15 @@ boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, int i,
     iICODE atOffset(pIcode);
     advance(atOffset,off);
 
-    pmHdst = &pIcode->ic.ll.dst;
-    pmLdst = &atOffset->ic.ll.dst;
-    pmHsrc = &pIcode->ic.ll.src;
-    pmLsrc = &atOffset->ic.ll.src;
+    pmHdst = &pIcode->ll()->dst;
+    pmLdst = &atOffset->ll()->dst;
+    pmHsrc = &pIcode->ll()->src;
+    pmLsrc = &atOffset->ll()->src;
 
     if ((longId.h == pmHdst->regi) && (longId.l == pmLdst->regi))
     {
         lhs = COND_EXPR::idLongIdx (i);
-        if ((pIcode->ic.ll.flg & NO_SRC) != NO_SRC)
+        if ( not pIcode->ll()->isLlFlag(NO_SRC) )
         {
             rhs = COND_EXPR::idLong (&pProc->localId, SRC, pIcode, HIGH_FIRST,  pIcode, eUSE, off);
         }

+ 138 - 139
src/parser.cpp

@@ -15,7 +15,7 @@ using namespace std;
 static boolT    process_JMP (ICODE * pIcode, STATE * pstate, CALL_GRAPH * pcallGraph);
 static void     setBits(int16_t type, uint32_t start, uint32_t len);
 static SYM *     updateGlobSym(uint32_t operand, int size, uint16_t duFlag);
-static void     process_MOV(ICODE & pIcode, STATE * pstate);
+static void     process_MOV(LLInst &ll, STATE * pstate);
 static SYM *     lookupAddr (LLOperand *pm, STATE * pstate, int size, uint16_t duFlag);
 void    interactDis(Function * initProc, int ic);
 static uint32_t    SynthLab;
@@ -28,7 +28,6 @@ void parse (CALL_GRAPH * *pcallGraph)
     STATE state;
 
     /* Set initial state */
-    memset(&state, 0, sizeof(STATE));
     state.setState(rES, 0);   /* PSP segment */
     state.setState(rDS, 0);
     state.setState(rCS, prog.initCS);
@@ -134,101 +133,102 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 
     while (! done && ! (err = scan(pstate->IP, _Icode)))
     {
-        pstate->IP += (uint32_t)_Icode.ic.ll.numBytes;
-        setBits(BM_CODE, _Icode.ic.ll.label, (uint32_t)_Icode.ic.ll.numBytes);
+        LLInst *ll = _Icode.ll();
+        pstate->IP += (uint32_t)ll->numBytes;
+        setBits(BM_CODE, ll->label, (uint32_t)ll->numBytes);
 
         process_operands(_Icode,pstate);
 
         /* Keep track of interesting instruction flags in procedure */
-        flg |= (_Icode.ic.ll.flg & (NOT_HLL | FLOAT_OP));
+        flg |= (ll->GetLlFlag() & (NOT_HLL | FLOAT_OP));
 
         /* Check if this instruction has already been parsed */
-        iICODE labLoc = Icode.labelSrch(_Icode.ic.ll.label);
+        iICODE labLoc = Icode.labelSrch(ll->label);
         if (Icode.end()!=labLoc)
         {   /* Synthetic jump */
             _Icode.type = LOW_LEVEL;
-            _Icode.ic.ll.set(iJMP,I | SYNTHETIC | NO_OPS);
-            _Icode.ic.ll.src.SetImmediateOp(labLoc->GetLlLabel());
-            _Icode.ic.ll.label = SynthLab++;
+            ll->set(iJMP,I | SYNTHETIC | NO_OPS);
+            ll->src.SetImmediateOp(labLoc->ll()->GetLlLabel());
+            ll->label = SynthLab++;
         }
 
         /* Copy Icode to Proc */
-        if ((_Icode.ic.ll.opcode == iDIV) || (_Icode.ic.ll.opcode == iIDIV))
+        if ((_Icode.ll()->opcode == iDIV) || (_Icode.ll()->opcode == iIDIV))
         {
             /* MOV rTMP, reg */
-            memset (&eIcode, 0, sizeof (ICODE));
+            eIcode = ICODE();
             eIcode.type = LOW_LEVEL;
-            eIcode.ic.ll.opcode = iMOV;
-            eIcode.ic.ll.dst.regi = rTMP;
-            if (_Icode.ic.ll.flg & B)
+            eIcode.ll()->opcode = iMOV;
+            eIcode.ll()->dst.regi = rTMP;
+            if (ll->isLlFlag(B) )
             {
-                eIcode.ic.ll.flg |= B;
-                eIcode.ic.ll.src.regi = rAX;
+                eIcode.ll()->SetLlFlag( B );
+                eIcode.ll()->src.regi = rAX;
                 eIcode.setRegDU( rAX, eUSE);
             }
             else    /* implicit dx:ax */
             {
-                eIcode.ic.ll.flg |= IM_SRC;
+                eIcode.ll()->SetLlFlag( IM_SRC );
                 eIcode.setRegDU( rAX, eUSE);
                 eIcode.setRegDU( rDX, eUSE);
             }
             eIcode.setRegDU( rTMP, eDEF);
-            eIcode.ic.ll.flg |= SYNTHETIC;
-            /* eIcode.ic.ll.label = SynthLab++; */
-            eIcode.ic.ll.label = _Icode.ic.ll.label;
+            eIcode.ll()->SetLlFlag( SYNTHETIC );
+            /* eIcode.ll()->label = SynthLab++; */
+            eIcode.ll()->label = _Icode.ll()->label;
             Icode.addIcode(&eIcode);
 
             /* iDIV, iIDIV */
             Icode.addIcode(&_Icode);
 
             /* iMOD */
-            memset (&eIcode, 0, sizeof (ICODE));
+            eIcode = ICODE();
             eIcode.type = LOW_LEVEL;
-            eIcode.ic.ll.opcode = iMOD;
-            eIcode.ic.ll.src = _Icode.ic.ll.src;
+            eIcode.ll()->opcode = iMOD;
+            eIcode.ll()->src = _Icode.ll()->src;
             eIcode.du = _Icode.du;
-            eIcode.ic.ll.flg = (_Icode.ic.ll.flg | SYNTHETIC);
-            eIcode.ic.ll.label = SynthLab++;
+            eIcode.ll()->SetLlFlag( ( ll->GetLlFlag() | SYNTHETIC) );
+            eIcode.ll()->label = SynthLab++;
             pIcode = Icode.addIcode(&eIcode);
         }
-        else if (_Icode.ic.ll.opcode == iXCHG)
+        else if (_Icode.ll()->opcode == iXCHG)
         {
             /* MOV rTMP, regDst */
-            memset (&eIcode, 0, sizeof (ICODE));
+            eIcode = ICODE();
             eIcode.type = LOW_LEVEL;
-            eIcode.ic.ll.opcode = iMOV;
-            eIcode.ic.ll.dst.regi = rTMP;
-            eIcode.ic.ll.src.regi = _Icode.ic.ll.dst.regi;
+            eIcode.ll()->opcode = iMOV;
+            eIcode.ll()->dst.regi = rTMP;
+            eIcode.ll()->src.regi = _Icode.ll()->dst.regi;
             eIcode.setRegDU( rTMP, eDEF);
-            eIcode.setRegDU( eIcode.ic.ll.src.regi, eUSE);
-            eIcode.ic.ll.flg |= SYNTHETIC;
-            /* eIcode.ic.ll.label = SynthLab++; */
-            eIcode.ic.ll.label = _Icode.ic.ll.label;
+            eIcode.setRegDU( eIcode.ll()->src.regi, eUSE);
+            eIcode.ll()->SetLlFlag( SYNTHETIC );
+            /* eIcode.ll()->label = SynthLab++; */
+            eIcode.ll()->label = _Icode.ll()->label;
             Icode.addIcode(&eIcode);
 
             /* MOV regDst, regSrc */
-            _Icode.ic.ll.opcode = iMOV;
-            _Icode.ic.ll.flg |= SYNTHETIC;
-            /* Icode.ic.ll.label = SynthLab++; */
+            _Icode.ll()->opcode = iMOV;
+            ll->SetLlFlag( SYNTHETIC );
+            /* Icode.ll()->label = SynthLab++; */
             Icode.addIcode(&_Icode);
-            _Icode.ic.ll.opcode = iXCHG; /* for next case */
+            ll->opcode = iXCHG; /* for next case */
 
             /* MOV regSrc, rTMP */
-            memset (&eIcode, 0, sizeof (ICODE));
+            eIcode = ICODE();
             eIcode.type = LOW_LEVEL;
-            eIcode.ic.ll.opcode = iMOV;
-            eIcode.ic.ll.dst.regi = _Icode.ic.ll.src.regi;
-            eIcode.ic.ll.src.regi = rTMP;
-            eIcode.setRegDU( eIcode.ic.ll.dst.regi, eDEF);
+            eIcode.ll()->opcode = iMOV;
+            eIcode.ll()->dst.regi = ll->src.regi;
+            eIcode.ll()->src.regi = rTMP;
+            eIcode.setRegDU( eIcode.ll()->dst.regi, eDEF);
             eIcode.setRegDU( rTMP, eUSE);
-            eIcode.ic.ll.flg |= SYNTHETIC;
-            eIcode.ic.ll.label = SynthLab++;
+            eIcode.ll()->SetLlFlag(SYNTHETIC);
+            eIcode.ll()->label = SynthLab++;
             pIcode = Icode.addIcode(&eIcode);
         }
         else
             pIcode = Icode.addIcode(&_Icode);
 
-        switch (_Icode.ic.ll.opcode) {
+        switch (ll->opcode) {
             /*** Conditional jumps ***/
             case iLOOP: case iLOOPE:    case iLOOPNE:
             case iJB:   case iJBE:      case iJAE:  case iJA:
@@ -246,15 +246,15 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
                 /* This sets up range check for indexed JMPs hopefully
              * Handles JA/JAE for fall through and JB/JBE on branch
             */
-                if (ip > 0 && prev.ic.ll.opcode == iCMP && (prev.ic.ll.flg & I))
+                if (ip > 0 && prev.ll()->opcode == iCMP && (prev.ll()->isLlFlag(I)))
                 {
-                    pstate->JCond.immed = (int16_t)prev.ic.ll.src.op();
-                    if (_Icode.ic.ll.opcode == iJA || _Icode.ic.ll.opcode == iJBE)
+                    pstate->JCond.immed = (int16_t)prev.ll()->src.op();
+                    if (ll->opcode == iJA || ll->opcode == iJBE)
                         pstate->JCond.immed++;
-                    if (_Icode.ic.ll.opcode == iJAE || _Icode.ic.ll.opcode == iJA)
-                        pstate->JCond.regi = prev.ic.ll.dst.regi;
+                    if (ll->opcode == iJAE || ll->opcode == iJA)
+                        pstate->JCond.regi = prev.ll()->dst.regi;
                     fBranch = (boolT)
-                            (_Icode.ic.ll.opcode == iJB || _Icode.ic.ll.opcode == iJBE);
+                            (ll->opcode == iJB || ll->opcode == iJBE);
                 }
                 StCopy = *pstate;
                 //memcpy(&StCopy, pstate, sizeof(STATE));
@@ -264,7 +264,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 
                 if (fBranch)                /* Do branching code */
                 {
-                    pstate->JCond.regi = prev.ic.ll.dst.regi;
+                    pstate->JCond.regi = prev.ll()->dst.regi;
                 }
                 /* Next icode. Note: not the same as GetLastIcode() because of the call
                                 to FollowCtrl() */
@@ -286,7 +286,7 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
                 /*** Returns ***/
             case iRET:
             case iRETF:
-                this->flg |= (_Icode.ic.ll.opcode == iRET)? PROC_NEAR:PROC_FAR;
+                this->flg |= (ll->opcode == iRET)? PROC_NEAR:PROC_FAR;
                 /* Fall through */
             case iIRET:
                 this->flg &= ~TERMINATES;
@@ -294,14 +294,14 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
                 break;
 
             case iINT:
-                if (_Icode.ic.ll.src.op() == 0x21 && pstate->f[rAH])
+                if (ll->src.op() == 0x21 && pstate->f[rAH])
                 {
                     int funcNum = pstate->r[rAH];
                     int operand;
                     int size;
 
                     /* Save function number */
-                    Icode.back().ic.ll.dst.off = (int16_t)funcNum;
+                    Icode.back().ll()->dst.off = (int16_t)funcNum;
                     //Icode.GetIcode(Icode.GetNumIcodes() - 1)->
 
                     /* Program termination: int21h, fn 00h, 31h, 4Ch */
@@ -320,19 +320,19 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
                             updateSymType (operand, TYPE_STR, size);
                         }
                 }
-                else if ((_Icode.ic.ll.src.op() == 0x2F) && (pstate->f[rAH]))
+                else if ((ll->src.op() == 0x2F) && (pstate->f[rAH]))
                 {
-                    Icode.back().ic.ll.dst.off = pstate->r[rAH];
+                    Icode.back().ll()->dst.off = pstate->r[rAH];
                 }
                 else    /* Program termination: int20h, int27h */
-                    done = (boolT)(_Icode.ic.ll.src.op() == 0x20 ||
-                                   _Icode.ic.ll.src.op() == 0x27);
+                    done = (boolT)(ll->src.op() == 0x20 ||
+                                   ll->src.op() == 0x27);
                 if (done)
-                    pIcode->ic.ll.flg |= TERMINATES;
+                    pIcode->ll()->SetLlFlag(TERMINATES);
                 break;
 
             case iMOV:
-                process_MOV(*pIcode, pstate);
+                process_MOV(*pIcode->ll(), pstate);
                 break;
 
                 /* case iXCHG:
@@ -341,25 +341,25 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
             break; **** HERE ***/
 
             case iSHL:
-                if (pstate->JCond.regi == _Icode.ic.ll.dst.regi)
-                    if ((_Icode.ic.ll.flg & I) && _Icode.ic.ll.src.op() == 1)
+                if (pstate->JCond.regi == ll->dst.regi)
+                    if ((ll->isLlFlag(I)) && ll->src.op() == 1)
                         pstate->JCond.immed *= 2;
                     else
                         pstate->JCond.regi = 0;
                 break;
 
             case iLEA:
-                if (_Icode.ic.ll.src.regi == 0)      /* direct mem offset */
-                    pstate->setState( _Icode.ic.ll.dst.regi, _Icode.ic.ll.src.off);
+                if (ll->src.regi == 0)      /* direct mem offset */
+                    pstate->setState( ll->dst.regi, ll->src.off);
                 break;
 
             case iLDS: case iLES:
-                if ((psym = lookupAddr(&_Icode.ic.ll.src, pstate, 4, eDuVal::USE))
-                        /* && (Icode.ic.ll.flg & SEG_IMMED) */ ) {
+                if ((psym = lookupAddr(&ll->src, pstate, 4, eDuVal::USE))
+                        /* && (Icode.ll()->flg & SEG_IMMED) */ ) {
                     offset = LH(&prog.Image[psym->label]);
-                    pstate->setState( (_Icode.ic.ll.opcode == iLDS)? rDS: rES,
+                    pstate->setState( (ll->opcode == iLDS)? rDS: rES,
                                       LH(&prog.Image[psym->label + 2]));
-                    pstate->setState( _Icode.ic.ll.dst.regi, (int16_t)offset);
+                    pstate->setState( ll->dst.regi, (int16_t)offset);
                     psym->type = TYPE_PTR;
                 }
                 break;
@@ -371,13 +371,13 @@ void Function::FollowCtrl(CALL_GRAPH * pcallGraph, STATE *pstate)
 
         if (err == INVALID_386OP || err == INVALID_OPCODE)
         {
-            fatalError(err, prog.Image[_Icode.ic.ll.label], _Icode.ic.ll.label);
+            fatalError(err, prog.Image[_Icode.ll()->label], _Icode.ll()->label);
             this->flg |= PROC_BADINST;
         }
         else if (err == IP_OUT_OF_RANGE)
-            fatalError (err, _Icode.ic.ll.label);
+            fatalError (err, _Icode.ll()->label);
         else
-            reportError(err, _Icode.ic.ll.label);
+            reportError(err, _Icode.ll()->label);
     }
 }
 
@@ -391,11 +391,11 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
     uint32_t       i, k, seg, target;
     uint32_t         tmp;
 
-    if (pIcode.ic.ll.flg & I)
+    if (pIcode.ll()->isLlFlag(I))
     {
-        if (pIcode.ic.ll.opcode == iJMPF)
-            pstate->setState( rCS, LH(prog.Image + pIcode.ic.ll.label + 3));
-        i = pstate->IP = pIcode.ic.ll.src.op();
+        if (pIcode.ll()->opcode == iJMPF)
+            pstate->setState( rCS, LH(prog.Image + pIcode.ll()->label + 3));
+        i = pstate->IP = pIcode.ll()->src.op();
         if ((long)i < 0)
         {
             exit(1);
@@ -407,17 +407,17 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
 
     /* We've got an indirect JMP - look for switch() stmt. idiom of the form
      *   JMP  uint16_t ptr  word_offset[rBX | rSI | rDI]        */
-    seg = (pIcode.ic.ll.src.seg)? pIcode.ic.ll.src.seg: rDS;
+    seg = (pIcode.ll()->src.seg)? pIcode.ll()->src.seg: rDS;
 
     /* Ensure we have a uint16_t offset & valid seg */
-    if (pIcode.ic.ll.opcode == iJMP && (pIcode.ic.ll.flg & WORD_OFF) &&
+    if (pIcode.ll()->match(iJMP) and (pIcode.ll()->isLlFlag(WORD_OFF)) &&
             pstate->f[seg] &&
-            (pIcode.ic.ll.src.regi == INDEXBASE + 4 ||
-             pIcode.ic.ll.src.regi == INDEXBASE + 5 || /* Idx reg. BX, SI, DI */
-             pIcode.ic.ll.src.regi == INDEXBASE + 7))
+            (pIcode.ll()->src.regi == INDEXBASE + 4 ||
+             pIcode.ll()->src.regi == INDEXBASE + 5 || /* Idx reg. BX, SI, DI */
+             pIcode.ll()->src.regi == INDEXBASE + 7))
     {
 
-        offTable = ((uint32_t)(uint16_t)pstate->r[seg] << 4) + pIcode.ic.ll.src.off;
+        offTable = ((uint32_t)(uint16_t)pstate->r[seg] << 4) + pIcode.ll()->src.off;
 
         /* Firstly look for a leading range check of the form:-
          *      CMP {BX | SI | DI}, immed
@@ -425,7 +425,7 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
          * This is stored in the current state as if we had just
          * followed a JBE branch (i.e. [reg] lies between 0 - immed).
         */
-        if (pstate->JCond.regi == i2r[pIcode.ic.ll.src.regi-(INDEXBASE+4)])
+        if (pstate->JCond.regi == i2r[pIcode.ll()->src.regi-(INDEXBASE+4)])
             endTable = offTable + pstate->JCond.immed;
         else
             endTable = (uint32_t)prog.cbImage;
@@ -468,10 +468,10 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
 
             setBits(BM_DATA, offTable, endTable - offTable);
 
-            pIcode.ic.ll.flg |= SWITCH;
-            pIcode.ic.ll.caseTbl.numEntries = (endTable - offTable) / 2;
-            psw = (uint32_t*)allocMem(pIcode.ic.ll.caseTbl.numEntries*sizeof(uint32_t));
-            pIcode.ic.ll.caseTbl.entries = psw;
+            pIcode.ll()->SetLlFlag(SWITCH);
+            pIcode.ll()->caseTbl.numEntries = (endTable - offTable) / 2;
+            psw = (uint32_t*)allocMem(pIcode.ll()->caseTbl.numEntries*sizeof(uint32_t));
+            pIcode.ll()->caseTbl.entries = psw;
 
             for (i = offTable, k = 0; i < endTable; i += 2)
             {
@@ -482,9 +482,9 @@ boolT Function::process_JMP (ICODE & pIcode, STATE *pstate, CALL_GRAPH * pcallGr
 
                 FollowCtrl (pcallGraph, &StCopy);
                 ++last_current_insn;
-                last_current_insn->ic.ll.caseTbl.numEntries = k++;
-                last_current_insn->ic.ll.flg |= CASE;
-                *psw++ = last_current_insn->GetLlLabel();
+                last_current_insn->ll()->caseTbl.numEntries = k++;
+                last_current_insn->ll()->SetLlFlag(CASE);
+                *psw++ = last_current_insn->ll()->GetLlLabel();
 
             }
             return TRUE;
@@ -518,12 +518,12 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
 
     /* For Indirect Calls, find the function address */
     indirect = FALSE;
-    //pIcode.ic.ll.immed.proc.proc=fakeproc;
-    if ( not pIcode.isLlFlag(I) )
+    //pIcode.ll()->immed.proc.proc=fakeproc;
+    if ( not pIcode.ll()->isLlFlag(I) )
     {
         /* Not immediate, i.e. indirect call */
 
-        if (pIcode.ic.ll.dst.regi && (!option.Calls))
+        if (pIcode.ll()->dst.regi && (!option.Calls))
         {
             /* We have not set the brave option to attempt to follow
                 the execution path through register indirect calls.
@@ -539,28 +539,28 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
                         usually wrong! Consider also CALL [BP+0E] in which the
                         segment for the pointer is in SS! - Mike */
 
-        off = (uint32_t)(uint16_t)pIcode.ic.ll.dst.off +
-                ((uint32_t)(uint16_t)pIcode.ic.ll.dst.segValue << 4);
+        off = (uint32_t)(uint16_t)pIcode.ll()->dst.off +
+                ((uint32_t)(uint16_t)pIcode.ll()->dst.segValue << 4);
 
         /* Address of function is given by 4 (CALLF) or 2 (CALL) bytes at
                  * previous offset into the program image */
         uint32_t tgtAddr=0;
-        if (pIcode.ic.ll.opcode == iCALLF)
+        if (pIcode.ll()->opcode == iCALLF)
             tgtAddr= LH(&prog.Image[off]) + (uint32_t)(LH(&prog.Image[off+2])) << 4;
         else
             tgtAddr= LH(&prog.Image[off]) + (uint32_t)(uint16_t)state.r[rCS] << 4;
-        pIcode.ic.ll.src.SetImmediateOp( tgtAddr );
-        pIcode.ic.ll.flg |= I;
+        pIcode.ll()->src.SetImmediateOp( tgtAddr );
+        pIcode.ll()->SetLlFlag(I);
         indirect = TRUE;
     }
 
-    /* Process CALL.  Function address is located in pIcode.ic.ll.immed.op */
-    if (pIcode.ic.ll.flg & I)
+    /* Process CALL.  Function address is located in pIcode.ll()->immed.op */
+    if (pIcode.ll()->isLlFlag(I))
     {
         /* Search procedure list for one with appropriate entry point */
         ilFunction iter= std::find_if(pProcList.begin(),pProcList.end(),
             [pIcode](const Function &f) ->
-                bool { return f.procEntry==pIcode.ic.ll.src.op(); });
+                bool { return f.procEntry==pIcode.ll()->src.op(); });
 
         /* Create a new procedure node and save copy of the state */
         if (iter==pProcList.end())
@@ -568,7 +568,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
             pProcList.push_back(Function::Create());
             Function &x(pProcList.back());
             iter = (++pProcList.rbegin()).base();
-            x.procEntry = pIcode.ic.ll.src.op();
+            x.procEntry = pIcode.ll()->src.op();
             LibCheck(x);
 
             if (x.flg & PROC_ISLIB)
@@ -576,7 +576,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
                 /* A library function. No need to do any more to it */
                 pcallGraph->insertCallGraph (this, iter);
                 iter = (++pProcList.rbegin()).base();
-                last_insn.ic.ll.src.proc.proc = &x;
+                last_insn.ll()->src.proc.proc = &x;
                 return false;
             }
 
@@ -594,9 +594,9 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
 
             /* Save machine state in localState, load up IP and CS.*/
             localState = *pstate;
-            pstate->IP = pIcode.ic.ll.src.op();
-            if (pIcode.ic.ll.opcode == iCALLF)
-                pstate->setState( rCS, LH(prog.Image + pIcode.ic.ll.label + 3));
+            pstate->IP = pIcode.ll()->src.op();
+            if (pIcode.ll()->opcode == iCALLF)
+                pstate->setState( rCS, LH(prog.Image + pIcode.ll()->label + 3));
             x.state = *pstate;
 
             /* Insert new procedure in call graph */
@@ -616,7 +616,7 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
         else
             pcallGraph->insertCallGraph (this, iter);
 
-        last_insn.ic.ll.src.proc.proc = &(*iter); // ^ target proc
+        last_insn.ll()->src.proc.proc = &(*iter); // ^ target proc
 
         /* return ((p->flg & TERMINATES) != 0); */
     }
@@ -625,19 +625,18 @@ boolT Function::process_CALL (ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *ps
 
 
 /* process_MOV - Handles state changes due to simple assignments    */
-static void process_MOV(ICODE & pIcode, STATE * pstate)
+static void process_MOV(LLInst & ll, STATE * pstate)
 {
     SYM *  psym, *psym2;        /* Pointer to symbol in global symbol table */
-    uint8_t  dstReg = pIcode.ic.ll.dst.regi;
-    uint8_t  srcReg = pIcode.ic.ll.src.regi;
-
+    uint8_t  dstReg = ll.dst.regi;
+    uint8_t  srcReg = ll.src.regi;
     if (dstReg > 0 && dstReg < INDEXBASE)
     {
-        if (pIcode.ic.ll.flg & I)
-            pstate->setState( dstReg, (int16_t)pIcode.ic.ll.src.op());
+        if (ll.isLlFlag(I))
+            pstate->setState( dstReg, (int16_t)ll.src.op());
         else if (srcReg == 0)   /* direct memory offset */
         {
-            psym = lookupAddr(&pIcode.ic.ll.src, pstate, 2, eDuVal::USE);
+            psym = lookupAddr(&ll.src, pstate, 2, eDuVal::USE);
             if (psym && ((psym->flg & SEG_IMMED) || psym->duVal.val))
                 pstate->setState( dstReg, LH(&prog.Image[psym->label]));
         }
@@ -652,20 +651,20 @@ static void process_MOV(ICODE & pIcode, STATE * pstate)
     }
     else if (dstReg == 0) {     /* direct memory offset */
         int size=2;
-        if((pIcode.ic.ll.src.regi>=rAL)&&(pIcode.ic.ll.src.regi<=rBH))
+        if((ll.src.regi>=rAL)&&(ll.src.regi<=rBH))
             size=1;
-        psym = lookupAddr (&pIcode.ic.ll.dst, pstate, size, eDEF);
+        psym = lookupAddr (&ll.dst, pstate, size, eDEF);
         if (psym && ! (psym->duVal.val))      /* no initial value yet */
-            if (pIcode.ic.ll.flg & I)   /* immediate */
+            if (ll.isLlFlag(I))   /* immediate */
             {
-                prog.Image[psym->label] = (uint8_t)pIcode.ic.ll.src.op();
+                prog.Image[psym->label] = (uint8_t)ll.src.op();
                 if(psym->size>1)
-                    prog.Image[psym->label+1] = (uint8_t)(pIcode.ic.ll.src.op()>>8);
+                    prog.Image[psym->label+1] = (uint8_t)(ll.src.op()>>8);
                 psym->duVal.val = 1;
             }
             else if (srcReg == 0) /* direct mem offset */
             {
-                psym2 = lookupAddr (&pIcode.ic.ll.src, pstate, 2, eDuVal::USE);
+                psym2 = lookupAddr (&ll.src, pstate, 2, eDuVal::USE);
                 if (psym2 && ((psym->flg & SEG_IMMED) || (psym->duVal.val)))
                 {
                     prog.Image[psym->label] = (uint8_t)prog.Image[psym2->label];
@@ -902,7 +901,7 @@ std::bitset<32> duReg[] = { 0x00,
  *            ix    : current index into icode array    */
 static void use (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int size, int ix)
 {
-    LLOperand * pm   = (d == SRC)? &pIcode.ic.ll.src: &pIcode.ic.ll.dst;
+    LLOperand * pm   = (d == SRC)? &pIcode.ll()->src: &pIcode.ll()->dst;
     SYM *  psym;
 
     if (pm->regi == 0 || pm->regi >= INDEXBASE)
@@ -932,13 +931,13 @@ static void use (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
         else if (psym = lookupAddr(pm, pstate, size, eDuVal::USE))
         {
             setBits (BM_DATA, psym->label, (uint32_t)size);
-            pIcode.ic.ll.flg |= SYM_USE;
-            pIcode.ic.ll.caseTbl.numEntries = psym - &symtab[0];
+            pIcode.ll()->SetLlFlag(SYM_USE);
+            pIcode.ll()->caseTbl.numEntries = psym - &symtab[0];
         }
     }
 
     /* Use of register */
-    else if ((d == DST) || ((d == SRC) && (pIcode.ic.ll.flg & I) != I))
+    else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->isLlFlag(I))))
         pIcode.du.use |= duReg[pm->regi];
 }
 
@@ -949,7 +948,7 @@ static void use (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
 static void def (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int size,
                  int ix)
 {
-    LLOperand *pm   = (d == SRC)? &pIcode.ic.ll.src: &pIcode.ic.ll.dst;
+    LLOperand *pm   = (d == SRC)? &pIcode.ll()->src: &pIcode.ll()->dst;
     SYM *  psym;
 
     if (pm->regi == 0 || pm->regi >= INDEXBASE)
@@ -981,13 +980,13 @@ static void def (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
         else if (psym = lookupAddr(pm, pstate, size, eDEF))
         {
             setBits(BM_DATA, psym->label, (uint32_t)size);
-            pIcode.ic.ll.flg |= SYM_DEF;
-            pIcode.ic.ll.caseTbl.numEntries = psym - &symtab[0];
+            pIcode.ll()->SetLlFlag(SYM_DEF);
+            pIcode.ll()->caseTbl.numEntries = psym - &symtab[0];
         }
     }
 
     /* Definition of register */
-    else if ((d == DST) || ((d == SRC) && (pIcode.ic.ll.flg & I) != I))
+    else if ((d == DST) || ((d == SRC) && (not pIcode.ll()->isLlFlag(I))))
     {
         pIcode.du.def |= duReg[pm->regi];
         pIcode.du1.numRegsDef++;
@@ -1001,7 +1000,7 @@ static void def (opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int
 static void use_def(opLoc d, ICODE & pIcode, Function * pProc, STATE * pstate, int cb,
                     int ix)
 {
-    LLOperand *  pm = (d == SRC)? &pIcode.ic.ll.src: &pIcode.ic.ll.dst;
+    LLOperand *  pm = (d == SRC)? &pIcode.ll()->src: &pIcode.ll()->dst;
 
     use (d, pIcode, pProc, pstate, cb, ix);
 
@@ -1019,11 +1018,11 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
 {
     int ix=Icode.size();
     int   i;
-    int   sseg = (pIcode.ic.ll.src.seg)? pIcode.ic.ll.src.seg: rDS;
-    int   cb   = (pIcode.ic.ll.flg & B) ? 1: 2;
-    uint32_t Imm  = (pIcode.ic.ll.flg & I);
+    int   sseg = (pIcode.ll()->src.seg)? pIcode.ll()->src.seg: rDS;
+    int   cb   = pIcode.ll()->isLlFlag(B) ? 1: 2;
+    uint32_t Imm  = (pIcode.ll()->isLlFlag(I));
 
-    switch (pIcode.ic.ll.opcode) {
+    switch (pIcode.ll()->opcode) {
         case iAND:  case iOR:   case iXOR:
         case iSAR:  case iSHL:  case iSHR:
         case iRCL:  case iRCR:  case iROL:  case iROR:
@@ -1078,7 +1077,7 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
             break;
 
         case iSIGNEX:
-            cb = (pIcode.ic.ll.flg & SRC_B) ? 1 : 2;
+            cb = pIcode.ll()->isLlFlag(SRC_B) ? 1 : 2;
             if (cb == 1)                    /* uint8_t */
             {
                 pIcode.du.def |= duReg[rAX];
@@ -1097,7 +1096,7 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
             cb = 4;
         case iCALL:  case iPUSH:  case iPOP:
             if (! Imm) {
-                if (pIcode.ic.ll.opcode == iPOP)
+                if (pIcode.ll()->opcode == iPOP)
                     def(DST, pIcode, this, pstate, cb, ix);
                 else
                     use(DST, pIcode, this, pstate, cb, ix);
@@ -1109,7 +1108,7 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
             break;
 
         case iLDS:  case iLES:
-            pIcode.du.def |= duReg[(pIcode.ic.ll.opcode == iLDS) ? rDS : rES];
+            pIcode.du.def |= duReg[(pIcode.ll()->opcode == iLDS) ? rDS : rES];
             pIcode.du1.numRegsDef++;
             cb = 4;
         case iMOV:
@@ -1158,7 +1157,7 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
         case iSCAS:  case iSTOS:  case iINS:
             pIcode.du.def |= duReg[rDI];
             pIcode.du1.numRegsDef++;
-            if (pIcode.ic.ll.opcode == iREP_INS || pIcode.ic.ll.opcode== iINS)
+            if (pIcode.ll()->opcode == iREP_INS || pIcode.ll()->opcode== iINS)
             {
                 pIcode.du.use |= duReg[rDI] | duReg[rES] | duReg[rDX];
             }
@@ -1198,7 +1197,7 @@ void Function::process_operands(ICODE & pIcode,  STATE * pstate)
     }
 
     for (i = rSP; i <= rBH; i++)        /* Kill all defined registers */
-        if (pIcode.ic.ll.flagDU.d & (1 << i))
+        if (pIcode.ll()->flagDU.d & (1 << i))
             pstate->f[i] = FALSE;
 }
 

+ 4 - 4
src/procs.cpp

@@ -106,13 +106,13 @@ void Function::newRegArg(iICODE picode, iICODE ticode)
     uint8_t regL, regH;		/* Registers involved in arguments */
 
     /* Flag ticode as having register arguments */
-    tproc = ticode->ic.hl.call.proc;
+    tproc = ticode->hl()->call.proc;
     tproc->flg |= REG_ARGS;
 
     /* Get registers and index into target procedure's local list */
-    ps = ticode->ic.hl.call.args;
+    ps = ticode->hl()->call.args;
     ts = &tproc->args;
-    lhs = picode->ic.hl.asgn.lhs;
+    lhs = picode->hl()->asgn.lhs;
     type = lhs->expr.ident.idType;
     if (type == REGISTER)
     {
@@ -187,7 +187,7 @@ void Function::newRegArg(iICODE picode, iICODE ticode)
     /* Do ps (actual arguments) */
     STKSYM newsym;
     sprintf (newsym.name, "arg%ld", ps->sym.size());
-    newsym.actual = picode->ic.hl.asgn.rhs;
+    newsym.actual = picode->hl()->asgn.rhs;
     newsym.regs = lhs;
     /* Mask off high and low register(s) in picode */
     switch (type) {

+ 39 - 39
src/proplong.cpp

@@ -35,7 +35,7 @@ static boolT isLong23 (iICODE iter, BB * pbb, int *off, int *arc)
     if ((t->size() == 1) && (t->nodeType == TWO_BRANCH) && (t->inEdges.size() == 1))
     {
         obb2 = t->edges[THEN].BBptr;
-        if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ic.ll.opcode == iCMP))
+        if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) && (obb2->front().ll()->opcode == iCMP))
         {
             *off = std::distance(iter,obb2->begin2());
             *arc = THEN;
@@ -47,7 +47,7 @@ static boolT isLong23 (iICODE iter, BB * pbb, int *off, int *arc)
     else if ((e->size() == 1) && (e->nodeType == TWO_BRANCH) && (e->inEdges.size() == 1))
     {
         obb2 = e->edges[THEN].BBptr;
-        if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) &&  (obb2->front().ic.ll.opcode == iCMP))
+        if ((obb2->size() == 2) && (obb2->nodeType == TWO_BRANCH) &&  (obb2->front().ll()->opcode == iCMP))
         {
             *off = std::distance(iter,obb2->begin2());//obb2->front().loc_ip - i;
             *arc = ELSE;
@@ -65,9 +65,9 @@ static boolT isLong22 (iICODE pIcode, iICODE pEnd, int *off)
         return false;
     // preincrement because pIcode is not checked here
     iICODE icodes[] = { ++pIcode,++pIcode,++pIcode };
-    if (   icodes[1]->ic.ll.match(iCMP) &&
-           (isJCond (icodes[0]->ic.ll.opcode)) &&
-           (isJCond (icodes[2]->ic.ll.opcode)))
+    if (   icodes[1]->ll()->match(iCMP) &&
+           (isJCond (icodes[0]->ll()->opcode)) &&
+           (isJCond (icodes[2]->ll()->opcode)))
     {
         *off = 2;
         return true;
@@ -142,7 +142,7 @@ static int longJCond23 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode, int arc,
     advance(atOffset,off);
     advance(atOffset1,off+1);
     /* Create new HLI_JCOND and condition */
-    lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[atOffset1->ic.ll.opcode-iJB]);
+    lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[atOffset1->ll()->opcode-iJB]);
     next1->setJCond(lhs);
     next1->copyDU(*pIcode, eUSE, eUSE);
     next1->du.use |= atOffset->du.use;
@@ -177,7 +177,7 @@ static int longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,iICODE pEn
     iICODE icodes[] = { pIcode++,pIcode++,pIcode++,pIcode++ };
 
     /* Form conditional expression */
-    lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[icodes[3]->ic.ll.opcode - iJB]);
+    lhs = COND_EXPR::boolOp (lhs, rhs, condOpJCond[icodes[3]->ll()->opcode - iJB]);
     icodes[1]->setJCond(lhs);
     icodes[1]->copyDU (*icodes[0], eUSE, eUSE);
     icodes[1]->du.use |= icodes[2]->du.use;
@@ -198,7 +198,7 @@ static int longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,iICODE pEn
         assert(iter!=tbb->inEdges.end());
         tbb->inEdges.erase(iter);
 
-        if (icodes[3]->ic.ll.opcode != iJE)
+        if (icodes[3]->ll()->opcode != iJE)
             tbb->inEdges.push_back(pbb); /* iJNE => replace arc */
 
         /* Modify ELSE out edge of header basic block */
@@ -208,7 +208,7 @@ static int longJCond22 (COND_EXPR *rhs, COND_EXPR *lhs, iICODE pIcode,iICODE pEn
         iter=std::find(tbb->inEdges.begin(),tbb->inEdges.end(),obb1);
         assert(iter!=tbb->inEdges.end());
         tbb->inEdges.erase(iter);
-        if (icodes[3]->ic.ll.opcode == iJE)	/* replace */
+        if (icodes[3]->ll()->opcode == iJE)	/* replace */
             tbb->inEdges.push_back(pbb);
 
         /* Update statistics */
@@ -246,9 +246,9 @@ void Function::propLongStk (int i, const ID &pLocId)
             break;
         if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
             continue;
-        if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
+        if (pIcode->ll()->opcode == next1->ll()->opcode)
         {
-            switch (pIcode->ic.ll.opcode)
+            switch (pIcode->ll()->opcode)
             {
             case iMOV:
                 if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, 1) == TRUE)
@@ -261,7 +261,7 @@ void Function::propLongStk (int i, const ID &pLocId)
             case iAND: case iOR: case iXOR:
                 if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, 1) == TRUE)
                 {
-                    switch (pIcode->ic.ll.opcode)
+                    switch (pIcode->ll()->opcode)
                     {
                     case iAND: 	asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND); break;
                     case iOR: 	asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR); break;
@@ -283,7 +283,7 @@ void Function::propLongStk (int i, const ID &pLocId)
         }
 
         /* Check long conditional (i.e. 2 CMPs and 3 branches */
-        else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
+        else if ((pIcode->ll()->opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
         {
             if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, off) )
             {
@@ -293,7 +293,7 @@ void Function::propLongStk (int i, const ID &pLocId)
 
         /* Check for long conditional equality or inequality.  This requires
                  * 2 CMPs and 2 branches */
-        else if ((pIcode->ic.ll.opcode == iCMP) && isLong22 (pIcode, pEnd, &off))
+        else if ((pIcode->ll()->opcode == iCMP) && isLong22 (pIcode, pEnd, &off))
         {
             if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, off) )
             {
@@ -318,14 +318,14 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
 
         if ((icode.type == HIGH_LEVEL) || (icode.invalid == TRUE))
             continue;
-        if (icode.ic.ll.opcode != next1.ic.ll.opcode)
+        if (icode.ll()->opcode != next1.ll()->opcode)
             continue;
 
-        switch (icode.ic.ll.opcode)
+        switch (icode.ll()->opcode)
         {
         case iMOV:
-            pmH = &icode.ic.ll.dst;
-            pmL = &next1.ic.ll.dst;
+            pmH = &icode.ll()->dst;
+            pmL = &next1.ll()->dst;
             if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
             {
                 localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert
@@ -339,8 +339,8 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
             break;
 
         case iPOP:
-            pmH = &next1.ic.ll.dst;
-            pmL = &icode.ic.ll.dst;
+            pmH = &next1.ll()->dst;
+            pmL = &icode.ll()->dst;
             if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
             {
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
@@ -355,14 +355,14 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
             //                /**** others missing ***/
 
         case iAND: case iOR: case iXOR:
-            pmL = &icode.ic.ll.dst;
-            pmH = &next1.ic.ll.dst;
+            pmL = &icode.ll()->dst;
+            pmH = &next1.ll()->dst;
             if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
             {
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
                 asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, 1);
                 icode.setRegDU( pmH->regi, USE_DEF);
-                switch (icode.ic.ll.opcode)
+                switch (icode.ll()->opcode)
                 {
                 case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
                     break;
@@ -397,14 +397,14 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
         if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
             continue;
 
-        if (pIcode->ic.ll.opcode == next1->ic.ll.opcode)
-            switch (pIcode->ic.ll.opcode)
+        if (pIcode->ll()->opcode == next1->ll()->opcode)
+            switch (pIcode->ll()->opcode)
             {
             case iMOV:
-                if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
-                        (pLocId.id.longId.l == next1->ic.ll.src.regi))
+                if ((pLocId.id.longId.h == pIcode->ll()->src.regi) &&
+                        (pLocId.id.longId.l == next1->ll()->src.regi))
                 {
-                    pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
+                    pIcode->setRegDU( next1->ll()->src.regi, eUSE);
 
                     asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
                     asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, 1);
@@ -416,11 +416,11 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
                 break;
 
             case iPUSH:
-                if ((pLocId.id.longId.h == pIcode->ic.ll.src.regi) &&
-                        (pLocId.id.longId.l == next1->ic.ll.src.regi))
+                if ((pLocId.id.longId.h == pIcode->ll()->src.regi) &&
+                        (pLocId.id.longId.l == next1->ll()->src.regi))
                 {
                     asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
-                    pIcode->setRegDU( next1->ic.ll.src.regi, eUSE);
+                    pIcode->setRegDU( next1->ll()->src.regi, eUSE);
                     pIcode->setUnary(HLI_PUSH, asgn.rhs);
                     next1->invalidate();
                 }
@@ -430,8 +430,8 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
                 /*** others missing ****/
 
             case iAND: case iOR: case iXOR:
-                pmL = &pIcode->ic.ll.dst;
-                pmH = &next1->ic.ll.dst;
+                pmL = &pIcode->ll()->dst;
+                pmH = &next1->ll()->dst;
                 if ((pLocId.id.longId.h == pmH->regi) &&
                         (pLocId.id.longId.l == pmL->regi))
                 {
@@ -439,7 +439,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
                     pIcode->setRegDU( pmH->regi, USE_DEF);
                     asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
                                                   LOW_FIRST, pIcode/*idx*/, eUSE, 1);
-                    switch (pIcode->ic.ll.opcode) {
+                    switch (pIcode->ll()->opcode) {
                     case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
                         break;
                     case iOR:  asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, OR);
@@ -458,7 +458,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
             } /* eos */
 
         /* Check long conditional (i.e. 2 CMPs and 3 branches */
-        else if ((pIcode->ic.ll.opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
+        else if ((pIcode->ll()->opcode == iCMP) && (isLong23 (pIcode, pIcode->inBB, &off, &arc)))
         {
             if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn.rhs, asgn.lhs, off) == TRUE)
             {
@@ -469,7 +469,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
 
         /* Check for long conditional equality or inequality.  This requires
              * 2 CMPs and 2 branches */
-        else if (pIcode->ic.ll.match(iCMP) && (isLong22 (pIcode, pEnd, &off)))
+        else if (pIcode->ll()->match(iCMP) && (isLong22 (pIcode, pEnd, &off)))
         {
             if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn.rhs, asgn.lhs, off) == TRUE)
             {
@@ -481,13 +481,13 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
              *			 JX lab
              *		=> HLI_JCOND (regH:regL X 0) lab
              * This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
-        else if (pIcode->ic.ll.match(iOR) && (next1 != pEnd) && (isJCond (next1->ic.ll.opcode)))
+        else if (pIcode->ll()->match(iOR) && (next1 != pEnd) && (isJCond (next1->ll()->opcode)))
         {
-            if ((pIcode->ic.ll.dst.regi == pLocId.id.longId.h) && (pIcode->ic.ll.src.regi == pLocId.id.longId.l))
+            if ((pIcode->ll()->dst.regi == pLocId.id.longId.h) && (pIcode->ll()->src.regi == pLocId.id.longId.l))
             {
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
                 asgn.rhs = COND_EXPR::idKte (0, 4);	/* long 0 */
-                asgn.lhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, condOpJCond[next1->ic.ll.opcode - iJB]);
+                asgn.lhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, condOpJCond[next1->ll()->opcode - iJB]);
                 next1->setJCond(asgn.lhs);
                 next1->copyDU(*pIcode, eUSE, eUSE);
                 pIcode->invalidate();

+ 80 - 79
src/scanner.cpp

@@ -329,7 +329,7 @@ eErrorId scan(uint32_t ip, ICODE &p)
     int  op;
     p = ICODE();
     p.type = LOW_LEVEL;
-    p.ic.ll.label = ip;			/* ip is absolute offset into image*/
+    p.ll()->label = ip;			/* ip is absolute offset into image*/
     if (ip >= (uint32_t)prog.cbImage)
     {
         return (IP_OUT_OF_RANGE);
@@ -342,20 +342,20 @@ eErrorId scan(uint32_t ip, ICODE &p)
     do
     {
         op = *pInst++;						/* First state - trivial   */
-        p.ic.ll.opcode = stateTable[op].opcode;  /* Convert to Icode.opcode */
-        p.ic.ll.flg    = stateTable[op].flg & ICODEMASK;
-        p.ic.ll.flagDU.d = stateTable[op].df;
-        p.ic.ll.flagDU.u = stateTable[op].uf;
+          /* Convert to Icode.opcode */
+        p.ll()->set(stateTable[op].opcode,stateTable[op].flg & ICODEMASK);
+        p.ll()->flagDU.d = stateTable[op].df;
+        p.ll()->flagDU.u = stateTable[op].uf;
 
         (*stateTable[op].state1)(op);		/* Second state */
         (*stateTable[op].state2)(op);		/* Third state  */
 
     } while (stateTable[op].state1 == prefix);	/* Loop if prefix */
 
-    if (p.ic.ll.opcode)
+    if (p.ll()->opcode)
     {
         /* Save bytes of image used */
-        p.ic.ll.numBytes = (uint8_t)((pInst - prog.Image) - ip);
+        p.ll()->numBytes = (uint8_t)((pInst - prog.Image) - ip);
         return ((SegPrefix)? FUNNY_SEGOVR:  /* Seg. Override invalid */
                              (RepPrefix ? FUNNY_REP: NO_ERR));/* REP prefix invalid */
     }
@@ -413,7 +413,7 @@ static void setAddress(int i, boolT fdst, uint16_t seg, int16_t reg, uint16_t of
     /* If not to register (i.e. to r/m), and talking about r/m,
                 then this is dest */
     pm = (!(stateTable[i].flg & TO_REG) == fdst) ?
-                &pIcode->ic.ll.dst : &pIcode->ic.ll.src;
+                &pIcode->ll()->dst : &pIcode->ll()->src;
 
     /* Set segment.  A later procedure (lookupAddr in proclist.c) will
          * provide the value of this segment in the field segValue.  */
@@ -459,9 +459,10 @@ static void rm(int i)
         case 0:		/* No disp unless rm == 6 */
             if (rm == 6) {
                 setAddress(i, TRUE, SegPrefix, 0, getWord());
-                pIcode->ic.ll.flg |= WORD_OFF;
+                pIcode->ll()->SetLlFlag(WORD_OFF);
             }
-            else	setAddress(i, TRUE, SegPrefix, rm + INDEXBASE, 0);
+            else
+                setAddress(i, TRUE, SegPrefix, rm + INDEXBASE, 0);
             break;
 
         case 1:		/* 1 uint8_t disp */
@@ -470,7 +471,7 @@ static void rm(int i)
 
         case 2:		/* 2 uint8_t disp */
             setAddress(i, TRUE, SegPrefix, rm + INDEXBASE, getWord());
-            pIcode->ic.ll.flg |= WORD_OFF;
+            pIcode->ll()->SetLlFlag(WORD_OFF);
             break;
 
         case 3:		/* reg */
@@ -478,9 +479,9 @@ static void rm(int i)
             break;
     }
 
-    if ((stateTable[i].flg & NSP) && (pIcode->ic.ll.src.regi==rSP ||
-                                      pIcode->ic.ll.dst.regi==rSP))
-        pIcode->ic.ll.flg |= NOT_HLL;
+    if ((stateTable[i].flg & NSP) && (pIcode->ll()->src.regi==rSP ||
+                                      pIcode->ll()->dst.regi==rSP))
+        pIcode->ll()->SetLlFlag(NOT_HLL);
 }
 
 
@@ -502,7 +503,7 @@ static void segrm(int i)
     int	reg = REG(*pInst) + rES;
 
     if (reg > rDS || (reg == rCS && (stateTable[i].flg & TO_REG)))
-        pIcode->ic.ll.opcode = (llIcode)0;
+        pIcode->ll()->opcode = (llIcode)0;
     else {
         setAddress(i, FALSE, 0, (int16_t)reg, 0);
         rm(i);
@@ -516,7 +517,7 @@ static void segrm(int i)
 static void regop(int i)
 {
     setAddress(i, FALSE, 0, ((int16_t)i & 7) + rAX, 0);
-    pIcode->ic.ll.dst.regi = pIcode->ic.ll.src.regi;
+    pIcode->ll()->dst.regi = pIcode->ll()->src.regi;
 }
 
 
@@ -540,13 +541,13 @@ static void axImp(int i)
 /* Implied AX source */
 static void axSrcIm (int )
 {
-    pIcode->ic.ll.src.regi = rAX;
+    pIcode->ll()->src.regi = rAX;
 }
 
 /* Implied AL source */
 static void alImp (int )
 {
-    pIcode->ic.ll.src.regi = rAL;
+    pIcode->ll()->src.regi = rAL;
 }
 
 
@@ -565,7 +566,7 @@ static void memImp(int i)
 static void memOnly(int )
 {
     if ((*pInst & 0xC0) == 0xC0)
-        pIcode->ic.ll.opcode = (llIcode)0;
+        pIcode->ll()->opcode = (llIcode)0;
 }
 
 
@@ -575,7 +576,7 @@ static void memOnly(int )
 static void memReg0(int i)
 {
     if (REG(*pInst) || (*pInst & 0xC0) == 0xC0)
-        pIcode->ic.ll.opcode = (llIcode)0;
+        pIcode->ll()->opcode = (llIcode)0;
     else
         rm(i);
 }
@@ -589,13 +590,13 @@ static void immed(int i)
     static llIcode immedTable[8] = {iADD, iOR, iADC, iSBB, iAND, iSUB, iXOR, iCMP};
     static uint8_t uf[8] = { 0,  0,  Cf,  Cf,  0,   0,   0,   0  };
 
-    pIcode->ic.ll.opcode = immedTable[REG(*pInst)];
-    pIcode->ic.ll.flagDU.u = uf[REG(*pInst)];
-    pIcode->ic.ll.flagDU.d = (Sf | Zf | Cf);
+    pIcode->ll()->opcode = immedTable[REG(*pInst)];
+    pIcode->ll()->flagDU.u = uf[REG(*pInst)];
+    pIcode->ll()->flagDU.d = (Sf | Zf | Cf);
     rm(i);
 
-    if (pIcode->ic.ll.opcode == iADD || pIcode->ic.ll.opcode == iSUB)
-        pIcode->ic.ll.flg &= ~NOT_HLL;	/* Allow ADD/SUB SP, immed */
+    if (pIcode->ll()->opcode == iADD || pIcode->ll()->opcode == iSUB)
+        pIcode->ll()->ClrLlFlag(NOT_HLL);	/* Allow ADD/SUB SP, immed */
 }
 
 
@@ -612,11 +613,11 @@ static void shift(int i)
     static uint8_t df[8]	  = {Cf,  Cf,  Cf,  Cf, Sf | Zf | Cf,
                              Sf | Zf | Cf, 0, Sf | Zf | Cf};
 
-    pIcode->ic.ll.opcode = shiftTable[REG(*pInst)];
-    pIcode->ic.ll.flagDU.u = uf[REG(*pInst)];
-    pIcode->ic.ll.flagDU.d = df[REG(*pInst)];
+    pIcode->ll()->opcode = shiftTable[REG(*pInst)];
+    pIcode->ll()->flagDU.u = uf[REG(*pInst)];
+    pIcode->ll()->flagDU.d = df[REG(*pInst)];
     rm(i);
-    pIcode->ic.ll.src.regi = rCL;
+    pIcode->ll()->src.regi = rCL;
 }
 
 
@@ -631,16 +632,16 @@ static void trans(int i)
         (llIcode)iJMP, (llIcode)iJMPF,(llIcode)iPUSH, (llIcode)0
     };
     static uint8_t df[8]	= {Sf | Zf, Sf | Zf, 0, 0, 0, 0, 0, 0};
-
+    LLInst *ll = pIcode->ll();
     if ((uint8_t)REG(*pInst) < 2 || !(stateTable[i].flg & B)) { /* INC & DEC */
-        pIcode->ic.ll.opcode = transTable[REG(*pInst)];   /* valid on bytes */
-        pIcode->ic.ll.flagDU.d = df[REG(*pInst)];
+        ll->opcode = transTable[REG(*pInst)];   /* valid on bytes */
+        ll->flagDU.d = df[REG(*pInst)];
         rm(i);
-        pIcode->ic.ll.src = pIcode->ic.ll.dst;
-        if (pIcode->ic.ll.opcode == iJMP || pIcode->ic.ll.opcode == iCALL || pIcode->ic.ll.opcode == iCALLF)
-            pIcode->ic.ll.flg |= NO_OPS;
-        else if (pIcode->ic.ll.opcode == iINC || pIcode->ic.ll.opcode == iPUSH || pIcode->ic.ll.opcode == iDEC)
-            pIcode->ic.ll.flg |= NO_SRC;
+        ll->src = pIcode->ll()->dst;
+        if (ll->opcode == iJMP || ll->opcode == iCALL || ll->opcode == iCALLF)
+            ll->SetLlFlag(NO_OPS);
+        else if (ll->opcode == iINC || ll->opcode == iPUSH || ll->opcode == iDEC)
+            ll->SetLlFlag(NO_SRC);
     }
 }
 
@@ -659,8 +660,8 @@ static void arith(int i)
                              Sf | Zf | Cf, Sf | Zf | Cf, Sf | Zf | Cf,
                              Sf | Zf | Cf};
 
-    opcode = pIcode->ic.ll.opcode = arithTable[REG(*pInst)];
-    pIcode->ic.ll.flagDU.d = df[REG(*pInst)];
+    opcode = pIcode->ll()->opcode = arithTable[REG(*pInst)];
+    pIcode->ll()->flagDU.d = df[REG(*pInst)];
     rm(i);
     if (opcode == iTEST)
     {
@@ -671,16 +672,16 @@ static void arith(int i)
     }
     else if (!(opcode == iNOT || opcode == iNEG))
     {
-        pIcode->ic.ll.src = pIcode->ic.ll.dst;
+        pIcode->ll()->src = pIcode->ll()->dst;
         setAddress(i, TRUE, 0, rAX, 0);			/* dst = AX  */
     }
     else if (opcode == iNEG || opcode == iNOT)
-        pIcode->ic.ll.flg |= NO_SRC;
+        pIcode->ll()->SetLlFlag(NO_SRC);
 
     if ((opcode == iDIV) || (opcode == iIDIV))
     {
-        if ((pIcode->ic.ll.flg & B) != B)
-            pIcode->ic.ll.flg |= IM_TMP_DST;
+        if ( not pIcode->ll()->isLlFlag(B) )
+            pIcode->ll()->SetLlFlag(IM_TMP_DST);
     }
 }
 
@@ -690,8 +691,8 @@ static void arith(int i)
  *****************************************************************************/
 static void data1(int i)
 {
-    pIcode->ic.ll.src.SetImmediateOp( (stateTable[i].flg & S_EXT)? signex(*pInst++): *pInst++ );
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp( (stateTable[i].flg & S_EXT)? signex(*pInst++): *pInst++ );
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -701,21 +702,21 @@ static void data1(int i)
 static void data2(int )
 {
     if (relocItem(pInst))
-        pIcode->ic.ll.flg |= SEG_IMMED;
+        pIcode->ll()->SetLlFlag(SEG_IMMED);
 
     /* ENTER is a special case, it does not take a destination operand,
          * but this field is being used as the number of bytes to allocate
          * on the stack.  The procedure level is stored in the immediate
          * field.  There is no source operand; therefore, the flag flg is
          * set to NO_OPS.	*/
-    if (pIcode->ic.ll.opcode == iENTER)
+    if (pIcode->ll()->opcode == iENTER)
     {
-        pIcode->ic.ll.dst.off = getWord();
-        pIcode->ic.ll.flg |= NO_OPS;
+        pIcode->ll()->dst.off = getWord();
+        pIcode->ll()->SetLlFlag(NO_OPS);
     }
     else
-        pIcode->ic.ll.src.SetImmediateOp(getWord());
-    pIcode->ic.ll.flg |= I;
+        pIcode->ll()->src.SetImmediateOp(getWord());
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -739,8 +740,8 @@ static void dispN(int )
     /* Note: the result of the subtraction could be between 32k and 64k, and
         still be positive; it is an offset from prog.Image. So this must be
         treated as unsigned */
-    pIcode->ic.ll.src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -751,8 +752,8 @@ static void dispS(int )
 {
     long off = signex(*pInst++); 	/* Signed displacement */
 
-    pIcode->ic.ll.src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp((uint32_t)(off + (unsigned)(pInst - prog.Image)));
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -764,8 +765,8 @@ static void dispF(int )
     uint32_t off = (unsigned)getWord();
     uint32_t seg = (unsigned)getWord();
 
-    pIcode->ic.ll.src.SetImmediateOp(off + ((uint32_t)(unsigned)seg << 4));
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp(off + ((uint32_t)(unsigned)seg << 4));
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -775,10 +776,10 @@ static void dispF(int )
  ****************************************************************************/
 static void prefix(int )
 {
-    if (pIcode->ic.ll.opcode == iREPE || pIcode->ic.ll.opcode == iREPNE)
-        RepPrefix = pIcode->ic.ll.opcode;
+    if (pIcode->ll()->opcode == iREPE || pIcode->ll()->opcode == iREPNE)
+        RepPrefix = pIcode->ll()->opcode;
     else
-        SegPrefix = pIcode->ic.ll.opcode;
+        SegPrefix = pIcode->ll()->opcode;
 }
 
 inline void BumpOpcode(llIcode& ic)
@@ -793,15 +794,15 @@ static void strop(int )
 {
     if (RepPrefix)
     {
-        //		pIcode->ic.ll.opcode += ((pIcode->ic.ll.opcode == iCMPS ||
-        //								  pIcode->ic.ll.opcode == iSCAS)
+        //		pIcode->ll()->opcode += ((pIcode->ll()->opcode == iCMPS ||
+        //								  pIcode->ll()->opcode == iSCAS)
         //								&& RepPrefix == iREPE)? 2: 1;
-        if ((pIcode->ic.ll.opcode == iCMPS || pIcode->ic.ll.opcode == iSCAS)
+        if ((pIcode->ll()->opcode == iCMPS || pIcode->ll()->opcode == iSCAS)
                 && RepPrefix == iREPE)
-            BumpOpcode(pIcode->ic.ll.opcode);	// += 2
-        BumpOpcode(pIcode->ic.ll.opcode);		// else += 1
-        if (pIcode->ic.ll.opcode == iREP_LODS)
-            pIcode->ic.ll.flg |= NOT_HLL;
+            BumpOpcode(pIcode->ll()->opcode);	// += 2
+        BumpOpcode(pIcode->ll()->opcode);		// else += 1
+        if (pIcode->ll()->opcode == iREP_LODS)
+            pIcode->ll()->SetLlFlag(NOT_HLL);
         RepPrefix = 0;
     }
 }
@@ -812,8 +813,8 @@ static void strop(int )
  ***************************************************************************/
 static void escop(int i)
 {
-    pIcode->ic.ll.src.SetImmediateOp(REG(*pInst) + (uint32_t)((i & 7) << 3));
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp(REG(*pInst) + (uint32_t)((i & 7) << 3));
+    pIcode->ll()->SetLlFlag(I);
     rm(i);
 }
 
@@ -823,8 +824,8 @@ static void escop(int i)
  ****************************************************************************/
 static void const1(int )
 {
-    pIcode->ic.ll.src.SetImmediateOp(1);
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp(1);
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -833,8 +834,8 @@ static void const1(int )
  ****************************************************************************/
 static void const3(int )
 {
-    pIcode->ic.ll.src.SetImmediateOp(3);
-    pIcode->ic.ll.flg |= I;
+    pIcode->ll()->src.SetImmediateOp(3);
+    pIcode->ll()->SetLlFlag(I);
 }
 
 
@@ -851,8 +852,8 @@ static void none1(int )
  ****************************************************************************/
 static void none2(int )
 {
-    if (pIcode->ic.ll.flg & I)
-        pIcode->ic.ll.flg |= NO_OPS;
+    if ( pIcode->ll()->isLlFlag(I) )
+        pIcode->ll()->SetLlFlag(NO_OPS);
 }
 
 /****************************************************************************
@@ -860,14 +861,14 @@ static void none2(int )
  ****************************************************************************/
 static void checkInt(int )
 {
-    uint16_t wOp = (uint16_t) pIcode->ic.ll.src.op();
+    uint16_t wOp = (uint16_t) pIcode->ll()->src.op();
     if ((wOp >= 0x34) && (wOp <= 0x3B))
     {
         /* This is a Borland/Microsoft floating point emulation instruction.
             Treat as if it is an ESC opcode */
-        pIcode->ic.ll.src.SetImmediateOp(wOp - 0x34);
-        pIcode->ic.ll.opcode = iESC;
-        pIcode->ic.ll.flg |= FLOAT_OP;
+        pIcode->ll()->src.SetImmediateOp(wOp - 0x34);
+        pIcode->ll()->opcode = iESC;
+        pIcode->ll()->SetLlFlag(FLOAT_OP);
 
         escop(wOp - 0x34 + 0xD8);