diff --git a/include/icode.h b/include/icode.h index 62abb7b..073cbb5 100644 --- a/include/icode.h +++ b/include/icode.h @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include @@ -63,12 +61,7 @@ public: } friend void swap(LivenessSet& first, LivenessSet& second) // nothrow { - // enable ADL (not necessary in our case, but good practice) - using std::swap; - - // by swapping the members of two classes, - // the two classes are effectively swapped - swap(first.registers, second.registers); + std::swap(first.registers, second.registers); } LivenessSet &operator|=(const LivenessSet &other) { @@ -319,9 +312,10 @@ struct LLOperand bool compound() const {return is_compound;} // dx:ax pair size_t byteWidth() const { assert(width<=4); return width;} }; -struct LLInst : public llvm::MCInst //: public llvm::ilist_node +struct LLInst //: public llvm::ilist_node { protected: + uint32_t m_opcode; // Low level opcode identifier uint32_t flg; /* icode flags */ LLOperand m_src; /* source operand */ public: @@ -333,22 +327,25 @@ public: int caseEntry; std::vector caseTbl2; int hllLabNum; /* label # for hll codegen */ - bool conditionalJump() - { - return (getOpcode() >= iJB) and (getOpcode() < iJCXZ); - } - bool testFlags(uint32_t x) const { return (flg & x)!=0;} - void setFlags(uint32_t flag) {flg |= flag;} - void clrFlags(uint32_t flag) - { - if(getOpcode()==iMOD) - { - assert(false); - } - flg &= ~flag; - } - uint32_t getFlag() const {return flg;} - uint32_t GetLlLabel() const { return label;} + + uint32_t getOpcode() const { return m_opcode;} + void setOpcode(uint32_t op) { m_opcode=op; } + bool conditionalJump() + { + return (getOpcode() >= iJB) and (getOpcode() < iJCXZ); + } + bool testFlags(uint32_t x) const { return (flg & x)!=0;} + void setFlags(uint32_t flag) {flg |= flag;} + void clrFlags(uint32_t flag) + { + if(getOpcode()==iMOD) + { + assert(false); + } + flg &= ~flag; + } + uint32_t getFlag() const {return flg;} + uint32_t GetLlLabel() const { return label;} void SetImmediateOp(uint32_t dw) {m_src.SetImmediateOp(dw);} @@ -605,14 +602,14 @@ public: }; /** Map n low level instructions to m high level instructions */ -struct MappingLLtoML -{ - typedef llvm::iplist InstListType; - typedef boost::iterator_range rSourceRange; - typedef boost::iterator_range rTargetRange; - rSourceRange m_low_level; - rTargetRange m_middle_level; -}; +//struct MappingLLtoML +//{ +// typedef llvm::iplist InstListType; +// typedef boost::iterator_range rSourceRange; +// typedef boost::iterator_range rTargetRange; +// rSourceRange m_low_level; +// rTargetRange m_middle_level; +//}; // This is the icode array object. class CIcodeRec : public std::list { diff --git a/src/DccFrontend.cpp b/src/DccFrontend.cpp index 361e226..2e7d462 100644 --- a/src/DccFrontend.cpp +++ b/src/DccFrontend.cpp @@ -74,7 +74,7 @@ void PROG::displayLoadInfo(void) printf("Minimum allocation = %04X paras\n", LH(&header.minAlloc)); printf("Maximum allocation = %04X paras\n", LH(&header.maxAlloc)); } - printf("Load image size = %04" PRIiPTR "\n", cbImage - sizeof(PSP)); + printf("Load image size = %08lX\n", cbImage - sizeof(PSP)); printf("Initial SS:SP = %04X:%04X\n", initSS, initSP); printf("Initial CS:IP = %04X:%04X\n", initCS, initIP);