cleanup
git-svn-id: svn://svn.cc65.org/cc65/trunk@760 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
c80bb24eee
commit
916a0879d5
7 changed files with 11 additions and 67 deletions
|
@ -239,9 +239,6 @@ int CodeEntriesAreEqual (const CodeEntry* E1, const CodeEntry* E2)
|
||||||
void AttachCodeLabel (CodeEntry* E, CodeLabel* L)
|
void AttachCodeLabel (CodeEntry* E, CodeLabel* L)
|
||||||
/* Attach the label to the entry */
|
/* Attach the label to the entry */
|
||||||
{
|
{
|
||||||
/* Mark the label as defined */
|
|
||||||
L->Flags |= LF_DEF;
|
|
||||||
|
|
||||||
/* Add it to the entries label list */
|
/* Add it to the entries label list */
|
||||||
CollAppend (&E->Labels, L);
|
CollAppend (&E->Labels, L);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ CodeLabel* NewCodeLabel (const char* Name, unsigned Hash)
|
||||||
L->Next = 0;
|
L->Next = 0;
|
||||||
L->Name = xstrdup (Name);
|
L->Name = xstrdup (Name);
|
||||||
L->Hash = Hash;
|
L->Hash = Hash;
|
||||||
L->Flags = 0;
|
|
||||||
L->Owner = 0;
|
L->Owner = 0;
|
||||||
InitCollection (&L->JumpFrom);
|
InitCollection (&L->JumpFrom);
|
||||||
|
|
||||||
|
|
|
@ -61,16 +61,12 @@ struct CodeEntry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Label flags, bitmapped */
|
|
||||||
#define LF_DEF 0x0001U /* Label was defined */
|
|
||||||
|
|
||||||
/* Label structure */
|
/* Label structure */
|
||||||
typedef struct CodeLabel CodeLabel;
|
typedef struct CodeLabel CodeLabel;
|
||||||
struct CodeLabel {
|
struct CodeLabel {
|
||||||
CodeLabel* Next; /* Next in hash list */
|
CodeLabel* Next; /* Next in hash list */
|
||||||
char* Name; /* Label name */
|
char* Name; /* Label name */
|
||||||
unsigned short Hash; /* Hash over the name */
|
unsigned Hash; /* Hash over the name */
|
||||||
unsigned short Flags; /* Flag flags */
|
|
||||||
struct CodeEntry* Owner; /* Owner entry */
|
struct CodeEntry* Owner; /* Owner entry */
|
||||||
Collection JumpFrom; /* Entries that jump here */
|
Collection JumpFrom; /* Entries that jump here */
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,7 +68,6 @@ static void MoveLabelsToPool (CodeSeg* S, CodeEntry* E)
|
||||||
unsigned LabelCount = GetCodeLabelCount (E);
|
unsigned LabelCount = GetCodeLabelCount (E);
|
||||||
while (LabelCount--) {
|
while (LabelCount--) {
|
||||||
CodeLabel* L = GetCodeLabel (E, LabelCount);
|
CodeLabel* L = GetCodeLabel (E, LabelCount);
|
||||||
L->Flags &= ~LF_DEF;
|
|
||||||
L->Owner = 0;
|
L->Owner = 0;
|
||||||
CollAppend (&S->Labels, L);
|
CollAppend (&S->Labels, L);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ unsigned GetInsnSize (opc_t OPC, am_t AM)
|
||||||
case AM_ZPX_IND: return 2;
|
case AM_ZPX_IND: return 2;
|
||||||
case AM_ZP_INDY: return 2;
|
case AM_ZP_INDY: return 2;
|
||||||
case AM_ZP_IND: return 2;
|
case AM_ZP_IND: return 2;
|
||||||
default:
|
default:
|
||||||
Internal ("Invalid addressing mode");
|
Internal ("Invalid addressing mode");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ opc_t GetInverseBranch (opc_t OPC)
|
||||||
case OPC_BMI: return OPC_BPL;
|
case OPC_BMI: return OPC_BPL;
|
||||||
case OPC_BNE: return OPC_BEQ;
|
case OPC_BNE: return OPC_BEQ;
|
||||||
case OPC_BPL: return OPC_BMI;
|
case OPC_BPL: return OPC_BMI;
|
||||||
case OPC_BVC: return OPC_BVS;
|
case OPC_BVC: return OPC_BVS;
|
||||||
case OPC_BVS: return OPC_BVC;
|
case OPC_BVS: return OPC_BVC;
|
||||||
case OPC_JCC: return OPC_JCS;
|
case OPC_JCC: return OPC_JCS;
|
||||||
case OPC_JCS: return OPC_JCC;
|
case OPC_JCS: return OPC_JCC;
|
||||||
|
@ -244,7 +244,7 @@ opc_t GetInverseBranch (opc_t OPC)
|
||||||
case OPC_JPL: return OPC_JMI;
|
case OPC_JPL: return OPC_JMI;
|
||||||
case OPC_JVC: return OPC_JVS;
|
case OPC_JVC: return OPC_JVS;
|
||||||
case OPC_JVS: return OPC_JVC;
|
case OPC_JVS: return OPC_JVC;
|
||||||
default:
|
default:
|
||||||
Internal ("GetInverseBranch: Invalid opcode: %d", OPC);
|
Internal ("GetInverseBranch: Invalid opcode: %d", OPC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -276,8 +276,8 @@ opc_t MakeShortBranch (opc_t OPC)
|
||||||
case OPC_JVS: return OPC_BVS;
|
case OPC_JVS: return OPC_BVS;
|
||||||
case OPC_BRA:
|
case OPC_BRA:
|
||||||
case OPC_JMP: return (CPU == CPU_65C02)? OPC_BRA : OPC_JMP;
|
case OPC_JMP: return (CPU == CPU_65C02)? OPC_BRA : OPC_JMP;
|
||||||
default:
|
default:
|
||||||
Internal ("GetShortBranch: Invalid opcode: %d", OPC);
|
Internal ("MakeShortBranch: Invalid opcode: %d", OPC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,8 +308,8 @@ opc_t MakeLongBranch (opc_t OPC)
|
||||||
case OPC_JVS: return OPC_JVS;
|
case OPC_JVS: return OPC_JVS;
|
||||||
case OPC_BRA:
|
case OPC_BRA:
|
||||||
case OPC_JMP: return OPC_JMP;
|
case OPC_JMP: return OPC_JMP;
|
||||||
default:
|
default:
|
||||||
Internal ("GetShortBranch: Invalid opcode: %d", OPC);
|
Internal ("MakeLongBranch: Invalid opcode: %d", OPC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ bc_t GetBranchCond (opc_t OPC)
|
||||||
case OPC_JPL: return BC_PL;
|
case OPC_JPL: return BC_PL;
|
||||||
case OPC_JVC: return BC_VC;
|
case OPC_JVC: return BC_VC;
|
||||||
case OPC_JVS: return BC_VS;
|
case OPC_JVS: return BC_VS;
|
||||||
default:
|
default:
|
||||||
Internal ("GetBranchCond: Invalid opcode: %d", OPC);
|
Internal ("GetBranchCond: Invalid opcode: %d", OPC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ bc_t GetInverseCond (bc_t BC)
|
||||||
case BC_PL: return BC_MI;
|
case BC_PL: return BC_MI;
|
||||||
case BC_VC: return BC_VS;
|
case BC_VC: return BC_VS;
|
||||||
case BC_VS: return BC_VC;
|
case BC_VS: return BC_VC;
|
||||||
default:
|
default:
|
||||||
Internal ("GetInverseCond: Invalid condition: %d", BC);
|
Internal ("GetInverseCond: Invalid condition: %d", BC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -364,43 +364,3 @@ bc_t GetInverseCond (bc_t BC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
opc_t GetLongBranch (bc_t BC)
|
|
||||||
/* Return a long branch for the given branch condition */
|
|
||||||
{
|
|
||||||
switch (BC) {
|
|
||||||
case BC_CC: return OPC_JCC;
|
|
||||||
case BC_CS: return OPC_JCS;
|
|
||||||
case BC_EQ: return OPC_JEQ;
|
|
||||||
case BC_MI: return OPC_JMI;
|
|
||||||
case BC_NE: return OPC_JNE;
|
|
||||||
case BC_PL: return OPC_JPL;
|
|
||||||
case BC_VC: return OPC_JVC;
|
|
||||||
case BC_VS: return OPC_JVS;
|
|
||||||
default:
|
|
||||||
Internal ("GetLongBranch: Invalid condition: %d", BC);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
opc_t GetShortBranch (bc_t BC)
|
|
||||||
/* Return a short branch for the given branch condition */
|
|
||||||
{
|
|
||||||
switch (BC) {
|
|
||||||
case BC_CC: return OPC_BCC;
|
|
||||||
case BC_CS: return OPC_BCS;
|
|
||||||
case BC_EQ: return OPC_BEQ;
|
|
||||||
case BC_MI: return OPC_BMI;
|
|
||||||
case BC_NE: return OPC_BNE;
|
|
||||||
case BC_PL: return OPC_BPL;
|
|
||||||
case BC_VC: return OPC_BVC;
|
|
||||||
case BC_VS: return OPC_BVS;
|
|
||||||
default:
|
|
||||||
Internal ("GetShortBranch: Invalid condition: %d", BC);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,6 @@ typedef enum {
|
||||||
BC_MI,
|
BC_MI,
|
||||||
BC_NE,
|
BC_NE,
|
||||||
BC_PL,
|
BC_PL,
|
||||||
BC_SR,
|
|
||||||
BC_VC,
|
BC_VC,
|
||||||
BC_VS
|
BC_VS
|
||||||
} bc_t;
|
} bc_t;
|
||||||
|
@ -244,12 +243,6 @@ bc_t GetBranchCond (opc_t OPC);
|
||||||
bc_t GetInverseCond (bc_t BC);
|
bc_t GetInverseCond (bc_t BC);
|
||||||
/* Return the inverse condition of the given one */
|
/* Return the inverse condition of the given one */
|
||||||
|
|
||||||
opc_t GetLongBranch (bc_t BC);
|
|
||||||
/* Return a long branch for the given branch condition */
|
|
||||||
|
|
||||||
opc_t GetShortBranch (bc_t BC);
|
|
||||||
/* Return a short branch for the given branch condition */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of opcodes.h */
|
/* End of opcodes.h */
|
||||||
|
|
|
@ -625,7 +625,7 @@ static void ForStatement (void)
|
||||||
/* Label for the test expressions */
|
/* Label for the test expressions */
|
||||||
g_defcodelabel (TestLabel);
|
g_defcodelabel (TestLabel);
|
||||||
|
|
||||||
/* Parse the text expression */
|
/* Parse the test expression */
|
||||||
if (CurTok.Tok != TOK_SEMI) {
|
if (CurTok.Tok != TOK_SEMI) {
|
||||||
boolexpr (&lval2);
|
boolexpr (&lval2);
|
||||||
g_truejump (CF_NONE, lstat);
|
g_truejump (CF_NONE, lstat);
|
||||||
|
|
Loading…
Add table
Reference in a new issue