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-Thread: 103376,46a68619f4362304 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!bigfeed2.bellsouth.net!news.bellsouth.net!elnk-atl-nf1!newsfeed.earthlink.net!cyclone.tampabay.rr.com!news-post.tampabay.rr.com!cyclone2.kc.rr.com!news2.kc.rr.com!twister.socal.rr.com.POSTED!53ab2750!not-for-mail Sender: kst@nuthaus.mib.org Newsgroups: comp.lang.ada Subject: Re: Specifying parameter passing convention and place (register) References: From: Keith Thompson Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 09 Jul 2004 21:29:08 GMT NNTP-Posting-Host: 66.91.245.136 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1089408548 66.91.245.136 (Fri, 09 Jul 2004 14:29:08 PDT) NNTP-Posting-Date: Fri, 09 Jul 2004 14:29:08 PDT Organization: RoadRunner - West Xref: g2news1.google.com comp.lang.ada:2134 Date: 2004-07-09T21:29:08+00:00 List-Id: "Nick Roberts" writes: > What form should a pragma take for specifying the convention and place > (register or in memory) for the passing of parameters into and out of > subprograms? [...] > A different possible approach is the use of representation attributes on > subtypes. The GNAT attribute Passed_By_Reference could be used to specify > whether a parameter of the subtype is passed by reference or by copy > (value). An attribute such as Passing_Place could be a value of an > enumeration such as, for example: > > type Parameter_Passing_Place is > ( Default, Stack, > AL, AH, DL, DH, CL, CH, BL, BH, > AX, DX, CX, BX, SI, DI, BP, SP, > EAX, EDX, ECX, EBX, ESI, EDI, EBP, ESP, > ST_0, ST_1, ..., ST_7, > EDX_EAX, ECX_EBX, > ES, FS, GS, ES_EAX, FS_EDX, GS_ECX ); > > This way, I can declare, for example: > > subtype Integer_Passed_In_EAX is Integer; > for Integer_Passed_By_EAX'Passing_Place use EAX; > > and then I can declare a function: > > function Wibble (N: in Integer_Passed_In_EAX) > return Integer_Passed_In_EAX; > > in order to specify that the parameter N and the function are both to be > passed in the register EAX. [...] It seems counterintuitive to associate the parameter passing method with a subtype rather than with a formal parameter. What about something like this? function Wibble (N: in Integer); for Wibble'Parameter_Passing use ( N => EAX ); Adjust names and syntax to taste. -- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this.