This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[Ada] How suppress code generation of inlined operations
- From: rolf dot ebert dot gcc at gmx dot de
- To: gcc at gcc dot gnu dot org
- Date: Mon, 13 Jan 2003 10:01:59 +0100 (MET)
- Subject: [Ada] How suppress code generation of inlined operations
- References: <19200.1042214372@www5.gmx.net>
My package spec declares an inlined operation:
package AVR.IO is
pragma Pure(AVR.IO);
-- type IO_Address is new Unsigned_8 range 0 .. 63; is defined in
-- the AVR package spec.
-- read value from I/O register IO_Reg
function Get_IO(IO_Reg : IO_Address) return Unsigned_8;
pragma Inline_Always(Get_IO);
end AVR.IO;
In the body the function is realized in assembler code:
with System.Machine_Code; use System.Machine_Code;
package body AVR.IO is
function Get_IO(IO_Reg : IO_Address) return Unsigned_8 is
Value : Unsigned_8;
begin
pragma Warnings(Off);
Asm("in %0,%1",
Outputs => Unsigned_8'Asm_Output("=r", Value),
Inputs => IO_Address'Asm_Input("I", IO_Reg),
Volatile => True);
return Value;
end Get_IO;
end AVR.IO;
This all works well and correctly for all clients of the package, i.e.
code using the Get_IO function. The Ada binding step gnatbind
requires to compile the package itself. As the input contraint I
(constant in the range 0 .. 63) asks for a compile time constant
the compiler cannot generate code and issues an error.
The Get_IO function is inlined anyway. There is no use to generate code
for a callable function. How can one inhibit the code generation for a
specific function?
I tried the pragma Eliminate on the function. That, however, causes error
messages at the locations, where Get_IO is used.
Rolf
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!