This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GASP really obsolete?


Hi Frank,

> Thank you for your patch. But it still isn't the working solution.
> Imagine the following case where we have a loop:
> 
>   REPEAT                  /* begin loop */
>     IFZ varialbe_a, $0
>       CONT                /* continue loop if a is zero */
>     ENDIF
>     IFZ variable_a, $1
>       BREAK               /* abort loop if a is one */
>     ENDIF
>     /* do something with a */
>   ENDR
> 
> We cannot implement REPEAT/CONT/BREAK/ENDR with
> {push/pop}_macro_labels because we the IFZ statements had open an
> additional layer of local labels which are unaccessible then from
> CONT/BREAK.

True, but you do not need the macro labels to implement REPEAT, CONT,
BREAK and ENDR.  You can just use ordinary local labels like this:

	.macro REPEAT
	  3:
	.endm

	.macro CONT
	  b  3b
	.endm

	.macro BREAK
	  b 4f
	.endm

	.macro ENDR
	  4:
	.endm

(You do not need to break out of more than one enclosing loop at a
time do you ?)

Cheers
        Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]