From 5c55f990b7ba41f5a23556c2779dbca417f6cde7 Mon Sep 17 00:00:00 2001 From: Artur K Date: Mon, 12 Dec 2011 21:54:56 +0100 Subject: [PATCH] changed temporary ICODE buffer in disassem.cpp from ICODE * to CIcodeRec --- include/dcc.h | 2 +- src/dataflow.cpp | 5 ++--- src/disassem.cpp | 8 ++++---- src/parser.cpp | 5 +++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/dcc.h b/include/dcc.h index 4777d7e..8822e13 100644 --- a/include/dcc.h +++ b/include/dcc.h @@ -170,7 +170,7 @@ void BackEnd(char *filename, CALL_GRAPH *); /* backend.c */ char *cChar(byte c); /* backend.c */ Int scan(dword ip, ICODE * p); /* scanner.c */ void parse (CALL_GRAPH * *); /* parser.c */ -boolT labelSrch(ICODE * pIc, Int n, dword tg, Int *pIdx); /* parser.c */ +boolT labelSrch(CIcodeRec &pIc, Int n, dword tg, Int *pIdx); /* parser.c */ Int strSize (byte *, char); /* parser.c */ void disassem(Int pass, Function * pProc); /* disassem.c */ void interactDis(Function * initProc, Int initIC); /* disassem.c */ diff --git a/src/dataflow.cpp b/src/dataflow.cpp index 26806c7..c48ffa7 100644 --- a/src/dataflow.cpp +++ b/src/dataflow.cpp @@ -573,7 +573,7 @@ static boolT xClear (COND_EXPR *rhs, Int f, Int t, Int lastBBinst, Function * pp case IDENTIFIER: if (rhs->expr.ident.idType == REGISTER) { - picode = pproc->Icode.GetFirstIcode(); + picode = &pproc->Icode.front(); regi= pproc->localId.id_arr[rhs->expr.ident.idNode.regiIdx].id.regi; for (i = (f + 1); (i < lastBBinst) && (i < t); i++) if ((picode[i].type == HIGH_LEVEL) && @@ -703,8 +703,7 @@ void Function::findExps() (ticode->ic.hl.opcode != HLI_RET))) continue; - if (xClear (picode->ic.hl.oper.asgn.rhs, j, - picode->du1.idx[0][0], lastInst, this)) + if (xClear (picode->ic.hl.oper.asgn.rhs, j, picode->du1.idx[0][0], lastInst, this)) { switch (ticode->ic.hl.opcode) { case HLI_ASSIGN: diff --git a/src/disassem.cpp b/src/disassem.cpp index de1e322..d9774ea 100644 --- a/src/disassem.cpp +++ b/src/disassem.cpp @@ -138,7 +138,7 @@ static void flops(ICODE * pi); boolT callArg(word off, char *temp); /* Check for procedure name */ static FILE *fp; -static ICODE * pc; +static CIcodeRec pc; static char buf[200], *p; static Int cb, j, numIcode, allocIcode, eop; static vector pl; @@ -199,10 +199,10 @@ void disassem(Int pass, Function * ppProc) fatalError(CANNOT_OPEN, p); } } - + pc=pProc->Icode; /* Create temporary code array */ // Mike: needs objectising! - pc = (ICODE *)memcpy(allocMem(cb), pProc->Icode.GetFirstIcode(), (size_t)cb); + //pc = (ICODE *)memcpy(allocMem(cb), pProc->Icode.GetFirstIcode(), (size_t)cb); if (pass == 1) { @@ -249,7 +249,7 @@ void disassem(Int pass, Function * ppProc) fclose(fp); } - free(pc); + pc.clear(); destroySymTables(); } diff --git a/src/parser.cpp b/src/parser.cpp index 296304d..61bea46 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -687,7 +687,8 @@ static hlType cbType[] = {TYPE_UNKNOWN, TYPE_BYTE_UNSIGN, TYPE_WORD_SIGN, * is checked and updated if the old size was less than the new size (ie. * the maximum size is always saved). */ static SYM * updateGlobSym (dword operand, Int size, word duFlag) -{ Int i; +{ + Int i; /* Check for symbol in symbol table */ for (i = 0; i < symtab.csym; i++) @@ -849,7 +850,7 @@ void STATE::setState(word reg, int16 value) /* labelSrchRepl - Searches Icode for instruction with label = target, and replaces *pIndex with an icode index */ -boolT labelSrch(ICODE *pIcode, Int numIp, dword target, Int *pIndex) +boolT labelSrch(CIcodeRec &pIcode, Int numIp, dword target, Int *pIndex) { Int i;