1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Added some comments that explain where the g_branch() code generator can and can't be used.

This commit is contained in:
Greg King 2020-09-18 15:50:26 -04:00
parent de630a1245
commit bf4b195016
2 changed files with 8 additions and 0 deletions

View File

@ -2447,6 +2447,8 @@ void g_falsejump (unsigned flags attribute ((unused)), unsigned label)
void g_branch (unsigned Label)
/* Branch unconditionally to Label if the CPU has the BRA instruction.
** Otherwise, jump to Label.
** Use this function, instead of g_jump(), only where it is certain that
** the label cannot be farther away from the branch than -128/+127 bytes.
*/
{
if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0) {
@ -4542,6 +4544,10 @@ void g_extractbitfield (unsigned Flags, unsigned FullWidthFlags, int IsSigned,
AddCodeLine ("pla");
g_or (FullWidthFlags | CF_CONST, ~Mask);
/* We can generate a branch, instead of a jump, here because we know
** that only a few instructions will be put between here and where
** DoneLabel will be defined.
*/
unsigned DoneLabel = GetLocalLabel ();
g_branch (DoneLabel);

View File

@ -416,6 +416,8 @@ void g_falsejump (unsigned flags, unsigned label);
void g_branch (unsigned Label);
/* Branch unconditionally to Label if the CPU has the BRA instruction.
** Otherwise, jump to Label.
** Use this function, instead of g_jump(), only where it is certain that
** the label cannot be farther away from the branch than -128/+127 bytes.
*/
void g_lateadjustSP (unsigned label);