Re: Possible ANSI C Optimisation Done in Practice?

ralph@inputplus.demon.co.uk (Ralph Corderoy)
20 Dec 2001 00:29:14 -0500

          From comp.compilers

Related articles
Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-11)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (Ralph Corderoy) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? rsherry8@home.com (Robert Sherry) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? rbates@southwind.net (Rodney M. Bates) (2001-12-15)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-19)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? RLWatkins@CompuServe.Com (R. L. Watkins) (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-20)
Re: Possible ANSI C Optimisation Done in Practice? nmm1@cus.cam.ac.uk (2001-12-22)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-22)
Re: Possible ANSI C Optimisation Done in Practice? ralph@inputplus.demon.co.uk (2001-12-24)
[6 later articles]
| List of all articles for this month |
From: ralph@inputplus.demon.co.uk (Ralph Corderoy)
Newsgroups: comp.compilers
Date: 20 Dec 2001 00:29:14 -0500
Organization: InputPlus Ltd.
References: 01-12-050 <200112120335.fBC3ZMg01140@budgie.cs.uwa.edu.au> 01-12-065
Keywords: optimize
Posted-Date: 20 Dec 2001 00:29:13 EST

I said:
> An ANSI C compiler does know the semantics of strlen if the compiler
> writers have arranged for that to be the case. For instance, AIX's
> <string.h> #defines strlen to be __strlen which the compiler
> recognises as *the* standard strlen function.


Something I just found: Robert Morgan in _Building an Optimizing
Compiler_ says on page 25


        Library routines are handled differently than other procedure
        calls. If a library procedure is known to be a pure function it is
        handled as if it were an operator. This allows the use of
        identities involving the library routines. Other procedure calls
        may be used in other parts of the analysis of the program, for
        example, calls on malloc are known to return either a null pointer
        or a pointer to a section of memory unreferenced in other parts of
        the program.


strlen(s) is pure. So that just leaves determining modifying *t
doesn't touch s.


Ralph.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.