Replace some tabs with spaces

This commit is contained in:
nemerle 2016-05-06 15:04:45 +02:00
parent 152625d67d
commit 59c199837c
13 changed files with 55 additions and 54 deletions

View File

@ -241,7 +241,7 @@ struct GlobalVariable : public AstIdent
struct GlobalVariableIdx : public AstIdent struct GlobalVariableIdx : public AstIdent
{ {
bool valid; bool valid;
int idxGlbIdx; /* idx into localId, GLOB_VAR_IDX */ int idxGlbIdx; /* idx into localId, GLOB_VAR_IDX */
virtual Expr *clone() const virtual Expr *clone() const
{ {
@ -255,9 +255,9 @@ struct GlobalVariableIdx : public AstIdent
struct Constant : public AstIdent struct Constant : public AstIdent
{ {
struct _kte struct _kte
{ /* for CONSTANT only */ { /* for CONSTANT only */
uint32_t kte; /* value of the constant */ uint32_t kte; /* value of the constant */
uint8_t size; /* #bytes size constant */ uint8_t size; /* #bytes size constant */
} kte; } kte;
Constant(uint32_t _kte, uint8_t size) Constant(uint32_t _kte, uint8_t size)
@ -276,7 +276,7 @@ struct Constant : public AstIdent
}; };
struct FuncNode : public AstIdent struct FuncNode : public AstIdent
{ {
struct _call { /* for FUNCTION only */ struct _call { /* for FUNCTION only */
Function *proc; Function *proc;
STKFRAME *args; STKFRAME *args;
} call; } call;
@ -297,8 +297,8 @@ struct FuncNode : public AstIdent
struct RegisterNode : public AstIdent struct RegisterNode : public AstIdent
{ {
const LOCAL_ID *m_syms; const LOCAL_ID *m_syms;
regType regiType; /* for REGISTER only */ regType regiType; /* for REGISTER only */
int regiIdx; /* index into localId, REGISTER */ int regiIdx; /* index into localId, REGISTER */
virtual Expr *insertSubTreeReg(Expr *_expr, eReg regi, const LOCAL_ID *locsym); virtual Expr *insertSubTreeReg(Expr *_expr, eReg regi, const LOCAL_ID *locsym);

View File

@ -36,7 +36,7 @@ public:
}; };
extern bundle cCode; extern bundle cCode;
#define lineSize 360 /* 3 lines in the mean time */ #define lineSize 360 /* 3 lines in the mean time */
//void newBundle (bundle *procCode); //void newBundle (bundle *procCode);
void writeBundle (QIODevice & ios, bundle procCode); void writeBundle (QIODevice & ios, bundle procCode);

View File

@ -23,11 +23,11 @@
#include "BasicBlock.h" #include "BasicBlock.h"
class Project; class Project;
/* CALL GRAPH NODE */ /* CALL GRAPH NODE */
extern bundle cCode; /* Output C procedure's declaration and code */ extern bundle cCode; /* Output C procedure's declaration and code */
/**** Global variables ****/ /**** Global variables ****/
extern QString asm1_name, asm2_name; /* Assembler output filenames */ extern QString asm1_name, asm2_name; /* Assembler output filenames */
typedef struct { /* Command line option flags */ typedef struct { /* Command line option flags */
unsigned verbose : 1; unsigned verbose : 1;
@ -38,7 +38,7 @@ typedef struct { /* Command line option flags */
unsigned Stats : 1; unsigned Stats : 1;
unsigned Interact : 1; /* Interactive mode */ unsigned Interact : 1; /* Interactive mode */
unsigned Calls : 1; /* Follow register indirect calls */ unsigned Calls : 1; /* Follow register indirect calls */
QString filename; /* The input filename */ QString filename; /* The input filename */
uint32_t CustomEntryPoint; uint32_t CustomEntryPoint;
} OPTION; } OPTION;
@ -60,13 +60,13 @@ enum eAreaType
/* Intermediate instructions statistics */ /* Intermediate instructions statistics */
struct STATS struct STATS
{ {
int numBBbef; /* number of basic blocks initially */ int numBBbef; /* number of basic blocks initially */
int numBBaft; /* number of basic blocks at the end */ int numBBaft; /* number of basic blocks at the end */
int nOrder; /* n-th order */ int nOrder; /* n-th order */
int numLLIcode; /* number of low-level Icode instructions */ int numLLIcode; /* number of low-level Icode instructions */
int numHLIcode; /* number of high-level Icode instructions */ int numHLIcode; /* number of high-level Icode instructions */
int totalLL; /* total number of low-level Icode insts */ int totalLL; /* total number of low-level Icode insts */
int totalHL; /* total number of high-level Icod insts */ int totalHL; /* total number of high-level Icod insts */
}; };
extern STATS stats; /* Icode statistics */ extern STATS stats; /* Icode statistics */

View File

@ -29,7 +29,7 @@ using namespace std;
#define POS_LAB 15 /* Position of label */ #define POS_LAB 15 /* Position of label */
#define POS_OPC 20 /* Position of opcode */ #define POS_OPC 20 /* Position of opcode */
#define POS_OPR 25 /* Position of operand */ #define POS_OPR 25 /* Position of operand */
#define WID_PTR 10 /* Width of the "xword ptr" lingo */ #define WID_PTR 10 /* Width of the "xword ptr" lingo */
#define POS_OPR2 POS_OPR+WID_PTR /* Position of operand after "xword ptr" */ #define POS_OPR2 POS_OPR+WID_PTR /* Position of operand after "xword ptr" */
#define POS_CMT 54 /* Position of comment */ #define POS_CMT 54 /* Position of comment */
@ -108,7 +108,7 @@ static vector<POSSTACK_ENTRY> posStack; /* position stack */
#define printfd(x) printf(x) #define printfd(x) printf(x)
#define dis_newline() printf("\n") #define dis_newline() printf("\n")
#define dis_show() // Nothing to do unless using Curses #define dis_show() // Nothing to do unless using Curses
void LLInst::findJumpTargets(CIcodeRec &_pc) void LLInst::findJumpTargets(CIcodeRec &_pc)
@ -134,9 +134,9 @@ void LLInst::findJumpTargets(CIcodeRec &_pc)
} }
/***************************************************************************** /*****************************************************************************
* disassem - Prints a disassembled listing of a procedure. * disassem - Prints a disassembled listing of a procedure.
* pass == 1 generates output on file .a1 * pass == 1 generates output on file .a1
* pass == 2 generates output on file .a2 * pass == 2 generates output on file .a2
* pass == 3 generates output on file .b * pass == 3 generates output on file .b
****************************************************************************/ ****************************************************************************/
void Disassembler::disassem(PtrFunction ppProc) void Disassembler::disassem(PtrFunction ppProc)
@ -551,7 +551,7 @@ void Disassembler::dis1Line(LLInst &inst,int loc_ip, int pass)
/* output to .b code buffer */ /* output to .b code buffer */
if (inst.testFlags(SYNTHETIC)) if (inst.testFlags(SYNTHETIC))
result_stream<<";Synthetic inst"; result_stream<<";Synthetic inst";
if (pass == 3) { /* output to .b code buffer */ if (pass == 3) { /* output to .b code buffer */
cCode.appendCode("%s\n", qPrintable(result_contents)); cCode.appendCode("%s\n", qPrintable(result_contents));
} }
@ -564,7 +564,7 @@ void Disassembler::dis1Line(LLInst &inst,int loc_ip, int pass)
{ {
sprintf(buf,"%03d %06X",loc_ip, inst.label); sprintf(buf,"%03d %06X",loc_ip, inst.label);
} }
else /* SYNTHETIC instruction */ else /* SYNTHETIC instruction */
{ {
sprintf(buf,"%03d ",loc_ip); sprintf(buf,"%03d ",loc_ip);
result_stream<<";Synthetic inst"; result_stream<<";Synthetic inst";
@ -636,7 +636,7 @@ QTextStream &LLInst::strSrc(QTextStream &os,bool skip_comma)
os<<", "; os<<", ";
if (testFlags(I)) if (testFlags(I))
os<<strHex(src().getImm2()); os<<strHex(src().getImm2());
else if (testFlags(IM_SRC)) /* level 2 */ else if (testFlags(IM_SRC)) /* level 2 */
os<<"dx:ax"; os<<"dx:ax";
else else
formatRM(os, src()); formatRM(os, src());

View File

@ -190,7 +190,7 @@ void fixWildCards(uint8_t pat[])
op = pat[pc++]; op = pat[pc++];
if (pc >= PATLEN) return; if (pc >= PATLEN) return;
quad = (uint8_t) (op & 0xC0); /* Quadrant of the opcode map */ quad = (uint8_t) (op & 0xC0); /* Quadrant of the opcode map */
if (quad == 0) if (quad == 0)
{ {
/* Arithmetic group 00-3F */ /* Arithmetic group 00-3F */

View File

@ -1,5 +1,5 @@
/***************************************************************************** /*****************************************************************************
* dcc project CFG related functions * dcc project CFG related functions
* (C) Cristina Cifuentes * (C) Cristina Cifuentes
****************************************************************************/ ****************************************************************************/
@ -47,7 +47,7 @@ void Function::createCFG()
BB * psBB; BB * psBB;
BB * pBB; BB * pBB;
iICODE pIcode = Icode.begin(); iICODE pIcode = Icode.begin();
stats.numBBbef = stats.numBBaft = 0; stats.numBBbef = stats.numBBaft = 0;
rICODE current_range=make_iterator_range(pIcode,++iICODE(pIcode)); rICODE current_range=make_iterator_range(pIcode,++iICODE(pIcode));
@ -205,7 +205,7 @@ void Function::freeCFG()
void Function::compressCFG() void Function::compressCFG()
{ {
BB *pNxt; BB *pNxt;
int ip, first=0, last; int ip, first=0, last;
/* First pass over BB list removes redundant jumps of the form /* First pass over BB list removes redundant jumps of the form
* (Un)Conditional -> Unconditional jump */ * (Un)Conditional -> Unconditional jump */
@ -241,7 +241,7 @@ void Function::compressCFG()
{ {
if (pBB->inEdges.empty()) if (pBB->inEdges.empty())
{ {
if (entry_node) /* Init it misses out on */ if (entry_node) /* Init it misses out on */
pBB->index = UN_INIT; pBB->index = UN_INIT;
else else
{ {
@ -321,7 +321,7 @@ BB *BB::rmJMP(int marker, BB * pBB)
****************************************************************************/ ****************************************************************************/
void BB::mergeFallThrough( CIcodeRec &Icode) void BB::mergeFallThrough( CIcodeRec &Icode)
{ {
BB * pChild; BB * pChild;
if (nullptr==this) if (nullptr==this)
{ {
printf("mergeFallThrough on empty BB!\n"); printf("mergeFallThrough on empty BB!\n");
@ -374,7 +374,7 @@ void BB::mergeFallThrough( CIcodeRec &Icode)
****************************************************************************/ ****************************************************************************/
void BB::dfsNumbering(std::vector<BB *> &dfsLast, int *first, int *last) void BB::dfsNumbering(std::vector<BB *> &dfsLast, int *first, int *last)
{ {
BB * pChild; BB * pChild;
traversed = DFS_NUM; traversed = DFS_NUM;
dfsFirstNum = (*first)++; dfsFirstNum = (*first)++;

View File

@ -520,7 +520,7 @@ QString writeJcond (const HLTYPE &h, Function * pProc, int *numLoc)
/* Displays the inverse output of a HLI_JCOND icode. This is used in the case /* Displays the inverse output of a HLI_JCOND icode. This is used in the case
* when the THEN clause of an if..then..else is empty. The clause is * when the THEN clause of an if..then..else is empty. The clause is
* negated and the ELSE clause is used instead. */ * negated and the ELSE clause is used instead. */
QString writeJcondInv(HLTYPE h, Function * pProc, int *numLoc) QString writeJcondInv(HLTYPE h, Function * pProc, int *numLoc)
{ {
QString _form; QString _form;
@ -559,10 +559,11 @@ void HLTYPE::set(Expr *l, Expr *r)
asgn.m_lhs=l; asgn.m_lhs=l;
asgn.m_rhs=r; asgn.m_rhs=r;
} }
/* Returns a string with the contents of the current high-level icode. /** Returns a string with the contents of the current high-level icode.
* Note: this routine does not output the contens of HLI_JCOND icodes. This is * \note this routine does not output the contens of HLI_JCOND icodes. This is
* done in a separate routine to be able to support the removal of * done in a separate routine to be able to support the removal of
* empty THEN clauses on an if..then..else. */ * empty THEN clauses on an if..then..else.
*/
QString HLTYPE::write1HlIcode (Function * pProc, int *numLoc) const QString HLTYPE::write1HlIcode (Function * pProc, int *numLoc) const
{ {
const HlTypeSupport *p = get(); const HlTypeSupport *p = get();

View File

@ -4,8 +4,8 @@
#include "msvc_fixes.h" #include "msvc_fixes.h"
#include "dcc.h" #include "dcc.h"
#include "types.h" // Common types like uint8_t, etc #include "types.h" // Common types like uint8_t, etc
#include "ast.h" // Some icode types depend on these #include "ast.h" // Some icode types depend on these
#include <stdlib.h> #include <stdlib.h>

View File

@ -53,8 +53,8 @@ int Idiom1::checkStkVars (iICODE pIcode)
****************************************************************************/ ****************************************************************************/
bool Idiom1::match(iICODE picode) bool Idiom1::match(iICODE picode)
{ {
//uint8_t type = 0; /* type of variable: 1 = reg-var, 2 = local */ //uint8_t type = 0; /* type of variable: 1 = reg-var, 2 = local */
//uint8_t regi; /* register of the MOV */ //uint8_t regi; /* register of the MOV */
if(m_func->flg & PROC_HLL) if(m_func->flg & PROC_HLL)
return false; return false;
if(picode==m_end) if(picode==m_end)
@ -109,10 +109,10 @@ bool Idiom1::match(iICODE picode)
m_min_off = 2 + (n * 2); m_min_off = 2 + (n * 2);
} }
else else
return false; // Cristina: check this please! return false; // Cristina: check this please!
} }
else else
return false; // Cristina: check this please! return false; // Cristina: check this please!
} }
} }
else // push di [push si] / push si [push di] else // push di [push si] / push si [push di]

View File

@ -204,8 +204,8 @@ int LOCAL_ID::newLongReg(hlType t, const LONGID_TYPE &longT, iICODE ix_)
id_arr.back().idx.push_back(ix_); id_arr.back().idx.push_back(ix_);
return (id_arr.size() - 1); return (id_arr.size() - 1);
} }
/* Returns an identifier conditional expression node of type TYPE_LONG or /** Returns an identifier conditional expression node of type TYPE_LONG or
* TYPE_WORD_SIGN */ * TYPE_WORD_SIGN */
AstIdent * LOCAL_ID::createId(const ID *retVal, iICODE ix_) AstIdent * LOCAL_ID::createId(const ID *retVal, iICODE ix_)
{ {
return AstIdent::idID(retVal,this,ix_); return AstIdent::idID(retVal,this,ix_);

View File

@ -47,7 +47,7 @@ static const QString szOps[] =
"RCL", "RCR", "ROL", "ROR", "RET", "RETF", "SAHF", "SAR", "RCL", "RCR", "ROL", "ROR", "RET", "RETF", "SAHF", "SAR",
"SHL", "SHR", "SBB", "SCAS", "REPNE SCAS","REPE SCAS", "CWD", "STC", "SHL", "SHR", "SBB", "SCAS", "REPNE SCAS","REPE SCAS", "CWD", "STC",
"STD", "STI", "STOS", "REP STOS", "SUB", "TEST", "WAIT", "XCHG", "STD", "STI", "STOS", "REP STOS", "SUB", "TEST", "WAIT", "XCHG",
"XLAT", "XOR", "INTO", "NOP", "REPNE", "REPE", "MOD" "XLAT", "XOR", "INTO", "NOP", "REPNE", "REPE", "MOD"
}; };
/* The following opcodes are for mod != 3 */ /* The following opcodes are for mod != 3 */
static const QString szFlops1[] = static const QString szFlops1[] =

View File

@ -802,7 +802,7 @@ bool Function::process_CALL(ICODE & pIcode, CALL_GRAPH * pcallGraph, STATE *psta
/* return ((p->flg & TERMINATES) != 0); */ /* return ((p->flg & TERMINATES) != 0); */
} }
return false; // Cristina, please check!! return false; // Cristina, please check!!
} }
@ -1020,7 +1020,7 @@ static void setBits(int16_t type, uint32_t start, uint32_t len)
for (i = start + len - 1; i >= start; i--) for (i = start + len - 1; i >= start; i--)
{ {
prog.map[i >> 2] |= type << ((i & 3) << 1); prog.map[i >> 2] |= type << ((i & 3) << 1);
if (i == 0) break; // Fixes inf loop! if (i == 0) break; // Fixes inf loop!
} }
} }
} }
@ -1181,8 +1181,8 @@ void Function::process_operands(ICODE & pIcode, STATE * pstate)
case iXCHG: case iXCHG:
/* This instruction is replaced by 3 instructions, only need /* This instruction is replaced by 3 instructions, only need
* to define the src operand and use the destination operand * to define the src operand and use the destination operand
* in the mean time. */ * in the mean time.*/
use(SRC, pIcode, this, pstate, cb); use(SRC, pIcode, this, pstate, cb);
def(DST, pIcode, this, pstate, cb); def(DST, pIcode, this, pstate, cb);
break; break;

View File

@ -97,7 +97,7 @@ void LOCAL_ID::newRegArg(iICODE picode, iICODE ticode) const
condId type; condId type;
Function * tproc; Function * tproc;
eReg regL = rUNDEF; eReg regL = rUNDEF;
eReg regH; /* Registers involved in arguments */ eReg regH; /* Registers involved in arguments */
/* Flag ticode as having register arguments */ /* Flag ticode as having register arguments */
tproc = ticode->hl()->call.proc; tproc = ticode->hl()->call.proc;
@ -245,7 +245,7 @@ bool CallType::newStkArg(Expr *exp, llIcode opcode, Function * pproc)
/* Places the actual argument exp in the position given by pos in the /* Places the actual argument exp in the position given by pos in the
* argument list of picode. */ * argument list of picode. */
void CallType::placeStkArg (Expr *exp, int pos) void CallType::placeStkArg (Expr *exp, int pos)
{ {
(*args)[pos].actual = exp; (*args)[pos].actual = exp;
@ -289,7 +289,7 @@ Expr *Function::adjustActArgType (Expr *_exp, hlType forType)
case TYPE_STR: case TYPE_STR:
switch (actType) { switch (actType) {
case TYPE_CONST: case TYPE_CONST:
/* It's an offset into image where a string is found. Point to the string. */ /* It's an offset into image where a string is found. Point to the string. */
{ {
Constant *c=dynamic_cast<Constant *>(expr); Constant *c=dynamic_cast<Constant *>(expr);
assert(c); assert(c);