This is the mail archive of the gcc-patches@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]

Re: Fix problem with late insns in sibcall


    I'm a bit confused about the calling conventions here.  I would have
    expected an in-out parameter to be treated like a reference type in
    C++.  That is, the bit that gets put into the hard register is the
    *address* of the data.

That's one way to do it, but not the only way.  For scalars, the address is
not taken and it's like there are two separate parameters: one "in" only and
one "out" only.  Then you have to know the rule for handling "out"
parameters, which is that if there is only one, it becomes the return of the
function and if there are two, a record is created containing all of them and
that record is the return type.

So

    procedure Shift (Value : in out Natural ) is
    begin
      Value := Value + By;
    end;

becomes

   int Shift (int Value) { return Value + By; }


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