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]

Re: PATCH: New function attribute - call_asm


On Sun, Jan 14, 2001 at 03:26:53PM -0000, Alastair J. Houghton wrote:
> It often used to irritate me that you couldn't get GCC to emit
> non-standard call instructions (especially on my old Atari ST, where
> the O/S functions were all exposed via 68K "trap" instructions). So
> I thought I'd try adding a new function attribute to make GCC support
> this behaviour.

The idea is generally good.

There are a couple of things that want changing in order to be
generally useful:

  * It would be better to use ASM_OPERAND instead of ASM_INPUT.
    ASM_INPUT gives so little information to the compiler that
    we don't deal with it well at all.

    Changing to ASM_OPERAND will require:

    + Finding the hard return registers for the function call and
      recording those as set by the asm_operand.  Note that there
      may be more than one return register.  Use "" as the
      constraint so that reload or regrename doesn't change things.
    
    + Clobber all call-clobbered registers that are not return
      registers.

    + Clobber memory.

    + Cooperate with MD_ASM_CLOBBERS.

  * The asm that you generate should use any register arguments.
    Otherwise they will be removed as dead code.  Again, you should
    use "" as the constraint.

  You may well be able to call back into expand_asm_operands in
  order to get all this done.

  * Use lookup_attribute instead of adding yet another DECL field.


r~

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