public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* escaping in syntax strings
@ 2001-03-25 20:16 Ben Elliston
  2001-03-26  5:10 ` Frank Ch. Eigler
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Elliston @ 2001-03-25 20:16 UTC (permalink / raw)
  To: cgen

According to the cgen documentation:

  If a `$' is required in the syntax, it is specified with `$'.

Is it a bug that I had to use "... \\$" in my cpu description?

Ben

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-25 20:16 escaping in syntax strings Ben Elliston
@ 2001-03-26  5:10 ` Frank Ch. Eigler
  2001-03-26  5:22   ` Ben Elliston
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Frank Ch. Eigler @ 2001-03-26  5:10 UTC (permalink / raw)
  To: Ben Elliston; +Cc: cgen

: According to the cgen documentation:
:   If a `$' is required in the syntax, it is specified with `$'.

This is a rendering problem with the docs.  The texinfo file says "\$".

: Is it a bug that I had to use "... \\$" in my cpu description?

Try plain "\$".

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6vz+3VZbdDOm/ZT0RAjhtAJ0TfOimyVmSTOK/8eXEQthSg6XFhwCeIxWK
TaJ+QV1frhmeSCdxR9/F1Gc=
=vT6h
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-26  5:10 ` Frank Ch. Eigler
@ 2001-03-26  5:22   ` Ben Elliston
       [not found]   ` <15039.17056.78350.71117.cygnus.local.cgen@scooby.apac.redhat.com>
       [not found]   ` <o5wv9c1ojl.fsf.cygnus.local.cgen@toenail.toronto.redhat.com>
  2 siblings, 0 replies; 9+ messages in thread
From: Ben Elliston @ 2001-03-26  5:22 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: cgen

>>>>> "Frank" == Frank Ch Eigler <fche@redhat.com> writes:

  Frank> :   If a `$' is required in the syntax, it is specified with `$'.
  Frank> This is a rendering problem with the docs.  The texinfo file says "\$".

Actually, that was a problem with my transcribing of the docs to
email.  I accidentally removed the backslash.  Oops.  Now:

  Frank> : Is it a bug that I had to use "... \\$" in my cpu description?
  Frank> Try plain "\$".

I did.  It reached the relevant routine as merely `$'.  It looks like
an earlier stage of processing stripped that level of escaping.  I
definitely needed two \\'s to make it work.

Ben

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
       [not found]   ` <15039.17056.78350.71117.cygnus.local.cgen@scooby.apac.redhat.com>
@ 2001-03-26  8:30     ` Frank Ch. Eigler
  0 siblings, 0 replies; 9+ messages in thread
From: Frank Ch. Eigler @ 2001-03-26  8:30 UTC (permalink / raw)
  To: Ben Elliston; +Cc: cgen

bje wrote:

:   Frank> : Is it a bug that I had to use "... \\$" in my cpu description?
:   Frank> Try plain "\$".
: 
: I did.  It reached the relevant routine as merely `$'.  It looks like
: an earlier stage of processing stripped that level of escaping.  I
: definitely needed two \\'s to make it work.

Okay.  This is probably a problem with using the same general escape
character ("\") in strings, as well as within syntax strings for the
"$" code.  Perhaps the latter should be changed to be more like "make",
i.e., "$$" means "$".

By the way, why do you need a "$" in the syntax string?  Are you
confusing register name keywords or hexadecimal constants with
the markers that actually belong into the syntax strings?


- FChE

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
       [not found]   ` <o5wv9c1ojl.fsf.cygnus.local.cgen@toenail.toronto.redhat.com>
@ 2001-03-26  8:49     ` Frank Ch. Eigler
  2001-03-26  9:11       ` Dave Brolley
  0 siblings, 1 reply; 9+ messages in thread
From: Frank Ch. Eigler @ 2001-03-26  8:49 UTC (permalink / raw)
  To: cgen

I wrote:

: [...]
: By the way, why do you need a "$" in the syntax string?  Are you
: confusing register name keywords or hexadecimal constants with
: the markers that actually belong into the syntax strings?

I just found what Ben was talking about.  It seems that some
instructions in the assembly language for his target includes dummy
operands that make explicit the implicit (not-encoded) operands.  For
example, given a register keyword set such as "$0 .. $7", there are
some instructions which are hard-wired to use only $0 as an input or
output, in addition to other inputs/outputs.  Rather than leave the $0
implicit, this assembly language expects the programmer to specify it.
Say,
        compare $0,$2,$3
instead of
        compare $2,$3

So, Ben is trying to implement this in the assembler by including the
literal string "$0" in the syntax bytes of the instruction.  This is
not too bad, though a possibly better way would be to associate a
synthetic cgen operand with that slot, and to give it a parser that
accepts only "$0", and emits a helpful error message for anything
else.

- FChE

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-26  8:49     ` Frank Ch. Eigler
@ 2001-03-26  9:11       ` Dave Brolley
  2001-03-26 14:08         ` Ben Elliston
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Brolley @ 2001-03-26  9:11 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: cgen

Yes -- see the fr30 for an example of this:

h-r13 -- hardware element
R13 -- special operand
r13base-ld -- pmacro for generating insns which have r13 hardwired but 
still specified

Dave

Frank Ch. Eigler wrote:

> I wrote:
> 
> : [...]
> : By the way, why do you need a "$" in the syntax string?  Are you
> : confusing register name keywords or hexadecimal constants with
> : the markers that actually belong into the syntax strings?
> 
> I just found what Ben was talking about.  It seems that some
> instructions in the assembly language for his target includes dummy
> operands that make explicit the implicit (not-encoded) operands.  For
> example, given a register keyword set such as "$0 .. $7", there are
> some instructions which are hard-wired to use only $0 as an input or
> output, in addition to other inputs/outputs.  Rather than leave the $0
> implicit, this assembly language expects the programmer to specify it.
> Say,
>         compare $0,$2,$3
> instead of
>         compare $2,$3
> 
> So, Ben is trying to implement this in the assembler by including the
> literal string "$0" in the syntax bytes of the instruction.  This is
> not too bad, though a possibly better way would be to associate a
> synthetic cgen operand with that slot, and to give it a parser that
> accepts only "$0", and emits a helpful error message for anything
> else.
> 
> - FChE
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-26  9:11       ` Dave Brolley
@ 2001-03-26 14:08         ` Ben Elliston
  2001-03-26 14:15           ` Dave Brolley
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Elliston @ 2001-03-26 14:08 UTC (permalink / raw)
  To: Dave Brolley; +Cc: Frank Ch. Eigler, cgen

Dave,

>>>>> "Dave" == Dave Brolley <brolley@redhat.com> writes:

  Dave> Yes -- see the fr30 for an example of this:
  Dave> h-r13 -- hardware element
  Dave> R13 -- special operand
  Dave> r13base-ld -- pmacro for generating insns which have r13 hardwired but 
  Dave> still specified

I took a look at fr30.cpu.

It seems that `h-r13' is not tied to the general purpose register
bank, though.  So if I use one of these `R13' instructions and then
later use `r13' in an instruction taking a general purpose register
operand, I don't see how I'll get the same register value.  Am I
missing something?

Ben

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-26 14:08         ` Ben Elliston
@ 2001-03-26 14:15           ` Dave Brolley
  2001-03-26 14:21             ` Frank Ch. Eigler
  0 siblings, 1 reply; 9+ messages in thread
From: Dave Brolley @ 2001-03-26 14:15 UTC (permalink / raw)
  To: Ben Elliston; +Cc: Frank Ch. Eigler, cgen

Yes --- the insns reference the regular hardeware for r13 directly (i.e. 
(reg h-gr 13) ). Probabloy what should have been done, and what you're 
expecting is that h-r13 should have a getter/setter pair that does this 
automatically.

FWIW, this is just an example of what Frank was pointing out. It's what 
I came up with at the time, probably because I hit the same $ problem as 
you did. I don't think that it's a better way than coding $ in the 
syntax string and handling it directly though.

Dave

Ben Elliston wrote:

> Dave,
> 
>>>>>> "Dave" == Dave Brolley <brolley@redhat.com> writes:
>>>>> 
> 
>   Dave> Yes -- see the fr30 for an example of this:
>   Dave> h-r13 -- hardware element
>   Dave> R13 -- special operand
>   Dave> r13base-ld -- pmacro for generating insns which have r13 hardwired but 
>   Dave> still specified
> 
> I took a look at fr30.cpu.
> 
> It seems that `h-r13' is not tied to the general purpose register
> bank, though.  So if I use one of these `R13' instructions and then
> later use `r13' in an instruction taking a general purpose register
> operand, I don't see how I'll get the same register value.  Am I
> missing something?
> 
> Ben
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: escaping in syntax strings
  2001-03-26 14:15           ` Dave Brolley
@ 2001-03-26 14:21             ` Frank Ch. Eigler
  0 siblings, 0 replies; 9+ messages in thread
From: Frank Ch. Eigler @ 2001-03-26 14:21 UTC (permalink / raw)
  To: Dave Brolley; +Cc: cgen

Hi -

brolley wrote:
: [...] I don't think that it's a better way than coding $ in the 
: syntax string and handling it directly though.

Yeah -- the main difference is in error detection.  Glancing at the
opcode/FOO-asm.c files, it looks like the message generated by a
syntax-string mismatch should be reasonably good 
	file:line: syntax error (expected char `0', found `2')
so I guess this simpler approach is okay.

- FChE
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6v8DQVZbdDOm/ZT0RArREAJ47Oy7ZmwiU1onjzRRRKa3/nkED2wCgg9Ya
JIuFR/Zp0LkWT/9PiA69JXE=
=F/lK
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-03-26 14:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-25 20:16 escaping in syntax strings Ben Elliston
2001-03-26  5:10 ` Frank Ch. Eigler
2001-03-26  5:22   ` Ben Elliston
     [not found]   ` <15039.17056.78350.71117.cygnus.local.cgen@scooby.apac.redhat.com>
2001-03-26  8:30     ` Frank Ch. Eigler
     [not found]   ` <o5wv9c1ojl.fsf.cygnus.local.cgen@toenail.toronto.redhat.com>
2001-03-26  8:49     ` Frank Ch. Eigler
2001-03-26  9:11       ` Dave Brolley
2001-03-26 14:08         ` Ben Elliston
2001-03-26 14:15           ` Dave Brolley
2001-03-26 14:21             ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).