On Thu, Aug 30, 2012 at 9:55 AM,  <tstel...@gmail.com> wrote:
> From: Tom Stellard <thomas.stell...@amd.com>
>
> ---
>  Hi Matt,
>
>  This patch applies to your automake-gallium branch.

Thanks a bunch!

>  configure.ac                                |    5 ++
>  src/gallium/drivers/radeon/.gitignore       |    1 +
>  src/gallium/drivers/radeon/Makefile         |   76 -----------------------
>  src/gallium/drivers/radeon/Makefile.am      |   87 
> +++++++++++++++++++++++++++
>  src/gallium/drivers/radeon/Makefile.sources |   32 ++++++++++-
>  5 files changed, 124 insertions(+), 77 deletions(-)
>  delete mode 100644 src/gallium/drivers/radeon/Makefile
>  create mode 100644 src/gallium/drivers/radeon/Makefile.am
>
> diff --git a/configure.ac b/configure.ac
> index c984b9c..46b53fd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1876,6 +1876,9 @@ if test "x$with_gallium_drivers" != x; then
>              if test "x$enable_opencl" = xyes -a "x$with_llvm_shared_libs" = 
> xno; then
>                  LLVM_LIBS="${LLVM_LIBS} `$LLVM_CONFIG --libs bitreader 
> asmparser`"
>              fi
> +            if grep '\<IntrinsicsR600.td\>' 
> $(LLVM_INCLUDEDIR)/llvm/Intrinsics.td; then
> +                HAVE_R600_LLVM_INTRINSICS=yes;
> +            fi
>              gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" 
> "xvmc-r600" "vdpau-r600" "va-r600"
>              ;;
>          xradeonsi)
> @@ -1975,6 +1978,7 @@ AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test 
> x$HAVE_IDENTITY_GALLIUM = xyes)
>  AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
>  AM_CONDITIONAL(NEED_RADEON_GALLIUM, test x$NEED_RADEON_GALLIUM = xyes)
>  AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
> +AM_CONDITIONAL(HAVE_R600_LLVM_INTRINSICS, test x%HAVE_R600_LLVM_INTRINSICS = 
> xyes)

Typo here, % instead of $. No problem, fixed locally.

>  AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
>  AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = 
> xyes)
>  AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
> @@ -2027,6 +2031,7 @@ AC_CONFIG_FILES([configs/current
>                 src/gallium/drivers/nvc0/Makefile
>                 src/gallium/drivers/r300/Makefile
>                 src/gallium/drivers/r600/Makefile
> +               src/gallium/drivers/radeon/Makefile
>                 src/gallium/drivers/radeonsi/Makefile
>                 src/gallium/drivers/rbug/Makefile
>                 src/gallium/drivers/softpipe/Makefile
> diff --git a/src/gallium/drivers/radeon/.gitignore 
> b/src/gallium/drivers/radeon/.gitignore
> index b723d73..1f25df3 100644
> --- a/src/gallium/drivers/radeon/.gitignore
> +++ b/src/gallium/drivers/radeon/.gitignore
> @@ -10,6 +10,7 @@ AMDILGenInstrInfo.inc
>  AMDILGenIntrinsics.inc
>  AMDILGenRegisterInfo.inc
>  AMDILGenSubtargetInfo.inc
> +Makefile
>  R600HwRegInfo.include
>  R600Intrinsics.td
>  R600RegisterInfo.td
> diff --git a/src/gallium/drivers/radeon/Makefile 
> b/src/gallium/drivers/radeon/Makefile
> deleted file mode 100644
> index 43f668a..0000000
> --- a/src/gallium/drivers/radeon/Makefile
> +++ /dev/null
> @@ -1,76 +0,0 @@
> -
> -TOP = ../../../..
> -include $(TOP)/configs/current
> -
> -include Makefile.sources
> -
> -LIBNAME = radeon
> -
> -LIBRARY_INCLUDES = -I$(TOP)/include
> -
> -TBLGEN = $(LLVM_BINDIR)/llvm-tblgen
> -
> -CXXFLAGS+= $(LLVM_CXXFLAGS)
> -
> -include ../../Makefile.template
> -
> -CXXFLAGS := $(filter-out -DDEBUG, $(CXXFLAGS))
> -
> -tablegen = $(TBLGEN) -I $(LLVM_INCLUDEDIR) $1 $2 -o $3
> -
> -HAVE_LLVM_INTRINSICS = $(shell grep IntrinsicsR600.td 
> $(LLVM_INCLUDEDIR)/llvm/Intrinsics.td)
> -
> -gen: $(GENERATED_SOURCES)
> -
> -SIRegisterInfo.td: SIGenRegisterInfo.pl
> -       $(PERL) $^ > $@
> -
> -SIRegisterGetHWRegNum.inc: SIGenRegisterInfo.pl
> -       $(PERL) $^ $@ > /dev/null
> -
> -R600Intrinsics.td: R600IntrinsicsNoOpenCL.td R600IntrinsicsOpenCL.td
> -ifeq ($(HAVE_LLVM_INTRINSICS),)
> -       cp R600IntrinsicsNoOpenCL.td R600Intrinsics.td
> -else
> -       cp R600IntrinsicsOpenCL.td R600Intrinsics.td
> -endif
> -
> -R600RegisterInfo.td: R600GenRegisterInfo.pl
> -       $(PERL) $^ > $@
> -
> -AMDGPUGenRegisterInfo.inc: *.td
> -       $(call tablegen, -gen-register-info, AMDGPU.td, $@)
> -
> -AMDGPUGenInstrInfo.inc: *.td
> -       $(call tablegen, -gen-instr-info, AMDGPU.td, $@)
> -
> -AMDGPUGenAsmWriter.inc: *.td
> -       $(call tablegen, -gen-asm-writer, AMDGPU.td, $@)
> -
> -AMDGPUGenDAGISel.inc: *.td
> -       $(call tablegen, -gen-dag-isel, AMDGPU.td, $@)
> -
> -AMDGPUGenCallingConv.inc: *.td
> -       $(call tablegen, -gen-callingconv, AMDGPU.td, $@)
> -
> -AMDGPUGenSubtargetInfo.inc: *.td
> -       $(call tablegen, -gen-subtarget, AMDGPU.td, $@)
> -
> -AMDGPUGenEDInfo.inc: *.td
> -       $(call tablegen, -gen-enhanced-disassembly-info, AMDGPU.td, $@)
> -
> -AMDGPUGenIntrinsics.inc: *.td
> -       $(call tablegen, -gen-tgt-intrinsic, AMDGPU.td, $@)
> -
> -AMDGPUGenCodeEmitter.inc: *.td
> -       $(call tablegen, -gen-emitter, AMDGPU.td, $@)
> -
> -AMDGPUGenMCCodeEmitter.inc: *.td
> -       $(call tablegen, -mc-emitter -gen-emitter, AMDGPU.td, $@)
> -
> -AMDGPUGenDFAPacketizer.inc: *.td
> -       $(call tablegen, -gen-dfa-packetizer, AMDGPU.td, $@)
> -
> -LOADER_LIBS=$(shell llvm-config --libs bitreader asmparser)
> -loader: loader.o libradeon.a
> -       gcc -o loader $(LLVM_LDFLAGS) -L/usr/local/lib $(LDFLAGS) loader.o 
> libradeon.a $(LLVM_LIBS) $(LOADER_LIBS) -lpthread -ldl -lstdc++ -lm
> diff --git a/src/gallium/drivers/radeon/Makefile.am 
> b/src/gallium/drivers/radeon/Makefile.am
> new file mode 100644
> index 0000000..881af53
> --- /dev/null
> +++ b/src/gallium/drivers/radeon/Makefile.am
> @@ -0,0 +1,87 @@
> +include Makefile.sources
> +include $(top_srcdir)/src/gallium/Automake.inc
> +
> +noinst_LTLIBRARIES = libradeon.la
> +
> +AM_CXXFLAGS = \
> +       $(filter-out -DDEBUG, $(LLVM_CXXFLAGS))
> +
> +AM_CFLAGS = \
> +       $(GALLIUM_CFLAGS) \
> +       $(LLVM_CFLAGS)
> +
> +CXXFLAGS+= $(LLVM_CXXFLAGS)

Do we really need this? We already have LLVM_CXXFLAGS in AM_CXXFLAGS.

> +
> +tablegen = $(LLVM_BINDIR)/llvm-tblgen -I $(LLVM_INCLUDEDIR) $1 $2 -o $3
> +
> +libradeon_la_SOURCES = \
> +       $(GENERATED_SOURCES) \
> +       $(CXX_SOURCES) \
> +       $(C_SOURCES)
> +
> +CLEANFILES = $(GENERATED_SOURCES)

We should probably set BUILT_SOURCES here.

> +
> +SIRegisterInfo.td: SIGenRegisterInfo.pl
> +       $(PERL) $^ > $@
> +
> +SIRegisterGetHWRegNum.inc: SIGenRegisterInfo.pl
> +       $(PERL) $^ $@ > /dev/null
> +
> +R600Intrinsics.td: R600IntrinsicsNoOpenCL.td R600IntrinsicsOpenCL.td
> +if HAVE_R600_LLVM_INTRINSICS
> +       cp R600IntrinsicsNoOpenCL.td R600Intrinsics.td
> +else
> +       cp R600IntrinsicsOpenCL.td R600Intrinsics.td
> +endif
> +
> +R600RegisterInfo.td: R600GenRegisterInfo.pl
> +       $(PERL) $^ > $@

It's nice to put $(AM_V_GEN) before generator calls.

> +
> +AMDGPUGenRegisterInfo.inc: $(TD_FILES)
> +       $(call tablegen, -gen-register-info, AMDGPU.td, $@)
> +
> +AMDGPUGenInstrInfo.inc: $(TD_FILES)
> +       $(call tablegen, -gen-instr-info, AMDGPU.td, $@)
> +
> +AMDGPUGenAsmWriter.inc: $(TD_FILES)
> +       $(call tablegen, -gen-asm-writer, AMDGPU.td, $@)
> +
> +AMDGPUGenDAGISel.inc: $(TD_FILES)
> +       $(call tablegen, -gen-dag-isel, AMDGPU.td, $@)
> +
> +AMDGPUGenCallingConv.inc: $(TD_FILES)
> +       $(call tablegen, -gen-callingconv, AMDGPU.td, $@)
> +
> +AMDGPUGenSubtargetInfo.inc: $(TD_FILES)
> +       $(call tablegen, -gen-subtarget, AMDGPU.td, $@)
> +
> +AMDGPUGenEDInfo.inc: $(TD_FILES)
> +       $(call tablegen, -gen-enhanced-disassembly-info, AMDGPU.td, $@)
> +
> +AMDGPUGenIntrinsics.inc: $(TD_FILES)
> +       $(call tablegen, -gen-tgt-intrinsic, AMDGPU.td, $@)
> +
> +AMDGPUGenCodeEmitter.inc: $(TD_FILES)
> +       $(call tablegen, -gen-emitter, AMDGPU.td, $@)
> +
> +AMDGPUGenMCCodeEmitter.inc: $(TD_FILES)
> +       $(call tablegen, -mc-emitter -gen-emitter, AMDGPU.td, $@)
> +
> +AMDGPUGenDFAPacketizer.inc: $(TD_FILES)
> +       $(call tablegen, -gen-dfa-packetizer, AMDGPU.td, $@)
> +
> +noinst_PROGRAMS = loader
> +
> +loader_SOURCES = loader.cpp
> +
> +loader_LDADD = libradeon.la $(LLVM_LIBS)
> +loader_LDFLAGS = \
> +       $(LLVM_LDFLAGS) \
> +       $(LD_FLAGS)
> +
> +#XXX: Delete this when all targets that rely on radeon are converted to
> +# automake.
> +all-local: libradeon.la
> +       ln -f $(builddir)/.libs/libradeon.a $(builddir)/libradeon.a
> +
> +CLEANFILES += libradeon.a
> diff --git a/src/gallium/drivers/radeon/Makefile.sources 
> b/src/gallium/drivers/radeon/Makefile.sources
> index 687acb3..d8df295 100644
> --- a/src/gallium/drivers/radeon/Makefile.sources
> +++ b/src/gallium/drivers/radeon/Makefile.sources
> @@ -1,4 +1,34 @@
>
> +TD_FILES := \
> +       AMDGPU.td               \
> +       AMDGPUInstrInfo.td      \
> +       AMDGPUInstructions.td   \
> +       AMDGPUIntrinsics.td     \
> +       AMDGPURegisterInfo.td   \
> +       AMDILBase.td            \
> +       AMDILInstrInfo.td       \
> +       AMDILIntrinsics.td      \
> +       AMDILRegisterInfo.td    \
> +       Processors.td           \
> +       R600InstrInfo.td        \
> +       R600Instructions.td     \
> +       R600Intrinsics.td       \
> +       R600Intrinsics.td       \
> +       R600IntrinsicsNoOpenCL.td       \
> +       R600IntrinsicsOpenCL.td \
> +       R600OpenCLIntrinsics.td \
> +       R600RegisterInfo.td     \
> +       R600RegisterInfo.td     \
> +       R600Schedule.td         \
> +       SIInstrFormats.td       \
> +       SIInstrInfo.td          \
> +       SIInstructions.td       \
> +       SIIntrinsics.td         \
> +       SIRegisterInfo.td       \
> +       SIRegisterInfo.td       \
> +       SISchedule.td
> +
> +
>  GENERATED_SOURCES := \
>         R600Intrinsics.td               \
>         R600RegisterInfo.td             \
> @@ -16,7 +46,7 @@ GENERATED_SOURCES := \
>         AMDGPUGenMCCodeEmitter.inc      \
>         AMDGPUGenDFAPacketizer.inc
>
> -CPP_SOURCES := \
> +CXX_SOURCES := \
>         AMDIL7XXDevice.cpp              \
>         AMDILCFGStructurizer.cpp        \
>         AMDILDevice.cpp                 \
> --
> 1.7.7.6

When I build with this, I get:

  CXX      AMDIL7XXDevice.lo
In file included from AMDIL7XXDevice.cpp:10:0:
AMDGPUSubtarget.h:22:38: fatal error: AMDGPUGenSubtargetInfo.inc: No
such file or directory
compilation terminated.
make: *** [AMDIL7XXDevice.lo] Error 1

and seeing AMDGPUGenSubtargetInfo.inc in GENERATED_SOURCES, if I try to make it:

make: *** No rule to make target `R600InstrInfo.td', needed by
`AMDGPUGenSubtargetInfo.inc'.  Stop.

After removing R600InstrInfo.td, R600IntrinsicsOpenCL.td, and
R600OpenCLIntrinsics.td from TD_FILES in Makefile.sources,
AMDIL7XXDevice.lo still fails to build, but I can now build
AMDGPUGenSubtargetInfo.inc.

So, we either need to do more finely grained dependencies on *.inc
files, or put BUILT_SOURCES = $(GENERATED_SOURCES) to make sure
everything is generated before we start compiling. The first would
allow slightly better parallelism in the build, but the second is much
easier.

Thanks,
Matt
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to