mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 08:46:37 +00:00
Clean up a pile of hacks in our CMake build relating to TableGen.
The first problem to fix is to stop creating synthetic *Table_gen targets next to all of the LLVM libraries. These had no real effect as CMake specifies that add_custom_command(OUTPUT ...) directives (what the 'tablegen(...)' stuff expands to) are implicitly added as dependencies to all the rules in that CMakeLists.txt. These synthetic rules started to cause problems as we started more and more heavily using tablegen files from *subdirectories* of the one where they were generated. Within those directories, the set of tablegen outputs was still available and so these synthetic rules added them as dependencies of those subdirectories. However, they were no longer properly associated with the custom command to generate them. Most of the time this "just worked" because something would get to the parent directory first, and run tablegen there. Once run, the files existed and the build proceeded happily. However, as more and more subdirectories have started using this, the probability of this failing to happen has increased. Recently with the MC refactorings, it became quite common for me when touching a large enough number of targets. To add insult to injury, several of the backends *tried* to fix this by adding explicit dependencies back to the parent directory's tablegen rules, but those dependencies didn't work as expected -- they weren't forming a linear chain, they were adding another thread in the race. This patch removes these synthetic rules completely, and adds a much simpler function to declare explicitly that a collection of tablegen'ed files are referenced by other libraries. From that, we can add explicit dependencies from the smaller libraries (such as every architectures Desc library) on this and correctly form a linear sequence. All of the backends are updated to use it, sometimes replacing the existing attempt at adding a dependency, sometimes adding a previously missing dependency edge. Please let me know if this causes any problems, but it fixes a rather persistent and problematic source of build flakiness on our end. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136023 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
185f92e7d0
commit
b35552d440
@ -2,7 +2,6 @@ include(LLVMProcessSources)
|
||||
include(LLVM-Config)
|
||||
|
||||
macro(add_llvm_library name)
|
||||
create_tablegenning_custom_target( ${name} )
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
add_library( ${name} ${ALL_FILES} )
|
||||
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
|
||||
@ -33,7 +32,6 @@ macro(add_llvm_library name)
|
||||
add_dependencies(${name} ${CURRENT_LLVM_TARGET})
|
||||
endif()
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
|
||||
add_tablegenning_dependency( ${name} )
|
||||
endmacro(add_llvm_library name)
|
||||
|
||||
|
||||
@ -77,7 +75,6 @@ endmacro(add_llvm_loadable_module name)
|
||||
|
||||
|
||||
macro(add_llvm_executable name)
|
||||
create_tablegenning_custom_target( ${name} )
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
if( EXCLUDE_FROM_ALL )
|
||||
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
|
||||
@ -91,7 +88,6 @@ macro(add_llvm_executable name)
|
||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||
endif( LLVM_COMMON_DEPENDS )
|
||||
link_system_libs( ${name} )
|
||||
add_tablegenning_dependency( ${name} )
|
||||
endmacro(add_llvm_executable name)
|
||||
|
||||
|
||||
|
@ -45,23 +45,11 @@ macro(tablegen ofn)
|
||||
PROPERTIES GENERATED 1)
|
||||
endmacro(tablegen)
|
||||
|
||||
|
||||
function(create_tablegenning_custom_target target)
|
||||
# Creates the global target that runs the file-level dependencies
|
||||
# for tablegenning.
|
||||
function(add_public_tablegen_target target)
|
||||
# Creates a target for publicly exporting tablegen dependencies.
|
||||
if( TABLEGEN_OUTPUT )
|
||||
add_custom_target(${target}Table_gen
|
||||
add_custom_target(${target}
|
||||
DEPENDS ${TABLEGEN_OUTPUT})
|
||||
add_dependencies(${target}Table_gen ${LLVM_COMMON_DEPENDS})
|
||||
add_dependencies(${target} ${LLVM_COMMON_DEPENDS})
|
||||
endif( TABLEGEN_OUTPUT )
|
||||
endfunction()
|
||||
|
||||
function(add_tablegenning_dependency target)
|
||||
# Makes the tablegenning step created with
|
||||
# create_tablegenning_custom_target dependent on `target'.
|
||||
if ( TABLEGEN_OUTPUT )
|
||||
add_dependencies(${target} ${target}Table_gen)
|
||||
set_target_properties(${target}Table_gen PROPERTIES FOLDER "Tablegenning")
|
||||
endif (TABLEGEN_OUTPUT)
|
||||
endfunction()
|
||||
|
||||
|
@ -4,4 +4,4 @@ add_llvm_library(LLVMARMAsmParser
|
||||
ARMAsmLexer.cpp
|
||||
ARMAsmParser.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMARMAsmParser ARMCommonTableGen)
|
||||
|
@ -13,6 +13,7 @@ tablegen(ARMGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(ARMGenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(ARMGenEDInfo.inc -gen-enhanced-disassembly-info)
|
||||
tablegen(ARMGenDecoderTables.inc -gen-arm-decoder)
|
||||
add_public_tablegen_target(ARMCommonTableGen)
|
||||
|
||||
add_llvm_target(ARMCodeGen
|
||||
ARMAsmPrinter.cpp
|
||||
|
@ -11,4 +11,4 @@ set_property(
|
||||
PROPERTY COMPILE_FLAGS "/Od"
|
||||
)
|
||||
endif()
|
||||
add_dependencies(LLVMARMDisassembler ARMCodeGenTable_gen)
|
||||
add_dependencies(LLVMARMDisassembler ARMCommonTableGen)
|
||||
|
@ -3,4 +3,4 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
add_llvm_library(LLVMARMAsmPrinter
|
||||
ARMInstPrinter.cpp
|
||||
)
|
||||
add_dependencies(LLVMARMAsmPrinter ARMCodeGenTable_gen)
|
||||
add_dependencies(LLVMARMAsmPrinter ARMCommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ add_llvm_library(LLVMARMDesc
|
||||
ARMMCExpr.cpp
|
||||
ARMMachObjectWriter.cpp
|
||||
)
|
||||
add_dependencies(LLVMARMDesc ARMCommonTableGen)
|
||||
|
||||
# Hack: we need to include 'main' target directory to grab private headers
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
@ -6,6 +6,7 @@ tablegen(AlphaGenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(AlphaGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(AlphaGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(AlphaGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(AlphaCommonTableGen)
|
||||
|
||||
add_llvm_target(AlphaCodeGen
|
||||
AlphaAsmPrinter.cpp
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMAlphaDesc
|
||||
AlphaMCTargetDesc.cpp
|
||||
AlphaMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMAlphaDesc AlphaCommonTableGen)
|
||||
|
@ -3,5 +3,4 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
add_llvm_library(LLVMAlphaInfo
|
||||
AlphaTargetInfo.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMAlphaInfo AlphaCodeGenTable_gen)
|
||||
add_dependencies(LLVMAlphaInfo AlphaCommonTableGen)
|
||||
|
@ -7,6 +7,7 @@ tablegen(BlackfinGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(BlackfinGenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(BlackfinGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(BlackfinGenIntrinsics.inc -gen-tgt-intrinsic)
|
||||
add_public_tablegen_target(BlackfinCommonTableGen)
|
||||
|
||||
add_llvm_target(BlackfinCodeGen
|
||||
BlackfinAsmPrinter.cpp
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMBlackfinDesc
|
||||
BlackfinMCTargetDesc.cpp
|
||||
BlackfinMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMBlackfinDesc BlackfinCommonTableGen)
|
||||
|
@ -7,6 +7,7 @@ tablegen(SPUGenInstrInfo.inc -gen-instr-info)
|
||||
tablegen(SPUGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(SPUGenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(SPUGenCallingConv.inc -gen-callingconv)
|
||||
add_public_tablegen_target(CellSPUCommonTableGen)
|
||||
|
||||
add_llvm_target(CellSPUCodeGen
|
||||
SPUAsmPrinter.cpp
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMCellSPUDesc
|
||||
SPUMCTargetDesc.cpp
|
||||
SPUMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMCellSPUDesc CellSPUCommonTableGen)
|
||||
|
@ -5,4 +5,5 @@ add_llvm_library(LLVMMBlazeAsmParser
|
||||
MBlazeAsmLexer.cpp
|
||||
MBlazeAsmParser.cpp
|
||||
)
|
||||
add_dependencies(LLVMMBlazeAsmParser MBlazeCommonTableGen)
|
||||
|
||||
|
@ -10,6 +10,7 @@ tablegen(MBlazeGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(MBlazeGenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(MBlazeGenIntrinsics.inc -gen-tgt-intrinsic)
|
||||
tablegen(MBlazeGenEDInfo.inc -gen-enhanced-disassembly-info)
|
||||
add_public_tablegen_target(MBlazeCommonTableGen)
|
||||
|
||||
add_llvm_target(MBlazeCodeGen
|
||||
MBlazeDelaySlotFiller.cpp
|
||||
|
@ -13,4 +13,4 @@ set_property(
|
||||
)
|
||||
endif()
|
||||
|
||||
add_dependencies(LLVMMBlazeDisassembler MBlazeCodeGenTable_gen)
|
||||
add_dependencies(LLVMMBlazeDisassembler MBlazeCommonTableGen)
|
||||
|
@ -5,4 +5,4 @@ add_llvm_library(LLVMMBlazeAsmPrinter
|
||||
MBlazeInstPrinter.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMMBlazeAsmPrinter MBlazeCodeGenTable_gen)
|
||||
add_dependencies(LLVMMBlazeAsmPrinter MBlazeCommonTableGen)
|
||||
|
@ -4,3 +4,4 @@ add_llvm_library(LLVMMBlazeDesc
|
||||
MBlazeMCCodeEmitter.cpp
|
||||
MBlazeMCTargetDesc.cpp
|
||||
)
|
||||
add_dependencies(LLVMMBlazeDesc MBlazeCommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ tablegen(MSP430GenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(MSP430GenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(MSP430GenCallingConv.inc -gen-callingconv)
|
||||
tablegen(MSP430GenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(MSP430CommonTableGen)
|
||||
|
||||
add_llvm_target(MSP430CodeGen
|
||||
MSP430BranchSelector.cpp
|
||||
|
@ -3,4 +3,4 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
add_llvm_library(LLVMMSP430AsmPrinter
|
||||
MSP430InstPrinter.cpp
|
||||
)
|
||||
add_dependencies(LLVMMSP430AsmPrinter MSP430CodeGenTable_gen)
|
||||
add_dependencies(LLVMMSP430AsmPrinter MSP430CommonTableGen)
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMMSP430Desc
|
||||
MSP430MCTargetDesc.cpp
|
||||
MSP430MCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMMSP430Desc MSP430CommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ tablegen(MipsGenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(MipsGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(MipsGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(MipsGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(MipsCommonTableGen)
|
||||
|
||||
add_llvm_target(MipsCodeGen
|
||||
MipsAsmPrinter.cpp
|
||||
|
@ -3,4 +3,4 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
add_llvm_library(LLVMMipsAsmPrinter
|
||||
MipsInstPrinter.cpp
|
||||
)
|
||||
add_dependencies(LLVMMipsAsmPrinter MipsCodeGenTable_gen)
|
||||
add_dependencies(LLVMMipsAsmPrinter MipsCommonTableGen)
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMMipsDesc
|
||||
MipsMCTargetDesc.cpp
|
||||
MipsMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMMipsDesc MipsCommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ tablegen(PTXGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(PTXGenInstrInfo.inc -gen-instr-info)
|
||||
tablegen(PTXGenRegisterInfo.inc -gen-register-info)
|
||||
tablegen(PTXGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(PTXCommonTableGen)
|
||||
|
||||
add_llvm_target(PTXCodeGen
|
||||
PTXAsmPrinter.cpp
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMPTXDesc
|
||||
PTXMCTargetDesc.cpp
|
||||
PTXMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMPTXDesc PTXCommonTableGen)
|
||||
|
@ -8,6 +8,7 @@ tablegen(PPCGenInstrInfo.inc -gen-instr-info)
|
||||
tablegen(PPCGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(PPCGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(PPCGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(PowerPCCommonTableGen)
|
||||
|
||||
add_llvm_target(PowerPCCodeGen
|
||||
PPCAsmPrinter.cpp
|
||||
|
@ -3,4 +3,4 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
add_llvm_library(LLVMPowerPCAsmPrinter
|
||||
PPCInstPrinter.cpp
|
||||
)
|
||||
add_dependencies(LLVMPowerPCAsmPrinter PowerPCCodeGenTable_gen)
|
||||
add_dependencies(LLVMPowerPCAsmPrinter PowerPCCommonTableGen)
|
||||
|
@ -4,3 +4,4 @@ add_llvm_library(LLVMPowerPCDesc
|
||||
PPCMCAsmInfo.cpp
|
||||
PPCMCCodeEmitter.cpp
|
||||
)
|
||||
add_dependencies(LLVMPowerPCDesc PowerPCCommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ tablegen(SparcGenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(SparcGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(SparcGenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(SparcGenCallingConv.inc -gen-callingconv)
|
||||
add_public_tablegen_target(SparcCommonTableGen)
|
||||
|
||||
add_llvm_target(SparcCodeGen
|
||||
DelaySlotFiller.cpp
|
||||
|
@ -2,3 +2,4 @@ add_llvm_library(LLVMSparcDesc
|
||||
SparcMCTargetDesc.cpp
|
||||
SparcMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMSparcDesc SparcCommonTableGen)
|
||||
|
@ -6,6 +6,7 @@ tablegen(SystemZGenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(SystemZGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(SystemZGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(SystemZGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(SystemZCommonTableGen)
|
||||
|
||||
add_llvm_target(SystemZCodeGen
|
||||
SystemZAsmPrinter.cpp
|
||||
|
@ -2,6 +2,7 @@ add_llvm_library(LLVMSystemZDesc
|
||||
SystemZMCTargetDesc.cpp
|
||||
SystemZMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMSystemZDesc SystemZCommonTableGen)
|
||||
|
||||
# Hack: we need to include 'main' target directory to grab private headers
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
@ -4,4 +4,4 @@ add_llvm_library(LLVMX86AsmParser
|
||||
X86AsmLexer.cpp
|
||||
X86AsmParser.cpp
|
||||
)
|
||||
add_dependencies(LLVMX86AsmParser X86CodeGenTable_gen)
|
||||
add_dependencies(LLVMX86AsmParser X86CommonTableGen)
|
||||
|
@ -11,6 +11,7 @@ tablegen(X86GenFastISel.inc -gen-fast-isel)
|
||||
tablegen(X86GenCallingConv.inc -gen-callingconv)
|
||||
tablegen(X86GenSubtargetInfo.inc -gen-subtarget)
|
||||
tablegen(X86GenEDInfo.inc -gen-enhanced-disassembly-info)
|
||||
add_public_tablegen_target(X86CommonTableGen)
|
||||
|
||||
set(sources
|
||||
SSEDomainFix.cpp
|
||||
|
@ -11,4 +11,4 @@ set_property(
|
||||
PROPERTY COMPILE_FLAGS "/Od"
|
||||
)
|
||||
endif()
|
||||
add_dependencies(LLVMX86Disassembler X86CodeGenTable_gen)
|
||||
add_dependencies(LLVMX86Disassembler X86CommonTableGen)
|
||||
|
@ -5,4 +5,4 @@ add_llvm_library(LLVMX86AsmPrinter
|
||||
X86IntelInstPrinter.cpp
|
||||
X86InstComments.cpp
|
||||
)
|
||||
add_dependencies(LLVMX86AsmPrinter X86CodeGenTable_gen)
|
||||
add_dependencies(LLVMX86AsmPrinter X86CommonTableGen)
|
||||
|
@ -5,6 +5,7 @@ add_llvm_library(LLVMX86Desc
|
||||
X86MCCodeEmitter.cpp
|
||||
X86MachObjectWriter.cpp
|
||||
)
|
||||
add_dependencies(LLVMX86Desc X86CommonTableGen)
|
||||
|
||||
# Hack: we need to include 'main' target directory to grab private headers
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
@ -6,6 +6,7 @@ tablegen(XCoreGenAsmWriter.inc -gen-asm-writer)
|
||||
tablegen(XCoreGenDAGISel.inc -gen-dag-isel)
|
||||
tablegen(XCoreGenCallingConv.inc -gen-callingconv)
|
||||
tablegen(XCoreGenSubtargetInfo.inc -gen-subtarget)
|
||||
add_public_tablegen_target(XCoreCommonTableGen)
|
||||
|
||||
add_llvm_target(XCoreCodeGen
|
||||
XCoreAsmPrinter.cpp
|
||||
|
@ -2,6 +2,7 @@ add_llvm_library(LLVMXCoreDesc
|
||||
XCoreMCTargetDesc.cpp
|
||||
XCoreMCAsmInfo.cpp
|
||||
)
|
||||
add_dependencies(LLVMXCoreDesc XCoreCommonTableGen)
|
||||
|
||||
# Hack: we need to include 'main' target directory to grab private headers
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
|
Loading…
Reference in New Issue
Block a user