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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,590fea1a83d154a9 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Package Logical performance optimizations Date: 1997/06/15 Message-ID: #1/1 X-Deja-AN: 248588552 References: <01bc78c6$2245f8c0$02899dc0@dorje.east.aonix.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-06-15T00:00:00+00:00 List-Id: Ed said <> (talking of the x86 intrinsics). That's nice to hear, since as I said I think that was a nice design. One thing to realize however, is that whenever you use such facilities, you are introducing not just machine dependence, but also compiler dependence. As I noted before, there is no standardization of the Machine_Code package or equivalent intrinsics, even on a particular target, and different compilers may differ very widely. GNAT also provides a complete implementation of package Machine_Code and machine code intrinsics on all targets, but at a quite different level, which has advantages and disadvantages. The Object Ada facility is basically raw assembly language, the code generator does not really know what you are doing, and it is up to you to generate an appropriate set of instructions which fits in with what is going on around the code. The advantage of this approach is that it really is very similar to just writing assembler, and so if you know ASM and Ada well, you can easily use this facility. GNAT on the other hand, uses the gcc facilities for machine code. These hook into the gcc code generator, since basically you are generating RTL, and for example, you can use symbolic registers, and have the code generator pick the right registers, fitting in with other use (and optimization) going on around. You can control absolute registers if you want on a machine like the x86, where all registers are different, but you don't have to. This approach is a little more flexible, but it requires a fair amount of understanding of how machine instructions are represented at the RTL level, which means you have to know something about GCC, as well as about ASM and Ada.