Merge branch 'qt5' into experimental_command_streams

This commit is contained in:
nemerle
2016-05-19 15:57:52 +02:00
21 changed files with 58 additions and 93 deletions

View File

@@ -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:

View File

@@ -1,6 +1,9 @@
#pragma once
#include "ast.h"
#ifdef PASCAL
#undef PASCAL
#endif
class QTextStream;
struct CConv {

View File

@@ -90,9 +90,9 @@ enum eLLFlags
/* Types of icodes */
enum icodeType
{
NOT_SCANNED = 0, // not even scanned yet
LOW_LEVEL, // low-level icode
HIGH_LEVEL // high-level icode
NOT_SCANNED_ICODE = 0, // not even scanned yet
LOW_LEVEL_ICODE, // low-level icode
HIGH_LEVEL_ICODE // high-level icode
};

View File

@@ -6,7 +6,6 @@
#include "StackFrame.h"
#include "CallConvention.h"
#include <llvm/ADT/ilist.h>
#include <memory>
#include <stdint.h>
#include <QtCore/QString>
@@ -26,29 +25,6 @@ struct PROG;
struct IStructuredTextTarget;
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
{
@@ -155,7 +131,7 @@ enum DecompilationStep : uint32_t {
class Function : public std::enable_shared_from_this<Function>
{
typedef llvm::iplist<BB> BasicBlockListType;
typedef std::list<BB *> BasicBlockListType;
// BasicBlock iterators...
typedef BasicBlockListType::iterator iterator;
typedef BasicBlockListType::const_iterator const_iterator;
@@ -284,7 +260,6 @@ protected:
bool nextOrderGraph(derSeq &derivedGi);
void addOutEdgesForConditionalJump(BB *pBB, int next_ip, LLInst *ll);
};
typedef std::list<PtrFunction> FunctionListType;
typedef FunctionListType lFunction;
typedef lFunction::iterator ilFunction;

View File

@@ -5,7 +5,6 @@
#pragma once
//TODO: Remove boolT
#include <llvm/ADT/ilist.h>
#include <utility>
#include <algorithm>
#include <bitset>

View File

@@ -3,7 +3,6 @@
#include <QtCore/QObject>
#include <QtCore/QDir>
#include <llvm/ADT/ilist.h>
class IStructuredTextTarget;

View File

@@ -10,10 +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 <llvm/MC/MCInst.h>
#include <llvm/IR/Instruction.h>
#include <boost/range/iterator_range.hpp>
#include <QtCore/QString>
@@ -63,12 +59,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 +310,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<LLInst>
struct LLInst
{
protected:
uint32_t m_opcode; // Low level opcode identifier
uint32_t flg; /* icode flags */
LLOperand m_src; /* source operand */
public:
@@ -333,6 +325,9 @@ public:
int caseEntry;
std::vector<uint32_t> caseTbl2;
int hllLabNum; /* label # for hll codegen */
uint32_t getOpcode() const { return m_opcode;}
void setOpcode(uint32_t op) { m_opcode=op; }
bool conditionalJump()
{
return (getOpcode() >= iJB) and (getOpcode() < iJCXZ);
@@ -469,8 +464,8 @@ public:
bool operator()(ICODE *ic) {return (ic->type==TYPE) and (ic->valid());}
bool operator()(ICODE &ic) {return (ic.type==TYPE) and ic.valid();}
};
static TypeFilter<HIGH_LEVEL> select_high_level;
static TypeAndValidFilter<HIGH_LEVEL> select_valid_high_level;
static TypeFilter<HIGH_LEVEL_ICODE> select_high_level;
static TypeAndValidFilter<HIGH_LEVEL_ICODE> select_valid_high_level;
/* Def/Use of registers and stack variables */
struct DU_ICODE
{
@@ -572,7 +567,7 @@ public:
// set this icode to be an assign
void setAsgn(Expr *lhs, Expr *rhs)
{
type=HIGH_LEVEL;
type=HIGH_LEVEL_ICODE;
hlU()->setAsgn(lhs,rhs);
}
void setUnary(hlIcode op, Expr *_exp);
@@ -589,7 +584,7 @@ public:
{
return hlU()->call.newStkArg(exp,opcode,pproc);
}
ICODE() :Parent(0),invalid(false),type(NOT_SCANNED),loc_ip(0)
ICODE() :Parent(0),invalid(false),type(NOT_SCANNED_ICODE),loc_ip(0)
{
m_ll = new LLInst(this);
}
@@ -638,14 +633,13 @@ public:
};
/** Map n low level instructions to m high level instructions
*/
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;
rTargetRange m_middle_level;
};
//struct MappingLLtoML
//{
// typedef boost::iterator_range<iICODE> rSourceRange;
// typedef boost::iterator_range<InstListType::iterator> rTargetRange;
// rSourceRange m_low_level;
// rTargetRange m_middle_level;
//};
// This is the icode array object.
class CIcodeRec : public std::list<ICODE>
{

View File

@@ -6,7 +6,6 @@
#include "state.h"
#include "src/Command.h"
#include <llvm/ADT/ilist.h>
#include <boost/icl/interval.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/icl/split_interval_map.hpp>