home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!cubetech.com!imladris!moebius!peterc
- From: peterc@cubetech.com (Peter Creath)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: A few more suggestions for THINK C
- Date: Fri, 24 Jul 92 20:42:21 CDT
- Organization: Cube Technologies
- Message-ID: <dx3uv972.9c6tdb@moebius.cubetech.com>
- Reply-To: peterc@cubetech.com
- Distribution: comp
-
- Lines: 60
-
-
- In article <SRO.92Jul21221949@media-lab.media.mit.edu> (comp.sys.mac.programmer), sro@media.mit.edu (Shawn O'Donnell) writes:
- > Pardon my ignorance if THINK C already has such a function. Better
- > tell me now what it is.
-
- I take this disclaimer too! Does Think C automatically exclude functions
- which are not called when linking the final object? (Please tell
- me it does -- why have a 27k ANSI library when you just want sprintf()?)
-
- Enough of that. I know it doesn't currently label variables
- during disassembly (this would be a BIG plus...I suppose you'd have
- to use things like "offsetof(theStruct, element)", and if you're on
- that track, howzabout "sizeof(theStruct)" when doing struct calculations?
-
- Also, how about having the compiler keep track of which variable/pointer
- is in which register? I've seen generated code do this:
-
- lea myVariable,A0
- move.w #0x04,D0
- muls.w #0x0304,D0
- add.w D0,A0
- move.l (A0),D1
- lea myVariable,A0 /* note the redundance -- the correct address */
- move.w #0x04,D0 /* is already in A0 */
- muls.w #0x0304,D0
- add.w D0,A0
- move.l 0x04(A0),D1
- lea myVariable,A0
- move.w #0x04,D0
- muls.w #0x0304,D0
- add.w D0,A0
- move.l 0x08(A0),D1
-
- Which could be optimized to:
- lea myVariable,A0
- move.w #0x04,D0
- muls.w #0x0304,D0
- add.w D0,A0
- move.l (A0),D1
- move.l 0x04(A0),D1
- move.l 0x08(A0),D1
-
- or even:
- lea myVariable,A0
- move.w #0x04,D0
- muls.w #0x0304,D0
- add.w D0,A0
- move.l (A0)+,D1
- move.l (A0)+,D1
- move.l (A0)+,D1
-
- This usually occurs when using lots of struct elements...(particularly
- arrays of structs)...
-
- (and how about "DBF" command support during loop optimization?)
-
- ----------------------------------------------------------------------------
- Peter Creath "When I was a boy I was told that anybody could
- peterc@cubetech.com become president; I'm beginning to believe it."
- -- Clarence Darrow
-