Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!sri-unix!ctnews!pyramid!prls!mips!mash From: mash@mips.UUCP (John Mashey) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: Inline assembler; a quiz Message-ID: <464@winchester.UUCP> Date: Fri, 19-Jun-87 03:41:26 EDT Article-I.D.: winchest.464 Posted: Fri Jun 19 03:41:26 1987 Date-Received: Mon, 22-Jun-87 01:35:16 EDT References: <608@zen.UUCP> <2299@hoptoad.uucp> <21211@sun.uucp> Reply-To: mash@winchester.UUCP (John Mashey) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 39 Xref: mnetor comp.sys.ibm.pc:4963 comp.lang.c:2560 In article <21211@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes: >> >asm(""); >> Isn't this spo'sta be apart of the "Standard C". I seem to remember >> it being metioned in the K&R. >It is absolutely NOT supposed to be in standard C! .... Guy gives good list of reasons why not.... In support of at least one, our code generator normally passes its output to the assembler in binary form, although assembler can be generated. Use of asm would of course force the less efficient form, or force the code generator to parse the asm statement itself, a distasteful thought. More important: And finally, "asm" and global-optimizing compilers are fairly contradictory. A good optimizer: a) Mostly ignores register declarations. It allocates registers as appropriate. The same variable may well appear in several different places during the code. b) May, given slightly different source code, rearrange the register use substantially. c) Will find it VERY hard to figure out what an arbitrary "asm statement" is doing, in terms of side-effects. Finally, some questions: a) What global optimizing C compilers do people use out there? Known ones: MIPS, Green Hills, Sun's, DEC [newest Ultrix one, I think], Multiflow, Tartan Labs, newest IBM one for RT PC, HP's Spectrum compiler. Any others? Any for PC's? b) What global optimizers do people use to compile their UNIX kernels? i.e., which of them have implemented "volatile", without which device drivers are not easy. Having used both asm and serious optimizers, I know which I'd rather have. -- -john mashey DISCLAIMER: UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash, DDD: 408-720-1700, x253 USPS: MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086