Removing LLVM dependency contd.
This commit is contained in:
parent
7d986ef661
commit
58532f4402
@ -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)
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <llvm/ADT/ilist.h>
|
||||
#include <llvm/ADT/ilist_node.h>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#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<BB>
|
||||
struct BB
|
||||
{
|
||||
friend struct Function;
|
||||
private:
|
||||
|
||||
@ -6,8 +6,6 @@
|
||||
#include "StackFrame.h"
|
||||
#include "CallConvention.h"
|
||||
|
||||
#include <llvm/ADT/ilist.h>
|
||||
//#include <llvm/ADT/ilist_node.h>
|
||||
#include <QtCore/QString>
|
||||
#include <bitset>
|
||||
#include <map>
|
||||
@ -25,29 +23,6 @@ struct PROG;
|
||||
|
||||
struct Function;
|
||||
|
||||
namespace llvm
|
||||
{
|
||||
// Traits for intrusive list of basic blocks...
|
||||
template<>
|
||||
struct ilist_traits<BB> : public ilist_default_traits<BB>
|
||||
{
|
||||
|
||||
// createSentinel is used to get hold of the node that marks the end of the
|
||||
// list... (same trick used here as in ilist_traits<Instruction>)
|
||||
BB *createSentinel() const {
|
||||
return static_cast<BB*>(&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<BB> 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<Function>
|
||||
struct Function
|
||||
{
|
||||
typedef llvm::iplist<BB> BasicBlockListType;
|
||||
typedef std::list<BB *> 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<typename ::Function>
|
||||
: public ilist_default_traits<typename ::Function> {
|
||||
|
||||
// createSentinel is used to get hold of the node that marks the end of the
|
||||
// list... (same trick used here as in ilist_traits<Instruction>)
|
||||
typename ::Function *createSentinel() const {
|
||||
return static_cast<typename ::Function*>(&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<typename ::Function> Sentinel;
|
||||
};
|
||||
}
|
||||
typedef llvm::iplist<Function> FunctionListType;
|
||||
typedef std::list<Function> FunctionListType;
|
||||
typedef FunctionListType lFunction;
|
||||
typedef lFunction::iterator ilFunction;
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
#pragma once
|
||||
//TODO: Remove boolT
|
||||
|
||||
#include <llvm/ADT/ilist.h>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QDir>
|
||||
#include <llvm/ADT/ilist.h>
|
||||
|
||||
class IXmlTarget;
|
||||
|
||||
|
||||
@ -10,8 +10,6 @@
|
||||
#include "state.h" // State depends on INDEXBASE, but later need STATE
|
||||
#include "CallConvention.h"
|
||||
|
||||
#include <llvm/ADT/ilist.h>
|
||||
#include <llvm/ADT/ilist_node.h>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <QtCore/QString>
|
||||
|
||||
@ -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<LLInst>
|
||||
struct LLInst
|
||||
{
|
||||
protected:
|
||||
uint32_t m_opcode; // Low level opcode identifier
|
||||
@ -604,7 +602,6 @@ public:
|
||||
*/
|
||||
//struct MappingLLtoML
|
||||
//{
|
||||
// typedef llvm::iplist<llvm::Instruction> InstListType;
|
||||
// typedef boost::iterator_range<iICODE> rSourceRange;
|
||||
// typedef boost::iterator_range<InstListType::iterator> rTargetRange;
|
||||
// rSourceRange m_low_level;
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
#include <stdint.h>
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
#include <llvm/ADT/ilist.h>
|
||||
#include <boost/icl/interval.hpp>
|
||||
#include <boost/icl/interval_map.hpp>
|
||||
#include <boost/icl/split_interval_map.hpp>
|
||||
@ -29,7 +28,7 @@ class Project : public IProject
|
||||
QString m_output_path;
|
||||
public:
|
||||
|
||||
typedef llvm::iplist<Function> FunctionListType;
|
||||
typedef std::list<Function> FunctionListType;
|
||||
typedef FunctionListType lFunction;
|
||||
typedef FunctionListType::iterator ilFunction;
|
||||
|
||||
|
||||
89
src/dcc.cpp
89
src/dcc.cpp
@ -16,22 +16,6 @@
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
#ifdef LLVM_EXPERIMENTAL
|
||||
#include <llvm/Support/raw_os_ostream.h>
|
||||
#include <llvm/Support/CommandLine.h>
|
||||
#include <llvm/Support/TargetSelect.h>
|
||||
#include <llvm/Support/TargetRegistry.h>
|
||||
#include <llvm/Support/PrettyStackTrace.h>
|
||||
#include <llvm/Support/Signals.h>
|
||||
#include <llvm/Support/Host.h>
|
||||
#include <llvm/Target/TargetMachine.h>
|
||||
#include <llvm/Target/TargetInstrInfo.h>
|
||||
#include <llvm/MC/MCAsmInfo.h>
|
||||
#include <llvm/CodeGen/MachineInstrBuilder.h>
|
||||
#include <llvm/TableGen/Main.h>
|
||||
#include <llvm/TableGen/TableGenBackend.h>
|
||||
#include <llvm/TableGen/Record.h>
|
||||
#endif
|
||||
#include <QtCore/QFile>
|
||||
|
||||
|
||||
@ -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 "<<val->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 "<<val.first<<"\n";
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
int testTblGen(int argc, char **argv)
|
||||
{
|
||||
// using namespace llvm;
|
||||
// sys::PrintStackTraceOnErrorSignal();
|
||||
// PrettyStackTraceProgram(argc,argv);
|
||||
// cl::ParseCommandLineOptions(argc,argv);
|
||||
// return llvm::TableGenMain(argv[0],TVisitor);
|
||||
// InitializeNativeTarget();
|
||||
// Triple TheTriple;
|
||||
// std::string def = sys::getDefaultTargetTriple();
|
||||
// std::string MCPU="i386";
|
||||
// std::string MARCH="x86";
|
||||
// InitializeAllTargetInfos();
|
||||
// InitializeAllTargetMCs();
|
||||
// InitializeAllAsmPrinters();
|
||||
// InitializeAllAsmParsers();
|
||||
// InitializeAllDisassemblers();
|
||||
// std::string TargetTriple("i386-pc-linux-gnu");
|
||||
// TheTriple = Triple(Triple::normalize(TargetTriple));
|
||||
// MCOperand op=llvm::MCOperand::CreateImm(11);
|
||||
// MCAsmInfo info;
|
||||
// raw_os_ostream wrap(std::cerr);
|
||||
// op.print(wrap,&info);
|
||||
// wrap.flush();
|
||||
// std::cerr<<"\n";
|
||||
// std::string lookuperr;
|
||||
// TargetRegistry::printRegisteredTargetsForVersion();
|
||||
// const Target *t = TargetRegistry::lookupTarget(MARCH,TheTriple,lookuperr);
|
||||
// TargetOptions opts;
|
||||
// std::string Features;
|
||||
// opts.PrintMachineCode=1;
|
||||
// TargetMachine *tm = t->createTargetMachine(TheTriple.getTriple(),MCPU,Features,opts);
|
||||
// std::cerr<<tm->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<<lookuperr<<"\n";
|
||||
|
||||
// exit(0);
|
||||
|
||||
}
|
||||
#endif
|
||||
void setupOptions(QCoreApplication &app) {
|
||||
//[-a1a2cmsi]
|
||||
QCommandLineParser parser;
|
||||
|
||||
@ -56,7 +56,7 @@ return iter;
|
||||
|
||||
ilFunction Project::createFunction(FunctionType *f,const QString &name)
|
||||
{
|
||||
pProcList.push_back(Function::Create(f,0,name,0));
|
||||
pProcList.push_back(*Function::Create(f,0,name,0));
|
||||
return (++pProcList.rbegin()).base();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user