gn build: Simplify Target build files

Now that the cycle between MCTargetDesc and TargetInfo is gone
(see revisions 360709 360718 360722 360724 360726 360731 360733 360735 360736),
remove the dependency from TargetInfo on MCTargetDesc:tablegen. In most
targets, this makes MCTargetDesc:tablegen have just a single use, so
inline it there.

For AArch64, ARM, and RISCV there's still a similar cycle between
MCTargetDesc and Utils, so the MCTargetDesc:tablegen indirection is
still needed there.

Differential Revision: https://reviews.llvm.org/D63200

llvm-svn: 363436
This commit is contained in:
Nico Weber 2019-06-14 17:58:34 +00:00
parent 5254f0a9ab
commit 3819e68b9c
21 changed files with 73 additions and 159 deletions

View File

@ -45,7 +45,6 @@ tablegen("AArch64GenSubtargetInfo") {
group("tablegen") { group("tablegen") {
visibility = [ visibility = [
":MCTargetDesc", ":MCTargetDesc",
"../TargetInfo",
"../Utils", "../Utils",
] ]
public_deps = [ public_deps = [

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMAArch64Info" output_name = "LLVMAArch64Info"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/AArch64/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -13,6 +13,9 @@ static_library("Utils") {
] ]
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on Utils, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/AArch64/MCTargetDesc:tablegen", "//llvm/lib/Target/AArch64/MCTargetDesc:tablegen",
] ]

View File

@ -36,7 +36,6 @@ tablegen("ARMGenSubtargetInfo") {
group("tablegen") { group("tablegen") {
visibility = [ visibility = [
":MCTargetDesc", ":MCTargetDesc",
"../TargetInfo",
"../Utils", "../Utils",
] ]
public_deps = [ public_deps = [
@ -45,6 +44,7 @@ group("tablegen") {
":ARMGenSubtargetInfo", ":ARMGenSubtargetInfo",
] ]
} }
static_library("MCTargetDesc") { static_library("MCTargetDesc") {
output_name = "LLVMARMDesc" output_name = "LLVMARMDesc"
public_deps = [ public_deps = [

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMARMInfo" output_name = "LLVMARMInfo"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/ARM/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -13,6 +13,9 @@ static_library("Utils") {
] ]
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on Utils, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/ARM/MCTargetDesc:tablegen", "//llvm/lib/Target/ARM/MCTargetDesc:tablegen",
] ]

View File

@ -7,7 +7,7 @@ tablegen("BPFGenAsmWriter") {
} }
tablegen("BPFGenInstrInfo") { tablegen("BPFGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../BPF.td" td_file = "../BPF.td"
} }
@ -19,37 +19,28 @@ tablegen("BPFGenMCCodeEmitter") {
} }
tablegen("BPFGenRegisterInfo") { tablegen("BPFGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../BPF.td" td_file = "../BPF.td"
} }
tablegen("BPFGenSubtargetInfo") { tablegen("BPFGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../BPF.td" td_file = "../BPF.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMBPFDesc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../TargetInfo",
]
public_deps = [ public_deps = [
":BPFGenInstrInfo", ":BPFGenInstrInfo",
":BPFGenRegisterInfo", ":BPFGenRegisterInfo",
":BPFGenSubtargetInfo", ":BPFGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMBPFDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":BPFGenAsmWriter", ":BPFGenAsmWriter",
":BPFGenMCCodeEmitter", ":BPFGenMCCodeEmitter",

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMBPFInfo" output_name = "LLVMBPFInfo"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/BPF/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -7,7 +7,7 @@ tablegen("HexagonGenAsmWriter") {
} }
tablegen("HexagonGenInstrInfo") { tablegen("HexagonGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../Hexagon.td" td_file = "../Hexagon.td"
} }
@ -19,34 +19,28 @@ tablegen("HexagonGenMCCodeEmitter") {
} }
tablegen("HexagonGenRegisterInfo") { tablegen("HexagonGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../Hexagon.td" td_file = "../Hexagon.td"
} }
tablegen("HexagonGenSubtargetInfo") { tablegen("HexagonGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../Hexagon.td" td_file = "../Hexagon.td"
} }
group("tablegen") { static_library("MCTargetDesc") {
visibility = [ output_name = "LLVMHexagonDesc"
":MCTargetDesc",
"../TargetInfo", # This should contain tablegen targets generating .inc files included
] # by other targets. .inc files only used by .cpp files in this directory
# should be in deps instead.
public_deps = [ public_deps = [
":HexagonGenInstrInfo", ":HexagonGenInstrInfo",
":HexagonGenRegisterInfo", ":HexagonGenRegisterInfo",
":HexagonGenSubtargetInfo", ":HexagonGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMHexagonDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":HexagonGenAsmWriter", ":HexagonGenAsmWriter",
":HexagonGenMCCodeEmitter", ":HexagonGenMCCodeEmitter",

View File

@ -1,12 +1,7 @@
static_library("TargetInfo") { static_library("TargetInfo") {
output_name = "LLVMHexagonInfo" output_name = "LLVMHexagonInfo"
deps = [ deps = [
"//llvm/lib/IR",
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/Hexagon/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -7,7 +7,7 @@ tablegen("LanaiGenAsmWriter") {
} }
tablegen("LanaiGenInstrInfo") { tablegen("LanaiGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../Lanai.td" td_file = "../Lanai.td"
} }
@ -19,37 +19,28 @@ tablegen("LanaiGenMCCodeEmitter") {
} }
tablegen("LanaiGenRegisterInfo") { tablegen("LanaiGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../Lanai.td" td_file = "../Lanai.td"
} }
tablegen("LanaiGenSubtargetInfo") { tablegen("LanaiGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../Lanai.td" td_file = "../Lanai.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMLanaiDesc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../TargetInfo",
]
public_deps = [ public_deps = [
":LanaiGenInstrInfo", ":LanaiGenInstrInfo",
":LanaiGenRegisterInfo", ":LanaiGenRegisterInfo",
":LanaiGenSubtargetInfo", ":LanaiGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMLanaiDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":LanaiGenAsmWriter", ":LanaiGenAsmWriter",
":LanaiGenMCCodeEmitter", ":LanaiGenMCCodeEmitter",

View File

@ -1,7 +1,6 @@
static_library("TargetInfo") { static_library("TargetInfo") {
output_name = "LLVMLanaiInfo" output_name = "LLVMLanaiInfo"
deps = [ deps = [
"//llvm/lib/IR",
"//llvm/lib/Support", "//llvm/lib/Support",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]

View File

@ -7,7 +7,7 @@ tablegen("PPCGenAsmWriter") {
} }
tablegen("PPCGenInstrInfo") { tablegen("PPCGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../PPC.td" td_file = "../PPC.td"
} }
@ -19,38 +19,28 @@ tablegen("PPCGenMCCodeEmitter") {
} }
tablegen("PPCGenRegisterInfo") { tablegen("PPCGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../PPC.td" td_file = "../PPC.td"
} }
tablegen("PPCGenSubtargetInfo") { tablegen("PPCGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../PPC.td" td_file = "../PPC.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMPowerPCDesc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../InstPrinter",
"../TargetInfo",
]
public_deps = [ public_deps = [
":PPCGenInstrInfo", ":PPCGenInstrInfo",
":PPCGenRegisterInfo", ":PPCGenRegisterInfo",
":PPCGenSubtargetInfo", ":PPCGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMPowerPCDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":PPCGenAsmWriter", ":PPCGenAsmWriter",
":PPCGenMCCodeEmitter", ":PPCGenMCCodeEmitter",

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMPowerPCInfo" output_name = "LLVMPowerPCInfo"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -14,6 +14,9 @@ static_library("Utils") {
deps = [ deps = [
"//llvm/lib/MC", "//llvm/lib/MC",
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on Utils, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/RISCV/MCTargetDesc:tablegen", "//llvm/lib/Target/RISCV/MCTargetDesc:tablegen",
] ]

View File

@ -7,7 +7,7 @@ tablegen("SparcGenAsmWriter") {
} }
tablegen("SparcGenInstrInfo") { tablegen("SparcGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../Sparc.td" td_file = "../Sparc.td"
} }
@ -19,37 +19,28 @@ tablegen("SparcGenMCCodeEmitter") {
} }
tablegen("SparcGenRegisterInfo") { tablegen("SparcGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../Sparc.td" td_file = "../Sparc.td"
} }
tablegen("SparcGenSubtargetInfo") { tablegen("SparcGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../Sparc.td" td_file = "../Sparc.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMSparcDesc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../TargetInfo",
]
public_deps = [ public_deps = [
":SparcGenInstrInfo", ":SparcGenInstrInfo",
":SparcGenRegisterInfo", ":SparcGenRegisterInfo",
":SparcGenSubtargetInfo", ":SparcGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMSparcDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":SparcGenAsmWriter", ":SparcGenAsmWriter",
":SparcGenMCCodeEmitter", ":SparcGenMCCodeEmitter",

View File

@ -1,9 +1,7 @@
static_library("TargetInfo") { static_library("TargetInfo") {
output_name = "LLVMSparcInfo" output_name = "LLVMSparcInfo"
deps = [ deps = [
"//llvm/lib/IR",
"//llvm/lib/Support", "//llvm/lib/Support",
"//llvm/lib/Target/Sparc/MCTargetDesc",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -7,7 +7,7 @@ tablegen("WebAssemblyGenAsmWriter") {
} }
tablegen("WebAssemblyGenInstrInfo") { tablegen("WebAssemblyGenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../WebAssembly.td" td_file = "../WebAssembly.td"
} }
@ -19,38 +19,28 @@ tablegen("WebAssemblyGenMCCodeEmitter") {
} }
tablegen("WebAssemblyGenRegisterInfo") { tablegen("WebAssemblyGenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../WebAssembly.td" td_file = "../WebAssembly.td"
} }
tablegen("WebAssemblyGenSubtargetInfo") { tablegen("WebAssemblyGenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../WebAssembly.td" td_file = "../WebAssembly.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMWebAssemblyDesc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../InstPrinter",
"../TargetInfo",
"../Utils",
]
public_deps = [ public_deps = [
":WebAssemblyGenInstrInfo", ":WebAssemblyGenInstrInfo",
":WebAssemblyGenRegisterInfo", ":WebAssemblyGenRegisterInfo",
":WebAssemblyGenSubtargetInfo", ":WebAssemblyGenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMWebAssemblyDesc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":WebAssemblyGenAsmWriter", ":WebAssemblyGenAsmWriter",
":WebAssemblyGenMCCodeEmitter", ":WebAssemblyGenMCCodeEmitter",

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMWebAssemblyInfo" output_name = "LLVMWebAssemblyInfo"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/WebAssembly/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [

View File

@ -16,43 +16,34 @@ tablegen("X86GenAsmWriter1") {
} }
tablegen("X86GenInstrInfo") { tablegen("X86GenInstrInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-instr-info" ] args = [ "-gen-instr-info" ]
td_file = "../X86.td" td_file = "../X86.td"
} }
tablegen("X86GenRegisterInfo") { tablegen("X86GenRegisterInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-register-info" ] args = [ "-gen-register-info" ]
td_file = "../X86.td" td_file = "../X86.td"
} }
tablegen("X86GenSubtargetInfo") { tablegen("X86GenSubtargetInfo") {
visibility = [ ":tablegen" ] visibility = [ ":MCTargetDesc" ]
args = [ "-gen-subtarget" ] args = [ "-gen-subtarget" ]
td_file = "../X86.td" td_file = "../X86.td"
} }
# This should contain tablegen targets generating .inc files included static_library("MCTargetDesc") {
# by other targets. .inc files only used by .cpp files in this directory output_name = "LLVMX86Desc"
# should be in deps on the static_library instead.
group("tablegen") { # This should contain tablegen targets generating .inc files included
visibility = [ # by other targets. .inc files only used by .cpp files in this directory
":MCTargetDesc", # should be in deps instead.
"../TargetInfo",
]
public_deps = [ public_deps = [
":X86GenInstrInfo", ":X86GenInstrInfo",
":X86GenRegisterInfo", ":X86GenRegisterInfo",
":X86GenSubtargetInfo", ":X86GenSubtargetInfo",
] ]
}
static_library("MCTargetDesc") {
output_name = "LLVMX86Desc"
public_deps = [
":tablegen",
]
deps = [ deps = [
":X86GenAsmWriter", ":X86GenAsmWriter",
":X86GenAsmWriter1", ":X86GenAsmWriter1",

View File

@ -2,10 +2,6 @@ static_library("TargetInfo") {
output_name = "LLVMX86Info" output_name = "LLVMX86Info"
deps = [ deps = [
"//llvm/lib/Support", "//llvm/lib/Support",
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
# MCTargetDesc target here: it would form a cycle.
"//llvm/lib/Target/X86/MCTargetDesc:tablegen",
] ]
include_dirs = [ ".." ] include_dirs = [ ".." ]
sources = [ sources = [