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


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

Re: Register names and dollar signs


Greg McGary writes:
 > Greg McGary <greg@mcgary.org> writes:
 > 
 > > This patch prepends the prefix onto the keyword strings:
 > 
 > I just committed that one.
 > 
 > Now, I have another problem.  I want to also allow numeric register
 > designations $0..$31 as aliases for the ABI-role names ($at, $v0..$v4,
 > $a0..$a9, $s0..$s2, $gp, $sp, $fp, $ra).  The verbose way of doing
 > it is to define this lot:
 > 
 > 	     (0  0)  (1  1)  (2  2)  (3  3)  (4  4)  (5  5)  (6  6)  (7  7)
 > 	     (8  8)  (9  9) (10 10) (11 11) (12 12) (13 13) (14 14) (15 15)
 > 	    (16 16) (17 17) (18 18) (19 19) (20 20) (21 21) (22 22) (23 23)
 > 	    (24 24) (25 25) (26 26) (27 27) (28 28) (29 29) (30 30) (31 31)
 > 
 > However, I need this patch to make it work:
 > 
 > Index: desc.scm
 > ===================================================================
 > RCS file: /cvs/src/src/cgen/desc.scm,v
 > retrieving revision 1.2
 > diff -u -p -r1.2 desc.scm
 > --- desc.scm	2000/12/02 00:18:57	1.2
 > +++ desc.scm	2000/12/02 00:19:59
 > @@ -122,7 +122,10 @@ static const CGEN_ATTR_ENTRY bool_attr[]
 >  		 (string-map (lambda (e)
 >  			       (string-append
 >  				"  { \""
 > -				(elm-get self 'prefix) (car e) ; operand name
 > +				(elm-get self 'prefix)
 > +				(if (number? (car e))
 > +				    (number->string (car e))
 > +				    (car e)) ; operand name
 >  				"\", "
 >  				(if (string? (cadr e))
 >  				    (cadr e)
 > 
 > I'd like to commit this also.

I'd rather not go down this road.

How about

("0"  0)  ("1"  1)  ("2"  2)  ("3"  3)  ("4"  4)  ("5"  5)  ("6"  6)  ("7"  7)
("8"  8)  ("9"  9) ("10" 10) ("11" 11) ("12" 12) ("13" 13) ("14" 14) ("15" 15)
("16" 16) ("17" 17) ("18" 18) ("19" 19) ("20" 20) ("21" 21) ("22" 22) ("23" 23)
("24" 24) ("25" 25) ("26" 26) ("27" 27) ("28" 28) ("29" 29) ("30" 30) ("31" 31)

You should be able to shorten that with .iota, .str, etc.

 > Longer term, should we support a compact encoding, such as a boolean
 > attribute that says for every instance of (name value), implicitly
 > define (value value) as well?

I'm not sure about this.  Seems like a kludge.  Let's wait until
we see a need for it from more than just one chip.
Macros like .iota,.str simplify things a lot.

I never did like mips's register naming, and I don't want
to excessively complicate things.  What we're talking about here is
assembler syntax issues and cgen isn't intended to completely
solve every kind of issue that can crop up in this space.
Sometimes it's better to solve things out-of-band than pollute the
description language.

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