From 95ec23eceb1678df2af268d5e6cc7082ec70765f Mon Sep 17 00:00:00 2001 From: Artur K Date: Fri, 24 Feb 2012 03:22:49 +0100 Subject: [PATCH] llvm - --- include/icode.h | 8 +++----- src/ast.cpp | 4 ++-- src/disassem.cpp | 8 ++++---- src/idioms.cpp | 4 ++-- src/locident.cpp | 6 +++--- src/parser.cpp | 10 +++++----- src/proplong.cpp | 4 ++-- src/scanner.cpp | 2 +- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/include/icode.h b/include/icode.h index dfec0bc..91bca85 100644 --- a/include/icode.h +++ b/include/icode.h @@ -273,7 +273,7 @@ struct HLTYPE } oper; /* operand */ } ; /* LOW_LEVEL icode operand record */ -struct LLOpcode : public llvm::MCOperand +struct LLOperand //: public llvm::MCOperand { byte seg; /* CS, DS, ES, SS */ int16 segValue; /* Value of segment seg during analysis */ @@ -282,12 +282,10 @@ struct LLOpcode : public llvm::MCOperand int16 off; /* memory address offset */ dword opz; /* idx of immed src op */ //union {/* Source operand if (flg & I) */ - //dword opz; /* idx of immed src op */ struct { /* Call & # actual arg bytes */ Function *proc; /* pointer to target proc (for CALL(F))*/ int cb; /* # actual arg bytes */ } proc; - //} immed; dword op() const {return opz;} void SetImmediateOp(dword dw) {opz=dw;} @@ -298,8 +296,8 @@ struct LLInst : public llvm::MCInst byte numBytes; /* Number of bytes this instr */ flags32 flg; /* icode flags */ dword label; /* offset in image (20-bit adr) */ - LLOpcode dst; /* destination operand */ - LLOpcode src; /* source operand */ + LLOperand dst; /* destination operand */ + LLOperand src; /* source operand */ DU flagDU; /* def/use of flags */ struct { /* Case table if op==JMP && !I */ Int numEntries; /* # entries in case table */ diff --git a/src/ast.cpp b/src/ast.cpp index 5046645..68e70c0 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -350,7 +350,7 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, Int i, Int idx; /* idx into pIcode->localId table */ - const LLOpcode &pm((sd == SRC) ? pIcode.ic.ll.src : pIcode.ic.ll.dst); + const LLOperand &pm((sd == SRC) ? pIcode.ic.ll.src : pIcode.ic.ll.dst); if ( ((sd == DST) && pIcode.ic.ll.anyFlagSet(IM_DST)) or ((sd == SRC) && pIcode.ic.ll.anyFlagSet(IM_SRC)) or @@ -434,7 +434,7 @@ COND_EXPR *COND_EXPR::id(const ICODE &pIcode, opLoc sd, Function * pProc, Int i, /* Returns the identifier type */ condId ICODE::idType(opLoc sd) { - LLOpcode &pm((sd == SRC) ? ic.ll.src : ic.ll.dst); + LLOperand &pm((sd == SRC) ? ic.ll.src : ic.ll.dst); if ((sd == SRC) && ((ic.ll.flg & I) == I)) return (CONSTANT); diff --git a/src/disassem.cpp b/src/disassem.cpp index ace4318..d1bed2b 100644 --- a/src/disassem.cpp +++ b/src/disassem.cpp @@ -129,8 +129,8 @@ static const char *szPtr[2] = { "word ptr ", "byte ptr " }; static void dis1Line (Int i, Int pass); void dis1LineOp(Int i, boolT fWin, char attr, word *len, Function * pProc); -static void formatRM(ostringstream &p, flags32 flg, LLOpcode *pm); -static ostringstream &strDst(ostringstream &os, flags32 flg, LLOpcode *pm); +static void formatRM(ostringstream &p, flags32 flg, LLOperand *pm); +static ostringstream &strDst(ostringstream &os, flags32 flg, LLOperand *pm); static ostringstream &strSrc(ostringstream &os, ICODE *pc, bool skip_comma=false); static char *strHex(dword d); static Int checkScanned(dword pcCur); @@ -599,7 +599,7 @@ static void dis1Line(Int i, Int pass) /**************************************************************************** * formatRM ***************************************************************************/ -static void formatRM(std::ostringstream &p, flags32 flg, LLOpcode *pm) +static void formatRM(std::ostringstream &p, flags32 flg, LLOperand *pm) { char seg[4]; @@ -646,7 +646,7 @@ static void formatRM(std::ostringstream &p, flags32 flg, LLOpcode *pm) /***************************************************************************** * strDst ****************************************************************************/ -static ostringstream & strDst(ostringstream &os,flags32 flg, LLOpcode *pm) +static ostringstream & strDst(ostringstream &os,flags32 flg, LLOperand *pm) { /* Immediates to memory require size descriptor */ //os << setw(WID_PTR); diff --git a/src/idioms.cpp b/src/idioms.cpp index 8f68fd7..49dcd9a 100644 --- a/src/idioms.cpp +++ b/src/idioms.cpp @@ -457,7 +457,7 @@ static boolT idiom6 (iICODE pIcode, iICODE pEnd) ****************************************************************************/ static boolT idiom7 (iICODE pIcode) { - LLOpcode *dst, *src; + LLOperand *dst, *src; dst = &pIcode->ic.ll.dst; src = &pIcode->ic.ll.src; @@ -497,7 +497,7 @@ static boolT idiom7 (iICODE pIcode) ****************************************************************************/ static boolT idiom21 (iICODE picode, iICODE pend) { - LLOpcode *dst, *src; + LLOperand *dst, *src; dst = &picode->ic.ll.dst; src = &picode->ic.ll.src; diff --git a/src/locident.cpp b/src/locident.cpp index 8815aab..4bad01f 100644 --- a/src/locident.cpp +++ b/src/locident.cpp @@ -252,7 +252,7 @@ Int LOCAL_ID::newLongStk(hlType t, Int offH, Int offL) Int LOCAL_ID::newLong(opLoc sd, ICODE *pIcode, hlFirst f, Int ix,operDu du, Int off) { Int idx; - LLOpcode *pmH, *pmL; + LLOperand *pmH, *pmL; if (f == LOW_FIRST) { @@ -308,7 +308,7 @@ Int LOCAL_ID::newLong(opLoc sd, ICODE *pIcode, hlFirst f, Int ix,operDu du, Int boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i, Int idx, Function * pProc, COND_EXPR **rhs, COND_EXPR **lhs, Int off) { - LLOpcode *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ + LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ pmHdst = &pIcode->ic.ll.dst; pmLdst = &(pIcode+off)->ic.ll.dst; @@ -346,7 +346,7 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, Int i, Int idx, boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, Int i, Int idx, Function * pProc, COND_EXPR *&rhs, COND_EXPR *&lhs, Int off) { - LLOpcode *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ + LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc; /* pointers to LOW_LEVEL icodes */ pmHdst = &pIcode->ic.ll.dst; pmLdst = &(pIcode+off)->ic.ll.dst; diff --git a/src/parser.cpp b/src/parser.cpp index 99ab69d..780b941 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -21,7 +21,7 @@ static void process_operands(ICODE * pIcode, Function * pProc, STATE * pstat static void setBits(int16 type, dword start, dword len); static SYM * updateGlobSym(dword operand, Int size, word duFlag); static void process_MOV(ICODE * pIcode, STATE * pstate); -static SYM * lookupAddr (LLOpcode *pm, STATE * pstate, Int size, word duFlag); +static SYM * lookupAddr (LLOperand *pm, STATE * pstate, Int size, word duFlag); void interactDis(Function * initProc, Int ic); static dword SynthLab; @@ -777,7 +777,7 @@ static void updateFrameOff (STKFRAME * ps, int16 off, Int size, word duFlag) * if necessary. * Returns a pointer to the symbol in the * symbol table, or Null if it's not a direct memory offset. */ -static SYM * lookupAddr (LLOpcode *pm, STATE *pstate, Int size, word duFlag) +static SYM * lookupAddr (LLOperand *pm, STATE *pstate, Int size, word duFlag) { Int i; SYM * psym; @@ -912,7 +912,7 @@ dword duReg[] = { 0x00, * ix : current index into icode array */ static void use (opLoc d, ICODE * pIcode, Function * pProc, STATE * pstate, Int size, Int ix) { - LLOpcode * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; + LLOperand * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; SYM * psym; if (pm->regi == 0 || pm->regi >= INDEXBASE) @@ -959,7 +959,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) { - LLOpcode *pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; + LLOperand *pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; SYM * psym; if (pm->regi == 0 || pm->regi >= INDEXBASE) @@ -1011,7 +1011,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) { - LLOpcode * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; + LLOperand * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; use (d, pIcode, pProc, pstate, cb, ix); diff --git a/src/proplong.cpp b/src/proplong.cpp index b78a884..8e9ae4c 100644 --- a/src/proplong.cpp +++ b/src/proplong.cpp @@ -302,7 +302,7 @@ void checkBack(); int Function::checkBackwarLongDefs(int loc_ident_idx, ID *pLocId, int pLocId_idx,Assignment &asgn) { int idx; - LLOpcode * pmH,* pmL; + LLOperand * pmH,* pmL; iICODE pIcode; for (idx = pLocId_idx - 1; idx > 0 ; idx--) { @@ -397,7 +397,7 @@ void Function::propLongReg (Int loc_ident_idx, ID *pLocId) for (idx = pLocId_idx + 1; idx < Icode.size() - 1; idx++) { iICODE pIcode; - LLOpcode * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */ + LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */ int off,arc; pIcode = Icode.begin()+(idx); if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE)) diff --git a/src/scanner.cpp b/src/scanner.cpp index a44c4e5..4eda1cf 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -403,7 +403,7 @@ static Int signex(byte b) ***************************************************************************/ static void setAddress(Int i, boolT fdst, word seg, int16 reg, word off) { - LLOpcode *pm; + LLOperand *pm; /* If not to register (i.e. to r/m), and talking about r/m, then this is dest */