home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / arch / 10950 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.8 KB

  1. Xref: sparky comp.arch:10950 comp.lang.misc:3805
  2. Newsgroups: comp.arch,comp.lang.misc
  3. Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!yktnews!prener
  4. From: prener@watson.ibm.com (Dan Prener)
  5. Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
  6. Sender: news@watson.ibm.com (NNTP News Poster)
  7. Message-ID: <PRENER.92Nov20014621@prener.watson.ibm.com>
  8. In-Reply-To: bret@technix.mn.org's message of Thu, 19 Nov 1992 03:43:25 GMT
  9. Date: Fri, 20 Nov 1992 06:46:21 GMT
  10. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  11. References: <Bxs63J.BxA@exnet.co.uk> <BxtA6v.CE8@mentor.cc.purdue.edu>
  12.     <id.HJ1V.BTG@ferranti.com> <1992Nov19.034325.3864@technix.mn.org>
  13. Nntp-Posting-Host: prener.watson.ibm.com
  14. Organization: IBM T.J. Watson Research Center, Hawthorne, New York
  15. Lines: 38
  16.  
  17. In article <1992Nov19.034325.3864@technix.mn.org> bret@technix.mn.org (Bret Indrelee) writes:
  18.  
  19. >    In article <id.HJ1V.BTG@ferranti.com> peter@ferranti.com (peter da silva) writes:
  20. >    >In article <BxtA6v.CE8@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  21. >    >> But it is.  The operations often use register arguments and the results
  22. >    >> are wanted in registers.
  23. >    >
  24. >    >What's a register? Most modern compilers ignore "register", or use it as a
  25. >    >hint "this is a frequently used value".
  26. >    >
  27. >    >And how is an inline library part of the language more than a subroutine
  28. >    >or an include file?
  29. >    Which brings up a question I've wondered about.  Do any compilers use
  30. >    'register' to indicate that a pointer reference DOESN'T access the
  31. >    value?
  32. >    If so, it once again becomes usefull to use the register keyword,
  33. >    as a no-alias.  Compiler could optimize knowing that the value isn't
  34. >    changed by that weird intervening pointer reference.
  35.  
  36. There are two separate issues here.  One is a minor point for language
  37. lawyers.  There is some semantic content to C's "register" declaration,
  38. namely that it is illegal to take the address of a "register" variable.
  39.  
  40. Which leads to the optimization issue.  Compilers don't have to be
  41. completely pessimistic about what might be changed by pointer references.
  42. With a suitable definition of what it means for a variable to have its
  43. address taken, pointer references can only change those variables that
  44. have had their addresses taken.
  45.  
  46. So, while it is true that register variables may lead to better optimization,
  47. that is because they never have their addresses taken.  So, with a compiler
  48. that keeps track of which variables have their addresses taken, the
  49. performance improvements resulting from the use of register variables remain,
  50. even after you delete the "register" declaration.
  51. --
  52.                                    Dan Prener (prener@watson.ibm.com)
  53.