From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-16 14:13:51 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!newsfeed.mathworks.com!portc03.blue.aol.com!uunet!dca.uu.net!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: RISC Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Fri, 16 Mar 2001 20:45:44 GMT References: <98qumf$5sf$1@nh.pace.co.uk> <98r4g1$7r1$1@nh.pace.co.uk> <3AB22CB2.E8A851A5@averstar.com> <98tmai$5q5$1@nh.pace.co.uk> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:5779 Date: 2001-03-16T20:45:44+00:00 List-Id: "Marin David Condic" writes: > And the only allowed operations on a table are assignments to/from fields or > assignments to/from the whole structure. (No math or other stuff - just data > motion) Would something like this take the burden off of the compiler > writer? I don't think it helps much. If you do X.Y * A.B, the compiler needs to extract bit fields for Y and B into registers. Once they're in registers, doing the multiply is no problem. Disallowing that multiply would not simplify. I suppose there are some interactions if you try to optimize: eg, if I write "if This.X = That.X then ..." I'd like to see the shifts normally used to access the bitfield X optimized away. But it's still no help to disallow it. The complexity that Tucker was talking about is in generating code for reading and writing components. If you want any reasonable kind of efficiency, and you insist on generality, the compiler needs to know several ways of accessing components: those that are nicely aligned on storage unit boundaries, those that are bit fields within a single word, those that are bit fields crossing word boundaries, those that are bit fields that are bigger than a word, &c. And it's machine dependent (some machines have double-word shifts and whatnot), which means the complexity is multiplied across all targets supported. But it's not *that* complicated (at least the complexity is fairly localized), and as I said, I think it's worth it. Anyway, I don't like these kinds of restrictions in a language design. It's annoying to the programmer, and too often the restriction doesn't actually help the compiler -- in fact, it makes the compiler's job harder, because it has to check the restriction rules. Think of the restrictions on array indices in early versions of FORTRAN -- a variable, a variable plus a literal, and a few others, based on the indexing modes of long-forgotten hardware. For the compiler, it's actually simpler if array indices are just general expressions. - Bob