diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ace795..fb4c0db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,8 +27,8 @@ ENDIF() -find_package(LLVM REQUIRED CONFIG) -llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES native mc support tablegen) +#find_package(LLVM REQUIRED CONFIG) +#llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES native mc support tablegen) INCLUDE_DIRECTORIES( 3rd_party/libdisasm @@ -36,7 +36,6 @@ INCLUDE_DIRECTORIES( include/idioms common ${Boost_INCLUDE_DIRS} - ${LLVM_INCLUDE_DIRS} ) @@ -136,7 +135,7 @@ qt5_use_modules(dcc_lib Core) ADD_EXECUTABLE(dcc_original ${dcc_SOURCES} ${dcc_HEADERS}) ADD_DEPENDENCIES(dcc_original dcc_lib) -TARGET_LINK_LIBRARIES(dcc_original dcc_lib dcc_hash disasm_s ${REQ_LLVM_LIBRARIES} LLVMSupport) +TARGET_LINK_LIBRARIES(dcc_original dcc_lib dcc_hash disasm_s) qt5_use_modules(dcc_original Core) SET_PROPERTY(TARGET dcc_original PROPERTY CXX_STANDARD 11) SET_PROPERTY(TARGET dcc_original PROPERTY CXX_STANDARD_REQUIRED ON) diff --git a/include/BasicBlock.h b/include/BasicBlock.h index 8fc02ff..6609ccb 100644 --- a/include/BasicBlock.h +++ b/include/BasicBlock.h @@ -3,8 +3,6 @@ #include #include #include -#include -#include #include #include "icode.h" #include "types.h" @@ -27,7 +25,7 @@ struct TYPEADR_TYPE TYPEADR_TYPE(interval *v) : ip(0),BBptr(nullptr),intPtr(v) {} }; -struct BB : public llvm::ilist_node +struct BB { friend struct Function; private: diff --git a/include/Procedure.h b/include/Procedure.h index af7396a..427864f 100644 --- a/include/Procedure.h +++ b/include/Procedure.h @@ -6,8 +6,6 @@ #include "StackFrame.h" #include "CallConvention.h" -#include -//#include #include #include #include @@ -25,29 +23,6 @@ struct PROG; struct Function; -namespace llvm -{ -// Traits for intrusive list of basic blocks... -template<> -struct ilist_traits : public ilist_default_traits -{ - - // createSentinel is used to get hold of the node that marks the end of the - // list... (same trick used here as in ilist_traits) - BB *createSentinel() const { - return static_cast(&Sentinel); - } - static void destroySentinel(BB*) {} - - BB *provideInitialHead() const { return createSentinel(); } - BB *ensureHead(BB*) const { return createSentinel(); } - static void noteHead(BB*, BB*) {} - - //static ValueSymbolTable *getSymTab(Function *ItemParent); -private: - mutable ilist_half_node Sentinel; -}; -} /* Procedure FLAGS */ enum PROC_FLAGS { @@ -113,9 +88,9 @@ public: } void push_back(BB *v) { m_listBB.push_back(v);} }; -struct Function : public llvm::ilist_node +struct Function { - typedef llvm::iplist BasicBlockListType; + typedef std::list BasicBlockListType; // BasicBlock iterators... typedef BasicBlockListType::iterator iterator; typedef BasicBlockListType::const_iterator const_iterator; @@ -245,25 +220,6 @@ private: bool decodeIndirectJMP(ICODE &pIcode, STATE *pstate, CALL_GRAPH *pcallGraph); bool decodeIndirectJMP2(ICODE &pIcode, STATE *pstate, CALL_GRAPH *pcallGraph); }; -namespace llvm { -template<> struct ilist_traits - : public ilist_default_traits { - - // createSentinel is used to get hold of the node that marks the end of the - // list... (same trick used here as in ilist_traits) - typename ::Function *createSentinel() const { - return static_cast(&Sentinel); - } - static void destroySentinel(typename ::Function*) {} - - typename ::Function *provideInitialHead() const { return createSentinel(); } - typename ::Function *ensureHead(::Function*) const { return createSentinel(); } - static void noteHead(typename ::Function*, typename ::Function*) {} - -private: - mutable ilist_node Sentinel; -}; -} -typedef llvm::iplist FunctionListType; +typedef std::list FunctionListType; typedef FunctionListType lFunction; typedef lFunction::iterator ilFunction; diff --git a/include/dcc.h b/include/dcc.h index 9ede23d..a98f99e 100644 --- a/include/dcc.h +++ b/include/dcc.h @@ -5,7 +5,6 @@ #pragma once //TODO: Remove boolT -#include #include #include #include diff --git a/include/dcc_interface.h b/include/dcc_interface.h index 12488e1..f1ee4bc 100644 --- a/include/dcc_interface.h +++ b/include/dcc_interface.h @@ -3,7 +3,6 @@ #include #include -#include class IXmlTarget; diff --git a/include/icode.h b/include/icode.h index 073cbb5..5196f42 100644 --- a/include/icode.h +++ b/include/icode.h @@ -10,8 +10,6 @@ #include "state.h" // State depends on INDEXBASE, but later need STATE #include "CallConvention.h" -#include -#include #include #include @@ -312,7 +310,7 @@ struct LLOperand bool compound() const {return is_compound;} // dx:ax pair size_t byteWidth() const { assert(width<=4); return width;} }; -struct LLInst //: public llvm::ilist_node +struct LLInst { protected: uint32_t m_opcode; // Low level opcode identifier @@ -604,7 +602,6 @@ public: */ //struct MappingLLtoML //{ -// typedef llvm::iplist InstListType; // typedef boost::iterator_range rSourceRange; // typedef boost::iterator_range rTargetRange; // rSourceRange m_low_level; @@ -616,10 +613,10 @@ class CIcodeRec : public std::list public: CIcodeRec(); // Constructor - ICODE * addIcode(ICODE *pIcode); - void SetInBB(rCODE &rang, BB* pnewBB); - bool labelSrch(uint32_t target, uint32_t &pIndex); + ICODE * addIcode(ICODE *pIcode); + void SetInBB(rCODE &rang, BB* pnewBB); + bool labelSrch(uint32_t target, uint32_t &pIndex); iterator labelSrch(uint32_t target); - ICODE * GetIcode(size_t ip); + ICODE * GetIcode(size_t ip); bool alreadyDecoded(uint32_t target); }; diff --git a/include/project.h b/include/project.h index b232c23..bcf21e2 100644 --- a/include/project.h +++ b/include/project.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -29,7 +28,7 @@ class Project : public IProject QString m_output_path; public: - typedef llvm::iplist FunctionListType; + typedef std::list FunctionListType; typedef FunctionListType lFunction; typedef FunctionListType::iterator ilFunction; diff --git a/src/dcc.cpp b/src/dcc.cpp index 3c2aefb..a43d7c3 100644 --- a/src/dcc.cpp +++ b/src/dcc.cpp @@ -16,22 +16,6 @@ #include #include -#ifdef LLVM_EXPERIMENTAL -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif #include @@ -46,79 +30,6 @@ static void displayTotalStats(void); /**************************************************************************** * main ***************************************************************************/ -#ifdef LLVM_EXPERIMENTAL -using namespace llvm; -bool TVisitor(raw_ostream &OS, RecordKeeper &Records) -{ - Record *rec = Records.getDef("ADD8i8"); - if(rec) - { - if(not rec->getTemplateArgs().empty()) - std::cout << "Has template args\n"; - auto classes(rec->getSuperClasses()); - for(auto val : rec->getSuperClasses()) - std::cout << "Super "<getName()<<"\n"; - - // DagInit * in = rec->getValueAsDag(val.getName()); - // in->dump(); - for(const RecordVal &val : rec->getValues()) - { - // val.dump(); - } - rec->dump(); - - } - // rec = Records.getDef("CCR"); - // if(rec) - // rec->dump(); -// for(auto val : Records.getDefs()) -// { -// //std::cout<< "Def "<createTargetMachine(TheTriple.getTriple(),MCPU,Features,opts); -// std::cerr<getInstrInfo()->getName(97)<<"\n"; -// const MCInstrDesc &ds(tm->getInstrInfo()->get(97)); -// const MCOperandInfo *op1=ds.OpInfo; -// uint16_t impl_def = ds.getImplicitDefs()[0]; -// std::cerr<