This is the mail archive of the 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: PATCH for sibcalls on i386

On Tue, Sep 24, 2002 at 02:31:40PM +1000, Andreas Bauer wrote:
> > Please consider turning FUNCTION_OK_FOR_SIBCALL into a "target hook"
> > with this patch, too.
> Please, send me more information on this request, if it's important or
> relevant to you.

In target.h, there is a structure struct gcc_target.  Add a 
new member

	bool (*function_ok_for_sibcall) PARAMS ((tree, tree));

just after cannot_modify_jumps_p.  In hooks.c, add a new

	hook_tree_tree_bool_false (a, b)
	     tree a ATTRIBUTE_UNUSED;
	     tree b ATTRIBUTE_UNUSED;
	  return false;

In hooks.h, declare it.  In target-def.h add

	#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_tree_tree_bool_false

just after TARGET_CANNOT_MODIFY_JUMPS_P.  Do not add ifndef wrappers.  

For every target that implements FUNCTION_OK_FOR_SIBCALL, if the
implementation is inline, copy it to a new static function
<cpu>_function_ok_for_sibcall in the cpu.c file.  If the existing
implementation was a function, change it to be static and remove
the declaration in cpu-protos.h.  In either case, add 

	#define TARGET_FUNCTION_OK_FOR_SIBCALL cpu_function_ok_for_sibcall

in some likely looking place before

	struct gcc_target targetm = TARGET_INITIALIZER;

in the cpu.c file.

Now change calls.c to do

	(*targetm.function_ok_for_sibcall) (decl, exp)


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