On Sun, Jan 21, 2007 at 11:09:56PM +0100, Rask Ingemann Lambertsen wrote:
>    I would like to be able to add something like
> 
> LIBGCC2_EXTRA_FUNCS = _ashldi3:2 _ashrdi3:2 _lshrdi3:2 _divdi3:2 _moddi3:2
> 
> to t-machine instead of
> 
> LIB2FUNCS_EXTRA = ashlsi3.c ashrsi3.c lshrsi3.c ...
> 
> ashlsi3.c: $(srcdir)/libgcc2.c $(srcdir)/libgcc2.h
>        ./xgcc -B./ -E -Dinhibit_libc -DLIBGCC2_UNITS_PER_WORD=2 -DL_ashldi3 \
>          -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I . -I $(srcdir) \
>          -I $(srcdir)/../include $(srcdir)/libgcc2.c -o ashlsi3.c
> 
> and so on, to provide the functions _ashlsi3, _ashrsi3, _lshrsi3, _divsi3
> and _modsi3 in addition to the default DImode ones.

Well, it would be much simpler than that.  You could reuse the existing
code.

intfuncs = _ashlXX3 _ashrXX3 _lshrXX3 _divXX3 _modXX3
siintfuncs = $(subst XX,si,$(intfuncs))
diintfuncs = $(subst XX,d i,$(intfuncs))

iter-items := $(siintfuncs)
iter-labels := $(diintfuncs)
iter-sizes := $(patsubst %,2,$(siintfuncs))

include $(srcdir)/empty.mk $(patsubst 
%,$(srcdir)/siditi-object.mk,$(iter-items))

libgcc-objects += $(patsubst %,%$(objext),$(siintfuncs))
ifeq ($(enable_shared),yes)
libgcc-s-objects += $(patsubst %,%_s$(objext),$(siintfuncs))
endif

If you think it would be useful for enough targets, you could add some
code to automatically extract the bits before and after the colon and
give this a standard name that tdep files could set.  That should get
you started.

-- 
Daniel Jacobowitz
CodeSourcery

Reply via email to