Merge branch 'qt5' into experimental_command_streams
This commit is contained in:
commit
5f68987001
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
|
|
||||||
#SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
#SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
||||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D__UNIX__ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D__UNIX__ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS)
|
||||||
IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
|
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D__UNIX__ -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX)
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D__UNIX__ -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX)
|
||||||
ADD_DEFINITIONS(/W4)
|
ADD_DEFINITIONS(/W4)
|
||||||
ELSE()
|
ELSE()
|
||||||
@ -11,7 +11,7 @@ ELSE()
|
|||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
|
||||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} " ) #--coverage
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} " ) #--coverage
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
SET(CMAKE_CXX_STANDARD 11)
|
||||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts;${CMAKE_MODULE_PATH})
|
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts;${CMAKE_MODULE_PATH})
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
@ -30,17 +30,12 @@ enable_testing()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
find_package(LLVM REQUIRED CONFIG)
|
|
||||||
llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES native mc support tablegen)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
3rd_party/libdisasm
|
3rd_party/libdisasm
|
||||||
include
|
include
|
||||||
include/idioms
|
include/idioms
|
||||||
common
|
common
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
${LLVM_INCLUDE_DIRS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +120,7 @@ set(dcc_HEADERS
|
|||||||
include/bundle.h
|
include/bundle.h
|
||||||
include/BinaryImage.h
|
include/BinaryImage.h
|
||||||
include/DccFrontend.h
|
include/DccFrontend.h
|
||||||
|
include/Enums.h
|
||||||
include/dcc.h
|
include/dcc.h
|
||||||
include/disassem.h
|
include/disassem.h
|
||||||
include/dosdcc.h
|
include/dosdcc.h
|
||||||
@ -165,8 +161,10 @@ qt5_use_modules(dcc_lib Core)
|
|||||||
|
|
||||||
ADD_EXECUTABLE(dcc_original ${dcc_SOURCES} ${dcc_UI_SOURCES})
|
ADD_EXECUTABLE(dcc_original ${dcc_SOURCES} ${dcc_UI_SOURCES})
|
||||||
ADD_DEPENDENCIES(dcc_original dcc_lib)
|
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 Widgets)
|
qt5_use_modules(dcc_original Core Widgets)
|
||||||
|
SET_PROPERTY(TARGET dcc_original PROPERTY CXX_STANDARD 11)
|
||||||
|
SET_PROPERTY(TARGET dcc_original PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
#ADD_SUBDIRECTORY(gui)
|
#ADD_SUBDIRECTORY(gui)
|
||||||
if(dcc_build_tests)
|
if(dcc_build_tests)
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <llvm/ADT/ilist.h>
|
|
||||||
#include <llvm/ADT/ilist_node.h>
|
|
||||||
#include <boost/range/iterator_range.hpp>
|
#include <boost/range/iterator_range.hpp>
|
||||||
#include "icode.h"
|
#include "icode.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@ -27,7 +25,7 @@ struct TYPEADR_TYPE
|
|||||||
TYPEADR_TYPE(interval *v) : ip(0),BBptr(nullptr),intPtr(v)
|
TYPEADR_TYPE(interval *v) : ip(0),BBptr(nullptr),intPtr(v)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
struct BB : public llvm::ilist_node<BB>
|
struct BB
|
||||||
{
|
{
|
||||||
friend struct Function;
|
friend struct Function;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "ast.h"
|
#include "ast.h"
|
||||||
|
|
||||||
|
#ifdef PASCAL
|
||||||
|
#undef PASCAL
|
||||||
|
#endif
|
||||||
class QTextStream;
|
class QTextStream;
|
||||||
|
|
||||||
struct CConv {
|
struct CConv {
|
||||||
|
|||||||
@ -90,9 +90,9 @@ enum eLLFlags
|
|||||||
/* Types of icodes */
|
/* Types of icodes */
|
||||||
enum icodeType
|
enum icodeType
|
||||||
{
|
{
|
||||||
NOT_SCANNED = 0, // not even scanned yet
|
NOT_SCANNED_ICODE = 0, // not even scanned yet
|
||||||
LOW_LEVEL, // low-level icode
|
LOW_LEVEL_ICODE, // low-level icode
|
||||||
HIGH_LEVEL // high-level icode
|
HIGH_LEVEL_ICODE // high-level icode
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include "StackFrame.h"
|
#include "StackFrame.h"
|
||||||
#include "CallConvention.h"
|
#include "CallConvention.h"
|
||||||
|
|
||||||
#include <llvm/ADT/ilist.h>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
@ -26,29 +25,6 @@ struct PROG;
|
|||||||
struct IStructuredTextTarget;
|
struct IStructuredTextTarget;
|
||||||
struct Function;
|
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 */
|
/* Procedure FLAGS */
|
||||||
enum PROC_FLAGS
|
enum PROC_FLAGS
|
||||||
{
|
{
|
||||||
@ -155,7 +131,7 @@ enum DecompilationStep : uint32_t {
|
|||||||
|
|
||||||
class Function : public std::enable_shared_from_this<Function>
|
class Function : public std::enable_shared_from_this<Function>
|
||||||
{
|
{
|
||||||
typedef llvm::iplist<BB> BasicBlockListType;
|
typedef std::list<BB *> BasicBlockListType;
|
||||||
// BasicBlock iterators...
|
// BasicBlock iterators...
|
||||||
typedef BasicBlockListType::iterator iterator;
|
typedef BasicBlockListType::iterator iterator;
|
||||||
typedef BasicBlockListType::const_iterator const_iterator;
|
typedef BasicBlockListType::const_iterator const_iterator;
|
||||||
@ -284,7 +260,6 @@ protected:
|
|||||||
bool nextOrderGraph(derSeq &derivedGi);
|
bool nextOrderGraph(derSeq &derivedGi);
|
||||||
void addOutEdgesForConditionalJump(BB *pBB, int next_ip, LLInst *ll);
|
void addOutEdgesForConditionalJump(BB *pBB, int next_ip, LLInst *ll);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<PtrFunction> FunctionListType;
|
typedef std::list<PtrFunction> FunctionListType;
|
||||||
typedef FunctionListType lFunction;
|
typedef FunctionListType lFunction;
|
||||||
typedef lFunction::iterator ilFunction;
|
typedef lFunction::iterator ilFunction;
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
//TODO: Remove boolT
|
//TODO: Remove boolT
|
||||||
|
|
||||||
#include <llvm/ADT/ilist.h>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <llvm/ADT/ilist.h>
|
|
||||||
|
|
||||||
class IStructuredTextTarget;
|
class IStructuredTextTarget;
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,6 @@
|
|||||||
#include "state.h" // State depends on INDEXBASE, but later need STATE
|
#include "state.h" // State depends on INDEXBASE, but later need STATE
|
||||||
#include "CallConvention.h"
|
#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 <boost/range/iterator_range.hpp>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
@ -63,12 +59,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 +310,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
|
||||||
{
|
{
|
||||||
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 +325,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);
|
||||||
@ -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());}
|
||||||
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 TypeFilter<HIGH_LEVEL_ICODE> select_high_level;
|
||||||
static TypeAndValidFilter<HIGH_LEVEL> select_valid_high_level;
|
static TypeAndValidFilter<HIGH_LEVEL_ICODE> select_valid_high_level;
|
||||||
/* Def/Use of registers and stack variables */
|
/* Def/Use of registers and stack variables */
|
||||||
struct DU_ICODE
|
struct DU_ICODE
|
||||||
{
|
{
|
||||||
@ -572,7 +567,7 @@ public:
|
|||||||
// set this icode to be an assign
|
// set this icode to be an assign
|
||||||
void setAsgn(Expr *lhs, Expr *rhs)
|
void setAsgn(Expr *lhs, Expr *rhs)
|
||||||
{
|
{
|
||||||
type=HIGH_LEVEL;
|
type=HIGH_LEVEL_ICODE;
|
||||||
hlU()->setAsgn(lhs,rhs);
|
hlU()->setAsgn(lhs,rhs);
|
||||||
}
|
}
|
||||||
void setUnary(hlIcode op, Expr *_exp);
|
void setUnary(hlIcode op, Expr *_exp);
|
||||||
@ -589,7 +584,7 @@ public:
|
|||||||
{
|
{
|
||||||
return hlU()->call.newStkArg(exp,opcode,pproc);
|
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);
|
m_ll = new LLInst(this);
|
||||||
}
|
}
|
||||||
@ -638,14 +633,13 @@ 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 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>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "src/Command.h"
|
#include "src/Command.h"
|
||||||
|
|
||||||
#include <llvm/ADT/ilist.h>
|
|
||||||
#include <boost/icl/interval.hpp>
|
#include <boost/icl/interval.hpp>
|
||||||
#include <boost/icl/interval_map.hpp>
|
#include <boost/icl/interval_map.hpp>
|
||||||
#include <boost/icl/split_interval_map.hpp>
|
#include <boost/icl/split_interval_map.hpp>
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/range/rbegin.hpp>
|
#include <boost/range/rbegin.hpp>
|
||||||
#include <boost/range/rend.hpp>
|
#include <boost/range/rend.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ void BB::writeBB(QTextStream &ostr,int lev, Function * pProc, int *numLoc)
|
|||||||
|
|
||||||
for(ICODE &pHli : instructions)
|
for(ICODE &pHli : instructions)
|
||||||
{
|
{
|
||||||
if ((pHli.type == HIGH_LEVEL) and ( pHli.valid() )) //TODO: use filtering range here.
|
if ((pHli.type == HIGH_LEVEL_ICODE) and ( pHli.valid() )) //TODO: use filtering range here.
|
||||||
{
|
{
|
||||||
QString line = pHli.hl()->write1HlIcode(pProc, numLoc);
|
QString line = pHli.hl()->write1HlIcode(pProc, numLoc);
|
||||||
if (not line.isEmpty())
|
if (not line.isEmpty())
|
||||||
|
|||||||
@ -33,7 +33,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);
|
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);
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <boost/range.hpp>
|
#include <boost/range.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
|
||||||
//#include <boost/range/algorithm.hpp>
|
//#include <boost/range/algorithm.hpp>
|
||||||
//#include <boost/assign.hpp>
|
//#include <boost/assign.hpp>
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <boost/range.hpp>
|
#include <boost/range.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <boost/range/algorithm.hpp>
|
#include <boost/range/algorithm.hpp>
|
||||||
#include <boost/assign.hpp>
|
#include <boost/assign.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/range.hpp>
|
#include <boost/range.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
#include <boost/range/algorithm.hpp>
|
#include <boost/range/algorithm.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
#include "msvc_fixes.h"
|
#include "msvc_fixes.h"
|
||||||
|
|
||||||
#include <boost/range.hpp>
|
#include <boost/range.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
#include <boost/range/adaptor/filtered.hpp>
|
||||||
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
#include <boost/range/algorithm.hpp>
|
#include <boost/range/algorithm.hpp>
|
||||||
#include <boost/assign.hpp>
|
#include <boost/assign.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -148,7 +149,7 @@ void Function::elimCondCodes ()
|
|||||||
{
|
{
|
||||||
llIcode useAtOp = llIcode(useAt->ll()->getOpcode());
|
llIcode useAtOp = llIcode(useAt->ll()->getOpcode());
|
||||||
use = useAt->ll()->flagDU.u;
|
use = useAt->ll()->flagDU.u;
|
||||||
if ((useAt->type != LOW_LEVEL) or ( not useAt->valid() ) or ( 0 == use ))
|
if ((useAt->type != LOW_LEVEL_ICODE) or ( not useAt->valid() ) or ( 0 == use ))
|
||||||
continue;
|
continue;
|
||||||
/* Find definition within the same basic block */
|
/* Find definition within the same basic block */
|
||||||
defAt=useAt;
|
defAt=useAt;
|
||||||
@ -271,7 +272,7 @@ void Function::genLiveKtes ()
|
|||||||
continue; // skip invalid BBs
|
continue; // skip invalid BBs
|
||||||
for(ICODE &insn : *pbb)
|
for(ICODE &insn : *pbb)
|
||||||
{
|
{
|
||||||
if ((insn.type == HIGH_LEVEL) and ( insn.valid() ))
|
if ((insn.type == HIGH_LEVEL_ICODE) and ( insn.valid() ))
|
||||||
{
|
{
|
||||||
liveUse |= (insn.du.use - def);
|
liveUse |= (insn.du.use - def);
|
||||||
def |= insn.du.def;
|
def |= insn.du.def;
|
||||||
@ -884,7 +885,7 @@ void BB::findBBExps(LOCAL_ID &locals,Function *fnc)
|
|||||||
numHlIcodes = 0;
|
numHlIcodes = 0;
|
||||||
assert(&fnc->localId==&locals);
|
assert(&fnc->localId==&locals);
|
||||||
// register(s) to be forward substituted
|
// register(s) to be forward substituted
|
||||||
auto valid_and_highlevel = instructions | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL>());
|
auto valid_and_highlevel = instructions | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL_ICODE>());
|
||||||
for (auto picode = valid_and_highlevel.begin(); picode != valid_and_highlevel.end(); picode++)
|
for (auto picode = valid_and_highlevel.begin(); picode != valid_and_highlevel.end(); picode++)
|
||||||
{
|
{
|
||||||
ICODE &_ic(*picode);
|
ICODE &_ic(*picode);
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <boost/range/rbegin.hpp>
|
#include <boost/range/rbegin.hpp>
|
||||||
#include <boost/range/rend.hpp>
|
#include <boost/range/rend.hpp>
|
||||||
#include <boost/range/adaptors.hpp>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ void ICODE::checkHlCall()
|
|||||||
/* Places the new HLI_CALL high-level operand in the high-level icode array */
|
/* Places the new HLI_CALL high-level operand in the high-level icode array */
|
||||||
void ICODE::newCallHl()
|
void ICODE::newCallHl()
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->setCall(ll()->src().proc.proc);
|
hlU()->setCall(ll()->src().proc.proc);
|
||||||
|
|
||||||
if (ll()->src().proc.cb != 0)
|
if (ll()->src().proc.cb != 0)
|
||||||
@ -48,7 +48,7 @@ void ICODE::newCallHl()
|
|||||||
* array */
|
* array */
|
||||||
void ICODE::setUnary(hlIcode op, Expr *_exp)
|
void ICODE::setUnary(hlIcode op, Expr *_exp)
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->set(op,_exp);
|
hlU()->set(op,_exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ void ICODE::setUnary(hlIcode op, Expr *_exp)
|
|||||||
/* Places the new HLI_JCOND high-level operand in the high-level icode array */
|
/* Places the new HLI_JCOND high-level operand in the high-level icode array */
|
||||||
void ICODE::setJCond(Expr *cexp)
|
void ICODE::setJCond(Expr *cexp)
|
||||||
{
|
{
|
||||||
type = HIGH_LEVEL;
|
type = HIGH_LEVEL_ICODE;
|
||||||
hlU()->set(HLI_JCOND,cexp);
|
hlU()->set(HLI_JCOND,cexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ void Function::highLevelGen()
|
|||||||
LLOperand *src_ll = ll->get(SRC);
|
LLOperand *src_ll = ll->get(SRC);
|
||||||
if ( ll->testFlags(NOT_HLL) )
|
if ( ll->testFlags(NOT_HLL) )
|
||||||
pIcode->invalidate();
|
pIcode->invalidate();
|
||||||
if ((pIcode->type != LOW_LEVEL) or not pIcode->valid() )
|
if ((pIcode->type != LOW_LEVEL_ICODE) or not pIcode->valid() )
|
||||||
continue;
|
continue;
|
||||||
_flg = ll->getFlag();
|
_flg = ll->getFlag();
|
||||||
if (not ll->testFlags(IM_OPS)) /* not processing IM_OPS yet */
|
if (not ll->testFlags(IM_OPS)) /* not processing IM_OPS yet */
|
||||||
@ -353,7 +353,7 @@ void Function::highLevelGen()
|
|||||||
|
|
||||||
case iCALL:
|
case iCALL:
|
||||||
case iCALLF:
|
case iCALLF:
|
||||||
pIcode->type = HIGH_LEVEL;
|
pIcode->type = HIGH_LEVEL_ICODE;
|
||||||
pIcode->hl( ll->createCall() );
|
pIcode->hl( ll->createCall() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
ICODE::TypeFilter<HIGH_LEVEL> ICODE::select_high_level;
|
ICODE::TypeFilter<HIGH_LEVEL_ICODE> ICODE::select_high_level;
|
||||||
ICODE::TypeAndValidFilter<HIGH_LEVEL> ICODE::select_valid_high_level;
|
ICODE::TypeAndValidFilter<HIGH_LEVEL_ICODE> ICODE::select_valid_high_level;
|
||||||
CIcodeRec::CIcodeRec()
|
CIcodeRec::CIcodeRec()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ static std::vector<ICODE> rewrite_DIV(LLInst *ll, ICODE &_Icode)
|
|||||||
ICODE synth_mov = ICODE(); // MOV rTMP, reg
|
ICODE synth_mov = ICODE(); // MOV rTMP, reg
|
||||||
ICODE synth_mod = ICODE(); // MOD
|
ICODE synth_mod = ICODE(); // MOD
|
||||||
|
|
||||||
synth_mov.type = LOW_LEVEL;
|
synth_mov.type = LOW_LEVEL_ICODE;
|
||||||
synth_mov.ll()->set(iMOV,0,rTMP);
|
synth_mov.ll()->set(iMOV,0,rTMP);
|
||||||
if (ll->testFlags(B) )
|
if (ll->testFlags(B) )
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ static std::vector<ICODE> rewrite_DIV(LLInst *ll, ICODE &_Icode)
|
|||||||
synth_mov.ll()->label = _Icode.ll()->label;
|
synth_mov.ll()->label = _Icode.ll()->label;
|
||||||
|
|
||||||
/* iMOD */
|
/* iMOD */
|
||||||
synth_mod.type = LOW_LEVEL;
|
synth_mod.type = LOW_LEVEL_ICODE;
|
||||||
synth_mod.ll()->set(iMOD,ll->getFlag() | SYNTHETIC | IM_TMP_DST);
|
synth_mod.ll()->set(iMOD,ll->getFlag() | SYNTHETIC | IM_TMP_DST);
|
||||||
synth_mod.ll()->replaceSrc(_Icode.ll()->src());
|
synth_mod.ll()->replaceSrc(_Icode.ll()->src());
|
||||||
synth_mod.du = _Icode.du;
|
synth_mod.du = _Icode.du;
|
||||||
@ -86,7 +86,7 @@ static std::vector<ICODE> rewrite_XCHG(LLInst *ll,ICODE &_Icode)
|
|||||||
{
|
{
|
||||||
/* MOV rTMP, regDst */
|
/* MOV rTMP, regDst */
|
||||||
ICODE mov_tmp_dst;
|
ICODE mov_tmp_dst;
|
||||||
mov_tmp_dst.type = LOW_LEVEL;
|
mov_tmp_dst.type = LOW_LEVEL_ICODE;
|
||||||
mov_tmp_dst.ll()->set(iMOV,SYNTHETIC,rTMP,ll->m_dst);
|
mov_tmp_dst.ll()->set(iMOV,SYNTHETIC,rTMP,ll->m_dst);
|
||||||
mov_tmp_dst.setRegDU( rTMP, eDEF);
|
mov_tmp_dst.setRegDU( rTMP, eDEF);
|
||||||
if(mov_tmp_dst.ll()->src().getReg2())
|
if(mov_tmp_dst.ll()->src().getReg2())
|
||||||
@ -104,7 +104,7 @@ static std::vector<ICODE> rewrite_XCHG(LLInst *ll,ICODE &_Icode)
|
|||||||
/* MOV regSrc, rTMP */
|
/* MOV regSrc, rTMP */
|
||||||
|
|
||||||
ICODE mov_src_tmp;
|
ICODE mov_src_tmp;
|
||||||
mov_src_tmp.type = LOW_LEVEL;
|
mov_src_tmp.type = LOW_LEVEL_ICODE;
|
||||||
mov_src_tmp.ll()->set(iMOV,SYNTHETIC);
|
mov_src_tmp.ll()->set(iMOV,SYNTHETIC);
|
||||||
mov_src_tmp.ll()->replaceDst(ll->src());
|
mov_src_tmp.ll()->replaceDst(ll->src());
|
||||||
if(mov_src_tmp.ll()->m_dst.regi)
|
if(mov_src_tmp.ll()->m_dst.regi)
|
||||||
@ -218,7 +218,7 @@ void FollowCtrl(Function &func,CALL_GRAPH * pcallGraph, STATE *pstate)
|
|||||||
iICODE labLoc = func.Icode.labelSrch(ll->label);
|
iICODE labLoc = func.Icode.labelSrch(ll->label);
|
||||||
if (func.Icode.end()!=labLoc)
|
if (func.Icode.end()!=labLoc)
|
||||||
{ /* Synthetic jump */
|
{ /* Synthetic jump */
|
||||||
_Icode.type = LOW_LEVEL;
|
_Icode.type = LOW_LEVEL_ICODE;
|
||||||
ll->set(iJMP,I | SYNTHETIC | NO_OPS);
|
ll->set(iJMP,I | SYNTHETIC | NO_OPS);
|
||||||
ll->replaceSrc(LLOperand::CreateImm2(labLoc->ll()->GetLlLabel()));
|
ll->replaceSrc(LLOperand::CreateImm2(labLoc->ll()->GetLlLabel()));
|
||||||
ll->label = Project::get()->SynthLab++;
|
ll->label = Project::get()->SynthLab++;
|
||||||
|
|||||||
@ -248,7 +248,7 @@ void Function::propLongStk (int i, const ID &pLocId)
|
|||||||
next1 = ++iICODE(pIcode);
|
next1 = ++iICODE(pIcode);
|
||||||
if(next1==pEnd)
|
if(next1==pEnd)
|
||||||
break;
|
break;
|
||||||
if ((pIcode->type == HIGH_LEVEL) or ( not pIcode->valid() ))
|
if ((pIcode->type == HIGH_LEVEL_ICODE) or ( not pIcode->valid() ))
|
||||||
continue;
|
continue;
|
||||||
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
||||||
{
|
{
|
||||||
@ -323,7 +323,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
|
|||||||
ICODE &icode(*pIcode);
|
ICODE &icode(*pIcode);
|
||||||
|
|
||||||
|
|
||||||
if ((icode.type == HIGH_LEVEL) or ( not icode.valid() ))
|
if ((icode.type == HIGH_LEVEL_ICODE) or ( not icode.valid() ))
|
||||||
continue;
|
continue;
|
||||||
if (icode.ll()->getOpcode() != next1->ll()->getOpcode())
|
if (icode.ll()->getOpcode() != next1->ll()->getOpcode())
|
||||||
continue;
|
continue;
|
||||||
@ -401,7 +401,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
|
|||||||
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
|
LLOperand * pmH,* pmL; /* Pointers to dst LOW_LEVEL icodes */
|
||||||
int arc;
|
int arc;
|
||||||
|
|
||||||
if ((pIcode->type == HIGH_LEVEL) or ( not pIcode->valid() ))
|
if ((pIcode->type == HIGH_LEVEL_ICODE) or ( not pIcode->valid() ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
|
||||||
|
|||||||
@ -537,7 +537,7 @@ eErrorId scan(uint32_t ip, ICODE &p)
|
|||||||
PROG &prog(Project::get()->prog);
|
PROG &prog(Project::get()->prog);
|
||||||
int op;
|
int op;
|
||||||
p = ICODE();
|
p = ICODE();
|
||||||
p.type = LOW_LEVEL;
|
p.type = LOW_LEVEL_ICODE;
|
||||||
p.ll()->label = ip; /* ip is absolute offset into image*/
|
p.ll()->label = ip; /* ip is absolute offset into image*/
|
||||||
if (ip >= (uint32_t)prog.cbImage)
|
if (ip >= (uint32_t)prog.cbImage)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user