Added setters/creation methods to LLOperand

Moved PROG global into Project instance. Still need to refactor all
usages of prog.
Split fseek offset calculation in frontend.cpp to allow for easier
debugging.
Added alreadyDecoded method to CIcodeRec
LONGID_TYPE now has a method matching srcDstRegMatch icode's src a dst
regs
This commit is contained in:
Artur K
2012-03-17 22:57:54 +01:00
parent dc8e7156a8
commit 26b9ab1e00
16 changed files with 89 additions and 16 deletions

View File

@@ -63,7 +63,7 @@ extern OPTION option; /* Command line options */
#include "BinaryImage.h"
extern PROG prog; /* Loaded program image parameters */
//extern PROG prog; /* Loaded program image parameters */
extern std::bitset<32> duReg[30]; /* def/use bits for registers */
//extern uint32_t duReg[30]; /* def/use bits for registers */

View File

@@ -186,10 +186,30 @@ struct LLOperand
proc.cb=0;
}
uint32_t op() const {return opz;}
void SetImmediateOp(uint32_t dw) {opz=dw;}
int64_t getImm2() const {return opz;}
void SetImmediateOp(uint32_t dw)
{
opz=dw;
}
eReg getReg2() {return regi;}
bool isReg() const;
static LLOperand CreateImm2(int64_t Val)
{
LLOperand Op;
//Op.Kind = kImmediate;
//Op.ImmVal = Val;
Op.opz = Val;
return Op;
}
static LLOperand CreateReg2(unsigned Val)
{
LLOperand Op;
// Op.Kind = kRegister;
// Op.RegVal = Reg;
Op.regi = (eReg)Val;
return Op;
}
void addProcInformation(int param_count,uint32_t call_conv);
};
struct LLInst : public llvm::MCInst //: public llvm::ilist_node<LLInst>
{
@@ -280,6 +300,14 @@ public:
caseTbl.numEntries=0;
setOpcode(0);
}
void replaceDst(const LLOperand &with)
{
dst = with;
}
void replaceDst(eReg r)
{
dst = LLOperand::CreateReg2(r);
}
ICODE *m_link;
};
@@ -438,9 +466,9 @@ public:
CIcodeRec(); // Constructor
ICODE * addIcode(ICODE *pIcode);
void SetInBB(int start, int end, BB* pnewBB);
void SetInBB(rCODE &rang, BB* pnewBB);
bool labelSrch(uint32_t target, uint32_t &pIndex);
iterator labelSrch(uint32_t target);
ICODE * GetIcode(int ip);
bool alreadyDecoded(uint32_t target);
};