[Mesa-dev] [PATCH] radeon/llvm: Convert to Automake

Matt Turner mattst88 at gmail.com
Thu Aug 30 14:11:22 PDT 2012


On Thu, Aug 30, 2012 at 1:19 PM, Tom Stellard <tom at stellard.net> wrote:
> On Thu, Aug 30, 2012 at 10:47:55AM -0700, Matt Turner wrote:
>> On Thu, Aug 30, 2012 at 9:55 AM,  <tstellar at gmail.com> wrote:
>> > From: Tom Stellard <thomas.stellard at 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
>> >
>> > +       $(LLVM_CFLAGS)
>> > +
>> > +CXXFLAGS+= $(LLVM_CXXFLAGS)
>>
>> Do we really need this? We already have LLVM_CXXFLAGS in AM_CXXFLAGS.
>>
>
> Probably not.
>> > +
>> > +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.
>>
>
> OK
>
>> > +
>> > +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.
>>
>
> You mean like:
>
> $(AM_V_GEN) $(PERL) $^ > $@

Yeah, exactly.

>> > +
>> > +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.
>>
>
> Let's do BUILT_SOURCES = $(GENERATED_SOURCES) for now.  Do you want me
> to send you a new patch, or have you already made these changes locally?

Works for me. Even with the changes I made, I couldn't get loader to
link, so you might want to look at that. If the fix is simple, just
tell me what it is and I'll fix these things locally.


More information about the mesa-dev mailing list