linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ASM formatting rules?
@ 2005-03-28 16:44 Kumar Gala
  2005-03-28 16:56 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kumar Gala @ 2005-03-28 16:44 UTC (permalink / raw)
  To: Paul Mackerras, Tom Rini, Matt Porter, Benjamin Herrenschmidt
  Cc: linuxppc-dev list, ML linuxppc-embedded

Guys,

While this is not overly important to me, I was wondering if we had any 
rules related to formatting of assembly files.  We seem to have code 
formatted with and without spaces in the args.

I'm assuming something like this (w/o spaces):

<TAB>insn<TAB>argD,arg1,arg2

is what we want?  Just trying to get a rule documented going forward.

- kumar

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

* Re: ASM formatting rules?
  2005-03-28 16:44 ASM formatting rules? Kumar Gala
@ 2005-03-28 16:56 ` Tom Rini
  2005-03-28 17:11   ` Dan Malek
  2005-03-28 17:22   ` Matt Porter
  2005-03-28 21:37 ` Paul Mackerras
  2005-03-28 22:21 ` Benjamin Herrenschmidt
  2 siblings, 2 replies; 10+ messages in thread
From: Tom Rini @ 2005-03-28 16:56 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras, ML linuxppc-embedded

On Mon, Mar 28, 2005 at 10:44:17AM -0600, Kumar Gala wrote:
> Guys,
> 
> While this is not overly important to me, I was wondering if we had any 
> rules related to formatting of assembly files.  We seem to have code 
> formatted with and without spaces in the args.
> 
> I'm assuming something like this (w/o spaces):
> 
> <TAB>insn<TAB>argD,arg1,arg2
> 
> is what we want?  Just trying to get a rule documented going forward.

My preference is for spaces after each , just because it makes it
visually clearer (and I don't always have instant mental insn->#args
mental mapping :)).

-- 
Tom Rini
http://gate.crashing.org/~trini/

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

* Re: ASM formatting rules?
  2005-03-28 16:56 ` Tom Rini
@ 2005-03-28 17:11   ` Dan Malek
  2005-03-28 17:22   ` Matt Porter
  1 sibling, 0 replies; 10+ messages in thread
From: Dan Malek @ 2005-03-28 17:11 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev list, Paul Mackerras, ML linuxppc-embedded


On Mar 28, 2005, at 11:56 AM, Tom Rini wrote:

> My preference is for spaces after each , just because it makes it

Me, too.

Thanks.

	-- Dan

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

* Re: ASM formatting rules?
  2005-03-28 16:56 ` Tom Rini
  2005-03-28 17:11   ` Dan Malek
@ 2005-03-28 17:22   ` Matt Porter
  1 sibling, 0 replies; 10+ messages in thread
From: Matt Porter @ 2005-03-28 17:22 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev list, Paul Mackerras, ML linuxppc-embedded

On Mon, Mar 28, 2005 at 09:56:11AM -0700, Tom Rini wrote:
> On Mon, Mar 28, 2005 at 10:44:17AM -0600, Kumar Gala wrote:
> > Guys,
> > 
> > While this is not overly important to me, I was wondering if we had any 
> > rules related to formatting of assembly files.  We seem to have code 
> > formatted with and without spaces in the args.
> > 
> > I'm assuming something like this (w/o spaces):
> > 
> > <TAB>insn<TAB>argD,arg1,arg2
> > 
> > is what we want?  Just trying to get a rule documented going forward.
> 
> My preference is for spaces after each , just because it makes it
> visually clearer (and I don't always have instant mental insn->#args
> mental mapping :)).

As long as there is <TAG>insn<TAB>, I don't have strong feelings
about the arg spacing.  I feel that spaces between args really
don't enhance readability (why I have none between args in
head_44x.S) but I can live with them.

I think this is a good idea to get some consistency throughout
ppc32 asm.

-Matt

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

* Re: ASM formatting rules?
  2005-03-28 16:44 ASM formatting rules? Kumar Gala
  2005-03-28 16:56 ` Tom Rini
@ 2005-03-28 21:37 ` Paul Mackerras
  2005-03-28 23:07   ` Kumar Gala
  2005-03-28 22:21 ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 10+ messages in thread
From: Paul Mackerras @ 2005-03-28 21:37 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Tom Rini, linuxppc-dev list, ML linuxppc-embedded

Kumar Gala writes:

> I'm assuming something like this (w/o spaces):
> 
> <TAB>insn<TAB>argD,arg1,arg2
> 
> is what we want?  Just trying to get a rule documented going forward.

Yep, that's the style we use.

Paul.

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

* Re: ASM formatting rules?
  2005-03-28 16:44 ASM formatting rules? Kumar Gala
  2005-03-28 16:56 ` Tom Rini
  2005-03-28 21:37 ` Paul Mackerras
@ 2005-03-28 22:21 ` Benjamin Herrenschmidt
  2005-03-29  8:32   ` Gabriel Paubert
  2 siblings, 1 reply; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2005-03-28 22:21 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Tom Rini, linuxppc-dev list, Paul Mackerras, ML linuxppc-embedded

On Mon, 2005-03-28 at 10:44 -0600, Kumar Gala wrote:
> Guys,
> 
> While this is not overly important to me, I was wondering if we had any 
> rules related to formatting of assembly files.  We seem to have code 
> formatted with and without spaces in the args.
> 
> I'm assuming something like this (w/o spaces):
> 
> <TAB>insn<TAB>argD,arg1,arg2
> 
> is what we want?  Just trying to get a rule documented going forward.

I used to have argD, arg1, arg2 but since everything else was "compact",
I now tend to adapt to everything else ;)

Ben.

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

* Re: ASM formatting rules?
  2005-03-28 21:37 ` Paul Mackerras
@ 2005-03-28 23:07   ` Kumar Gala
  2005-04-04  6:33     ` Paul Mackerras
  0 siblings, 1 reply; 10+ messages in thread
From: Kumar Gala @ 2005-03-28 23:07 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Tom Rini, linuxppc-dev list, ML linuxppc-embedded

Great, if my counting is correct (which may not be, since I grow up in=20=

Florida)

2 - for no space (Paul, BenH)
2 - for spaces (Tom, Dan)
2 - dont cares (Kumar, Matt)

Well, does Paul have authoritative rule here as ppc maintainer? :)

- kumar

On Mar 28, 2005, at 3:37 PM, Paul Mackerras wrote:

> Kumar Gala writes:
>
> > I'm assuming something like this (w/o spaces):
>  >
> > <TAB>insn<TAB>argD,arg1,arg2
> >
> > is what we want?=A0 Just trying to get a rule documented going =
forward.
>
> Yep, that's the style we use.
>
> Paul.

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

* Re: ASM formatting rules?
  2005-03-28 22:21 ` Benjamin Herrenschmidt
@ 2005-03-29  8:32   ` Gabriel Paubert
  0 siblings, 0 replies; 10+ messages in thread
From: Gabriel Paubert @ 2005-03-29  8:32 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Tom Rini, ML linuxppc-embedded, Paul Mackerras, linuxppc-dev list

On Tue, Mar 29, 2005 at 08:21:50AM +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2005-03-28 at 10:44 -0600, Kumar Gala wrote:
> > Guys,
> > 
> > While this is not overly important to me, I was wondering if we had any 
> > rules related to formatting of assembly files.  We seem to have code 
> > formatted with and without spaces in the args.
> > 
> > I'm assuming something like this (w/o spaces):
> > 
> > <TAB>insn<TAB>argD,arg1,arg2
> > 
> > is what we want?  Just trying to get a rule documented going forward.
> 
> I used to have argD, arg1, arg2 but since everything else was "compact",
> I now tend to adapt to everything else ;)

Assembly is not C! I don't like the space after the comma in
assembly, but can adapt to (almost) any style.

For the record, the biggest file of PPC assembly I wrote 
(the real mode x86 emulator to initialize graphics board
through BIOS emulation) is really atypical:

1) it has two tabs before the opcode, because it must  
accomodate really_long_labels and a single tab is not enough.

2) only a space between the opcode and the operands, but many 
registers have fixed uses and have mnemonic names through #defines.
This helps a lot for readability and maintainability. See 4)
for the reason.

3) no space after the comma between operands.

4) Sometimes several instructions separated by a semicolon in 
the same line, but only the first instruction may have a label. 
That's because at the time I wanted to see as much as possible 
on a small screen. But this does not mix well with putting
tabs between instruction and operands, hence 2).

I don't think these rules ar generally applicable to 
assembly files, these were specific rules which matched
my needs for this file (5000 lines).

	Gabriel

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

* Re: ASM formatting rules?
  2005-03-28 23:07   ` Kumar Gala
@ 2005-04-04  6:33     ` Paul Mackerras
  2005-04-05 16:45       ` Dan Malek
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Mackerras @ 2005-04-04  6:33 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Tom Rini, linuxppc-dev list, ML linuxppc-embedded

Kumar Gala writes:

> Great, if my counting is correct (which may not be, since I grow up in 
> Florida)
> 
> 2 - for no space (Paul, BenH)
> 2 - for spaces (Tom, Dan)
> 2 - dont cares (Kumar, Matt)
> 
> Well, does Paul have authoritative rule here as ppc maintainer? :)

I would take a similar attitude to Linus and say that if there is
someone who has taken on the role of maintaining a file or subsystem,
they get a fair bit of latitude in saying what the style should be
there.  So if Dan and Tom want to do "insn<TAB>op, op, op" in
head_8xx.S, I'm not going to go in and remove all the excess spaces.

However, apart from that - i.e. for code that is used on all PPC
platforms, or if people are asking what the style should be - then the
style is no spaces between the operands.

Paul.

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

* Re: ASM formatting rules?
  2005-04-04  6:33     ` Paul Mackerras
@ 2005-04-05 16:45       ` Dan Malek
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Malek @ 2005-04-05 16:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list, Tom Rini, ML linuxppc-embedded


On Apr 4, 2005, at 2:33 AM, Paul Mackerras wrote:

> However, apart from that - i.e. for code that is used on all PPC
> platforms, or if people are asking what the style should be - then the
> style is no spaces between the operands.

OK ....  I'll try to change my old habits :-)


	-- Dan

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

end of thread, other threads:[~2005-04-05 16:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-28 16:44 ASM formatting rules? Kumar Gala
2005-03-28 16:56 ` Tom Rini
2005-03-28 17:11   ` Dan Malek
2005-03-28 17:22   ` Matt Porter
2005-03-28 21:37 ` Paul Mackerras
2005-03-28 23:07   ` Kumar Gala
2005-04-04  6:33     ` Paul Mackerras
2005-04-05 16:45       ` Dan Malek
2005-03-28 22:21 ` Benjamin Herrenschmidt
2005-03-29  8:32   ` Gabriel Paubert

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 NNTP newsgroup(s).