Removing LLVM dependencies WIP

This commit is contained in:
nemerle 2016-05-19 11:14:46 +02:00
parent 7f4197acc1
commit 7d986ef661
2 changed files with 31 additions and 34 deletions

View File

@ -12,8 +12,6 @@
#include <llvm/ADT/ilist.h> #include <llvm/ADT/ilist.h>
#include <llvm/ADT/ilist_node.h> #include <llvm/ADT/ilist_node.h>
#include <llvm/MC/MCInst.h>
#include <llvm/IR/Instruction.h>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>
#include <QtCore/QString> #include <QtCore/QString>
@ -63,12 +61,7 @@ public:
} }
friend void swap(LivenessSet& first, LivenessSet& second) // nothrow friend void swap(LivenessSet& first, LivenessSet& second) // nothrow
{ {
// enable ADL (not necessary in our case, but good practice) std::swap(first.registers, second.registers);
using std::swap;
// by swapping the members of two classes,
// the two classes are effectively swapped
swap(first.registers, second.registers);
} }
LivenessSet &operator|=(const LivenessSet &other) LivenessSet &operator|=(const LivenessSet &other)
{ {
@ -319,9 +312,10 @@ struct LLOperand
bool compound() const {return is_compound;} // dx:ax pair bool compound() const {return is_compound;} // dx:ax pair
size_t byteWidth() const { assert(width<=4); return width;} size_t byteWidth() const { assert(width<=4); return width;}
}; };
struct LLInst : public llvm::MCInst //: public llvm::ilist_node<LLInst> struct LLInst //: public llvm::ilist_node<LLInst>
{ {
protected: protected:
uint32_t m_opcode; // Low level opcode identifier
uint32_t flg; /* icode flags */ uint32_t flg; /* icode flags */
LLOperand m_src; /* source operand */ LLOperand m_src; /* source operand */
public: public:
@ -333,6 +327,9 @@ public:
int caseEntry; int caseEntry;
std::vector<uint32_t> caseTbl2; std::vector<uint32_t> caseTbl2;
int hllLabNum; /* label # for hll codegen */ int hllLabNum; /* label # for hll codegen */
uint32_t getOpcode() const { return m_opcode;}
void setOpcode(uint32_t op) { m_opcode=op; }
bool conditionalJump() bool conditionalJump()
{ {
return (getOpcode() >= iJB) and (getOpcode() < iJCXZ); return (getOpcode() >= iJB) and (getOpcode() < iJCXZ);
@ -605,14 +602,14 @@ public:
}; };
/** Map n low level instructions to m high level instructions /** Map n low level instructions to m high level instructions
*/ */
struct MappingLLtoML //struct MappingLLtoML
{ //{
typedef llvm::iplist<llvm::Instruction> InstListType; // typedef llvm::iplist<llvm::Instruction> InstListType;
typedef boost::iterator_range<iICODE> rSourceRange; // typedef boost::iterator_range<iICODE> rSourceRange;
typedef boost::iterator_range<InstListType::iterator> rTargetRange; // typedef boost::iterator_range<InstListType::iterator> rTargetRange;
rSourceRange m_low_level; // rSourceRange m_low_level;
rTargetRange m_middle_level; // rTargetRange m_middle_level;
}; //};
// This is the icode array object. // This is the icode array object.
class CIcodeRec : public std::list<ICODE> class CIcodeRec : public std::list<ICODE>
{ {

View File

@ -74,7 +74,7 @@ void PROG::displayLoadInfo(void)
printf("Minimum allocation = %04X paras\n", LH(&header.minAlloc)); printf("Minimum allocation = %04X paras\n", LH(&header.minAlloc));
printf("Maximum allocation = %04X paras\n", LH(&header.maxAlloc)); 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 SS:SP = %04X:%04X\n", initSS, initSP);
printf("Initial CS:IP = %04X:%04X\n", initCS, initIP); printf("Initial CS:IP = %04X:%04X\n", initCS, initIP);