* Re: asm in ada [not found] <Ihps5.149$xr6.264251@nnrp6.proxad.net> @ 2000-09-06 3:35 ` William J. Thomas 2000-09-06 12:41 ` Robert Dewar 0 siblings, 1 reply; 4+ messages in thread From: William J. Thomas @ 2000-09-06 3:35 UTC (permalink / raw) If its the intel version, look for Machine_Operations_386. Its a real piece of work, a real gem. "Etienne" <etienne.baudin@wanadoo.fr> wrote in message news:Ihps5.149$xr6.264251@nnrp6.proxad.net... > Hello, > I'd like to know if inserting asm code is possible in objectAda (how?) > Thanks > Etienne > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: asm in ada 2000-09-06 3:35 ` asm in ada William J. Thomas @ 2000-09-06 12:41 ` Robert Dewar 2000-09-06 13:51 ` Gautier de Montmollin 0 siblings, 1 reply; 4+ messages in thread From: Robert Dewar @ 2000-09-06 12:41 UTC (permalink / raw) In article <fTit5.192$N13.24942@eagle.america.net>, "William J. Thomas" <wjthomas@wcvt.com> wrote: > If its the intel version, look for Machine_Operations_386. Its a real piece > of work, a real gem. > > "Etienne" <etienne.baudin@wanadoo.fr> wrote in message > news:Ihps5.149$xr6.264251@nnrp6.proxad.net... > > Hello, > > I'd like to know if inserting asm code is possible in objectAda (how?) > > Thanks > > Etienne Well that's a nice note (the design of the Object Ada facility comes from my original design for Alsys Ada, back in the old days when I worked for Alsys). I agree it's a nice design :-) Note that nearly all compilers will provide a facility for either machine code insertions, or package machine code, since this is required by the systems programming annex which most Ada 95 compilers implement. However, the facility is in general VERY target dependent (except on the Motorola 88000 where interestingly the official system ABI dictated what package Machined_Code must look like for any Ada compiler for that system, at least so I am told :-) That means you have to look into the specific compiler documentation from the vendor. In the case of GNAT, for example, both package machine code and intrinsics are available, and they are based on interfacing directly with the internal register transfer language used by the compiler. This is a little complex, but has the advantage that the optimizer can fully deal with insertions, they can be inlined etc. Anyway, you have to go to the particular compiler in question for this information, and the resulting program is likely to be highly non-portable. It is often better to either try to avoid the use of ASM completely (it would be interesting to know why you are using it, so often there are ways to do what you want in Ada after all), or to write a small assembler routine (which surprisingly is likely to be more portable than writing asm inserts). Robert Dewar Sent via Deja.com http://www.deja.com/ Before you buy. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: asm in ada 2000-09-06 12:41 ` Robert Dewar @ 2000-09-06 13:51 ` Gautier de Montmollin 2000-09-06 22:03 ` Samuel T. Harris 0 siblings, 1 reply; 4+ messages in thread From: Gautier de Montmollin @ 2000-09-06 13:51 UTC (permalink / raw) Robert Dewar: > It is often better to either try to avoid the use of ASM > completely (it would be interesting to know why you are using > it, so often there are ways to do what you want in Ada after > all), or to write a small assembler routine (which surprisingly > is likely to be more portable than writing asm inserts). Apart of hardware-oriented instructions, asm code seems to me useless if the compiler provides advanced optimizations, like GNAT. It is in general useless to try to outperform it. It's better to see the feedback given by produced asm ("gcc -S") and execution speed, for choosing the most convenient data structures, "to inline or not to inline", etc. . A good surprise among others is that passing and using an elegant unconstrained vector seems faster than passing N numbers as parameters - surely it is more "speaking" to the optimizer. With 3.13 it is surely even nicer... As for ObjectAda, despite its wonderful programming environment, I fear that it doesn't optimize at all (slow code and no option beyond suppress_all). Unless I'm wrong ?... In the Borland Pascal days, "to optimize" meant "to write inline assembler code for that"... ______________________________________________________ Gautier -- http://members.xoom.com/gdemont/gsoft.htm ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: asm in ada 2000-09-06 13:51 ` Gautier de Montmollin @ 2000-09-06 22:03 ` Samuel T. Harris 0 siblings, 0 replies; 4+ messages in thread From: Samuel T. Harris @ 2000-09-06 22:03 UTC (permalink / raw) Gautier de Montmollin wrote: > > Robert Dewar: > > > It is often better to either try to avoid the use of ASM > > completely (it would be interesting to know why you are using > > it, so often there are ways to do what you want in Ada after > > all), or to write a small assembler routine (which surprisingly > > is likely to be more portable than writing asm inserts). > > Apart of hardware-oriented instructions, asm code seems to me > useless if the compiler provides advanced optimizations, like GNAT. > It is in general useless to try to outperform it. When our hardware vendor gave us some machine code to do semaphores which outperforms an Ada task for the same purpose, and that semaphore is used hundreds of times a second, then we use a machine code subprogram. I would say it is usually useless to try to outperform the compiler. But the thoughful developer will recognize the appropriate opportunities and exploit them. -- Samuel T. Harris, Principal Engineer Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!" ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-09-06 22:03 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <Ihps5.149$xr6.264251@nnrp6.proxad.net> 2000-09-06 3:35 ` asm in ada William J. Thomas 2000-09-06 12:41 ` Robert Dewar 2000-09-06 13:51 ` Gautier de Montmollin 2000-09-06 22:03 ` Samuel T. Harris
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox