From kevin.bracey@tematic.com Fri Aug 29 15:25:58 2003 Path: ewrotcd!feed-ewrotcd!pegasus.csx.cam.ac.uk!server1.netnews.ja.net!fu-berlin.de!peer01.cox.net!cox.net!news-out.visi.com!petbe.visi.com!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!news.globalcrossing.net!tematic.com%kbracey From: Kevin Bracey Newsgroups: comp.sys.acorn.programmer Subject: Re: which compiler for 26bit Date: Fri, 29 Aug 2003 14:53:26 +0100 Organization: Tematic Ltd Lines: 108 Message-ID: <99e598294c.kbracey@tematic.com> References: <6ac631284c.nico@neptune.demon.nl> <0c4fa5284c.druck@druck.freeuk.net> <423a36294c.philpem@dsl.pipex.com> <3F4F435F.F2E27416@huber-net.de> NNTP-Posting-Host: nnrp2.phx1.gblx.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: node21.cwnet.roc.gblx.net 1062165369 28362 64.214.31.41 (29 Aug 2003 13:56:09 GMT) X-Complaints-To: abuse@gblx.net NNTP-Posting-Date: Fri, 29 Aug 2003 13:56:09 +0000 (UTC) User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/3.70) NewsHound/1.42 X-Editor: Zap, using ZapEmail 0.23 (11 Feb 1999) alpha-4 Cache-Post-Path: ananke.eclipse.net.uk!unknown@81.168.2.176 X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Cache-Post-Path: nnrp2.phx1.gblx.net!212.104.129.36 X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Xref: news.chiark.greenend.org.uk comp.sys.acorn.programmer:10182 In message Stewart Brodie wrote: > Steffen Huber wrote: > > > Interesting! Now we just need someone who tells us what the following > > switches do: > > -zpq1 > > -zpq2 > > -zpq4 > > -zpq8 > > -zpq16 > > -zpq32 > > ... > > They aren't very exciting, and, on the whole, the documentation would be > pretty much meaningless to those who don't have the compiler sources (in > which case, they'd have the documentation). e.g. The -zpq262144 option is > documented simply as "Disables BLK2EXIT stuff". Documented wrongly, at that - someone at ARM/Codemist obviously didn't keep the header file in sync :) It actually now disables the "shrinkwrap" optimisation - to wit: int test1(char *x) { if (!x) return -1; return strlen(x)+atoi(x); } without shrinkwrap compiles to: test1 MOV ip,sp STMDB sp!,{a1,v1,v2,fp,ip,lr,pc} SUB fp,ip,#4 CMP sp,sl BLMI __rt_stkovf_split_small MOVS v1,a1 MVNEQ a1,#0 LDMEQDB fp,{v1,v2,fp,sp,pc} BL strlen MOV v2,a1 MOV a1,v1 BL atoi ADD a1,v2,a1 LDMDB fp,{v1,v2,fp,sp,pc} with shrinkwrap: test1 CMP a1,#0 MVNEQ a1,#0 MOVEQ pc,lr MOV ip,sp STMDB sp!,{a1,v1,v2,fp,ip,lr,pc} SUB fp,ip,#4 CMP sp,sl BLMI __rt_stkovf_split_small MOV v1,a1 BL strlen MOV v2,a1 MOV a1,v1 BL atoi ADD a1,v2,a1 LDMDB fp,{v1,v2,fp,sp,pc} The idea is to allow the "fast" cases of a function to avoid the full function entry/exit overhead. The -zp option is actually the command-line equivalent of pragma. If you want to modify this flag on a per-function basis, you could just use #pragma -q262144 and #pragma -q0. For those who actually care, here are the meaningful -zpq values: 1 Reduce the impact of the 'register' storage class. 4 Disable register allocation spill 'cleaning' 8 Disable peepholing 16 Disable the tail-call optimisation 32 CSE: Disable heap pointer dataflow (ie malloc etc returns) 64 CSE: Disable propagating local values 128 Toggle old ASD table format 256 Disable live range splitting 512 __swi functions corrupt the PSR 1024 Disable preservation of unused a1-a4 across function call 2048 Disable regalloc copy-avoidance preference 4096 Disable regalloc allocation preference calculation 8192 Disable function inlining (forces out-of-line) 131072 Disable structure splitting 262144 Disable shrinkwrap 524288 Disable tail recursion -> loop transformation 1048576 Disable direct substituion of inline function arguments 8388608 Suppress generation of fpdesc tables Most of those are of little use to most people, except in the case where something is going wrong - there may be a -zpq value that disables the particular optimisation. ARM's latest compilers have taken the sensible step of subsuming the opaque -zpq option into the more verbose -O; you can say -Ono_shrinkwrap. -- Kevin Bracey, Principal Software Engineer Tematic Ltd Tel: +44 (0) 1223 503464 182-190 Newmarket Road Fax: +44 (0) 1223 503458 Cambridge, CB5 8HE, United Kingdom WWW: http://www.tematic.com/