Coding style
This commit is contained in:
@@ -244,6 +244,12 @@ static inline int CE_IsCallTo (const CodeEntry* E, const char* Name)
|
|||||||
return (E->OPC == OP65_JSR && strcmp (E->Arg, Name) == 0);
|
return (E->OPC == OP65_JSR && strcmp (E->Arg, Name) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int CE_IsJumpTo (const CodeEntry* E, const char* Name)
|
||||||
|
/* Check if this is a jump to the given function */
|
||||||
|
{
|
||||||
|
return (E->OPC == OP65_JMP && strcmp (E->Arg, Name) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
int CE_UseLoadFlags (CodeEntry* E);
|
int CE_UseLoadFlags (CodeEntry* E);
|
||||||
/* Return true if the instruction uses any flags that are set by a load of
|
/* Return true if the instruction uses any flags that are set by a load of
|
||||||
** a register (N and Z).
|
** a register (N and Z).
|
||||||
|
|||||||
@@ -573,11 +573,9 @@ unsigned OptTosLoadPop (CodeSeg* S)
|
|||||||
const CodeEntry* E = CS_GetEntry (S, I);
|
const CodeEntry* E = CS_GetEntry (S, I);
|
||||||
|
|
||||||
/* Check for the sequence */
|
/* Check for the sequence */
|
||||||
if (E->OPC == OP65_JSR &&
|
if (CE_IsCallTo (E, "ldax0sp") &&
|
||||||
strncmp (E->Arg, "ldax0sp", 5) == 0 &&
|
|
||||||
(N = CS_GetNextEntry (S, I)) != 0 &&
|
(N = CS_GetNextEntry (S, I)) != 0 &&
|
||||||
(N->OPC == OP65_JSR || N->OPC == OP65_JMP) &&
|
(CE_IsCallTo (N, "incsp2") || CE_IsJumpTo (N, "incsp2")) &&
|
||||||
strcmp (N->Arg, "incsp2") == 0 &&
|
|
||||||
!CE_HasLabel (N)) {
|
!CE_HasLabel (N)) {
|
||||||
|
|
||||||
CodeEntry* X;
|
CodeEntry* X;
|
||||||
@@ -588,9 +586,6 @@ unsigned OptTosLoadPop (CodeSeg* S)
|
|||||||
/* Delete the old code */
|
/* Delete the old code */
|
||||||
CS_DelEntries (S, I, 2);
|
CS_DelEntries (S, I, 2);
|
||||||
|
|
||||||
/* Regenerate register info */
|
|
||||||
CS_GenRegInfo (S);
|
|
||||||
|
|
||||||
/* Remember we had changes */
|
/* Remember we had changes */
|
||||||
++Changes;
|
++Changes;
|
||||||
|
|
||||||
@@ -1219,11 +1214,9 @@ unsigned OptTosPushPop(CodeSeg *S)
|
|||||||
const CodeEntry* E = CS_GetEntry (S, I);
|
const CodeEntry* E = CS_GetEntry (S, I);
|
||||||
|
|
||||||
/* Check for decspn, incspn, subysp or addysp */
|
/* Check for decspn, incspn, subysp or addysp */
|
||||||
if (E->OPC == OP65_JSR &&
|
if (CE_IsCallTo (E, "pushax") &&
|
||||||
strcmp(E->Arg, "pushax") == 0 &&
|
|
||||||
(N = CS_GetNextEntry (S, I)) != 0 &&
|
(N = CS_GetNextEntry (S, I)) != 0 &&
|
||||||
(N->OPC == OP65_JSR || N->OPC == OP65_JMP) &&
|
(CE_IsCallTo (N, "popax") || CE_IsJumpTo (N, "popax")) &&
|
||||||
strcmp(N->Arg, "popax") == 0 &&
|
|
||||||
!CE_HasLabel (N)) {
|
!CE_HasLabel (N)) {
|
||||||
|
|
||||||
/* Insert an rts if jmp popax */
|
/* Insert an rts if jmp popax */
|
||||||
@@ -1235,9 +1228,6 @@ unsigned OptTosPushPop(CodeSeg *S)
|
|||||||
/* Delete the old code */
|
/* Delete the old code */
|
||||||
CS_DelEntries (S, I+1, 2);
|
CS_DelEntries (S, I+1, 2);
|
||||||
|
|
||||||
/* Regenerate register info */
|
|
||||||
CS_GenRegInfo (S);
|
|
||||||
|
|
||||||
/* Remember we had changes */
|
/* Remember we had changes */
|
||||||
++Changes;
|
++Changes;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user