This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] How suppress code generation of inlined operations


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]