Skip to content

Commit e7c8acb

Browse files
committedJan 8, 2019
[gn build] Add build files for llvm/lib/Target/PowerPC + tests
The PowerPC target itself is similar to the X86 target in https://reviews.llvm.org/rL348903 The llvm-exegesis unittests bits are similar to the corresponding AArch64 in https://reviews.llvm.org/rL350499 The whole patch is very similar to the WebAssembly target being added in https://reviews.llvm.org/rL350628 Also add a dep from tools/llvm-exegesis/lib to the AArch64 subdir, which I failed to do in r350499. The motivation for this target is solely that it has a unit test and I want to enable the GN<->CMake unittest syncing check for llvm. Differential Revision: https://reviews.llvm.org/D56416 llvm-svn: 350629
1 parent 8caf424 commit e7c8acb

File tree

12 files changed

+307
-5
lines changed

12 files changed

+307
-5
lines changed
 

‎llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static_library("LLVMARMCodeGen") {
103103
}
104104

105105
# This is a bit different from most build files: Due to this group
106-
# having the directory's name, "//llvm/lib/Target/AArch64" will refer to this
106+
# having the directory's name, "//llvm/lib/Target/ARM" will refer to this
107107
# target, which pulls in the code in this directory *and all subdirectories*.
108108
# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
109109
# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenAsmMatcher") {
4+
visibility = [ ":AsmParser" ]
5+
args = [ "-gen-asm-matcher" ]
6+
td_file = "../PPC.td"
7+
}
8+
9+
static_library("AsmParser") {
10+
output_name = "LLVMPowerPCAsmParser"
11+
deps = [
12+
":PPCGenAsmMatcher",
13+
"//llvm/lib/MC",
14+
"//llvm/lib/MC/MCParser",
15+
"//llvm/lib/Support",
16+
"//llvm/lib/Target/PowerPC/MCTargetDesc",
17+
"//llvm/lib/Target/PowerPC/TargetInfo",
18+
]
19+
include_dirs = [ ".." ]
20+
sources = [
21+
"PPCAsmParser.cpp",
22+
]
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenCallingConv") {
4+
visibility = [ ":LLVMPowerPCCodeGen" ]
5+
args = [ "-gen-callingconv" ]
6+
td_file = "PPC.td"
7+
}
8+
9+
tablegen("PPCGenDAGISel") {
10+
visibility = [ ":LLVMPowerPCCodeGen" ]
11+
args = [ "-gen-dag-isel" ]
12+
td_file = "PPC.td"
13+
}
14+
15+
tablegen("PPCGenFastISel") {
16+
visibility = [ ":LLVMPowerPCCodeGen" ]
17+
args = [ "-gen-fast-isel" ]
18+
td_file = "PPC.td"
19+
}
20+
21+
static_library("LLVMPowerPCCodeGen") {
22+
deps = [
23+
":PPCGenCallingConv",
24+
":PPCGenDAGISel",
25+
":PPCGenFastISel",
26+
"InstPrinter",
27+
"MCTargetDesc",
28+
"TargetInfo",
29+
"//llvm/include/llvm/Config:llvm-config",
30+
"//llvm/lib/Analysis",
31+
"//llvm/lib/CodeGen",
32+
"//llvm/lib/CodeGen/AsmPrinter",
33+
"//llvm/lib/CodeGen/SelectionDAG",
34+
"//llvm/lib/IR",
35+
"//llvm/lib/MC",
36+
"//llvm/lib/Support",
37+
"//llvm/lib/Target",
38+
"//llvm/lib/Transforms/Utils",
39+
]
40+
include_dirs = [ "." ]
41+
sources = [
42+
"PPCBoolRetToInt.cpp",
43+
"PPCAsmPrinter.cpp",
44+
"PPCBranchSelector.cpp",
45+
"PPCBranchCoalescing.cpp",
46+
"PPCCCState.cpp",
47+
"PPCCTRLoops.cpp",
48+
"PPCHazardRecognizers.cpp",
49+
"PPCInstrInfo.cpp",
50+
"PPCISelDAGToDAG.cpp",
51+
"PPCISelLowering.cpp",
52+
"PPCEarlyReturn.cpp",
53+
"PPCFastISel.cpp",
54+
"PPCFrameLowering.cpp",
55+
"PPCLoopPreIncPrep.cpp",
56+
"PPCMCInstLower.cpp",
57+
"PPCMachineFunctionInfo.cpp",
58+
"PPCMIPeephole.cpp",
59+
"PPCRegisterInfo.cpp",
60+
"PPCQPXLoadSplat.cpp",
61+
"PPCSubtarget.cpp",
62+
"PPCTargetMachine.cpp",
63+
"PPCTargetObjectFile.cpp",
64+
"PPCTargetTransformInfo.cpp",
65+
"PPCTOCRegDeps.cpp",
66+
"PPCTLSDynamicCall.cpp",
67+
"PPCVSXCopy.cpp",
68+
"PPCReduceCRLogicals.cpp",
69+
"PPCVSXFMAMutate.cpp",
70+
"PPCVSXSwapRemoval.cpp",
71+
"PPCExpandISEL.cpp",
72+
"PPCPreEmitPeephole.cpp",
73+
]
74+
}
75+
76+
# This is a bit different from most build files: Due to this group
77+
# having the directory's name, "//llvm/lib/Target/PowerPC" will refer to this
78+
# target, which pulls in the code in this directory *and all subdirectories*.
79+
# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
80+
# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
81+
# different behavior.
82+
group("PowerPC") {
83+
deps = [
84+
":LLVMPowerPCCodeGen",
85+
"AsmParser",
86+
"Disassembler",
87+
"InstPrinter",
88+
"MCTargetDesc",
89+
"TargetInfo",
90+
]
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenDisassemblerTables") {
4+
visibility = [ ":Disassembler" ]
5+
args = [ "-gen-disassembler" ]
6+
td_file = "../PPC.td"
7+
}
8+
9+
static_library("Disassembler") {
10+
output_name = "LLVMPowerPCDisassembler"
11+
deps = [
12+
":PPCGenDisassemblerTables",
13+
"//llvm/lib/MC/MCDisassembler",
14+
"//llvm/lib/Support",
15+
"//llvm/lib/Target/PowerPC/MCTargetDesc",
16+
"//llvm/lib/Target/PowerPC/TargetInfo",
17+
]
18+
include_dirs = [ ".." ]
19+
sources = [
20+
"PPCDisassembler.cpp",
21+
]
22+
}
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenAsmWriter") {
4+
visibility = [ ":InstPrinter" ]
5+
args = [ "-gen-asm-writer" ]
6+
td_file = "../PPC.td"
7+
}
8+
9+
static_library("InstPrinter") {
10+
output_name = "LLVMPowerPCAsmPrinter"
11+
deps = [
12+
":PPCGenAsmWriter",
13+
"//llvm/lib/MC",
14+
"//llvm/lib/Support",
15+
16+
# MCTargetDesc depends on InstPrinter, so we can't depend on the full
17+
# MCTargetDesc target here: it would form a cycle.
18+
"//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
19+
]
20+
include_dirs = [ ".." ]
21+
sources = [
22+
"PPCInstPrinter.cpp",
23+
]
24+
}
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenInstrInfo") {
4+
visibility = [ ":tablegen" ]
5+
args = [ "-gen-instr-info" ]
6+
td_file = "../PPC.td"
7+
}
8+
9+
tablegen("PPCGenMCCodeEmitter") {
10+
visibility = [ ":tablegen" ]
11+
args = [ "-gen-emitter" ]
12+
td_file = "../PPC.td"
13+
}
14+
15+
tablegen("PPCGenRegisterInfo") {
16+
visibility = [ ":tablegen" ]
17+
args = [ "-gen-register-info" ]
18+
td_file = "../PPC.td"
19+
}
20+
21+
tablegen("PPCGenSubtargetInfo") {
22+
visibility = [ ":tablegen" ]
23+
args = [ "-gen-subtarget" ]
24+
td_file = "../PPC.td"
25+
}
26+
27+
group("tablegen") {
28+
visibility = [
29+
":MCTargetDesc",
30+
"../InstPrinter",
31+
"../TargetInfo",
32+
]
33+
public_deps = [
34+
":PPCGenInstrInfo",
35+
":PPCGenMCCodeEmitter",
36+
":PPCGenRegisterInfo",
37+
":PPCGenSubtargetInfo",
38+
]
39+
}
40+
41+
static_library("MCTargetDesc") {
42+
output_name = "LLVMPowerPCDesc"
43+
public_deps = [
44+
":tablegen",
45+
]
46+
deps = [
47+
"//llvm/lib/MC",
48+
"//llvm/lib/Support",
49+
"//llvm/lib/Target/PowerPC/InstPrinter",
50+
"//llvm/lib/Target/PowerPC/TargetInfo",
51+
]
52+
include_dirs = [ ".." ]
53+
sources = [
54+
"PPCAsmBackend.cpp",
55+
"PPCMCTargetDesc.cpp",
56+
"PPCMCAsmInfo.cpp",
57+
"PPCMCCodeEmitter.cpp",
58+
"PPCMCExpr.cpp",
59+
"PPCPredicates.cpp",
60+
"PPCMachObjectWriter.cpp",
61+
"PPCELFObjectWriter.cpp",
62+
]
63+
}
64+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
static_library("TargetInfo") {
2+
output_name = "LLVMPowerPCInfo"
3+
deps = [
4+
"//llvm/lib/Support",
5+
6+
# MCTargetDesc depends on TargetInfo, so we can't depend on the full
7+
# MCTargetDesc target here: it would form a cycle.
8+
"//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
9+
]
10+
include_dirs = [ ".." ]
11+
sources = [
12+
"PowerPCTargetInfo.cpp",
13+
]
14+
}
15+

‎llvm/utils/gn/secondary/llvm/lib/Target/targets.gni

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if (llvm_targets_to_build == "host") {
1010
llvm_targets_to_build = [ "AArch64" ]
1111
} else if (host_cpu == "arm") {
1212
llvm_targets_to_build = [ "ARM" ]
13+
} else if (host_cpu == "pcc" || host_cpu == "pcc64") {
14+
llvm_targets_to_build = [ "PowerPC" ]
1315
} else if (host_cpu == "x86" || host_cpu == "x64") {
1416
llvm_targets_to_build = [ "X86" ]
1517
} else {
@@ -20,6 +22,7 @@ if (llvm_targets_to_build == "host") {
2022
llvm_targets_to_build = [
2123
"AArch64",
2224
"ARM",
25+
"PowerPC",
2326
"WebAssembly",
2427
"X86",
2528
]
@@ -29,13 +32,16 @@ if (llvm_targets_to_build == "host") {
2932
# and remember which targets are built.
3033
llvm_build_AArch64 = false
3134
llvm_build_ARM = false
35+
llvm_build_PowerPC = false
3236
llvm_build_WebAssembly = false
3337
llvm_build_X86 = false
3438
foreach(target, llvm_targets_to_build) {
3539
if (target == "AArch64") {
3640
llvm_build_AArch64 = true
3741
} else if (target == "ARM") {
3842
llvm_build_ARM = true
43+
} else if (target == "PowerPC") {
44+
llvm_build_PowerPC = true
3945
} else if (target == "WebAssembly") {
4046
llvm_build_WebAssembly = true
4147
} else if (target == "X86") {
@@ -51,6 +57,8 @@ if (host_cpu == "arm64") {
5157
native_target = "AArch64"
5258
} else if (host_cpu == "arm") {
5359
native_target = "ARM"
60+
} else if (host_cpu == "pcc" || host_cpu == "pcc64") {
61+
native_target = [ "PowerPC" ]
5462
} else if (host_cpu == "x86" || host_cpu == "x64") {
5563
native_target = "X86"
5664
} else {

‎llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ static_library("lib") {
55
deps = [
66
"//llvm/lib/Analysis",
77
"//llvm/lib/CodeGen",
8+
"//llvm/lib/CodeGen/GlobalISel",
89
"//llvm/lib/ExecutionEngine",
910
"//llvm/lib/ExecutionEngine/MCJIT",
1011
"//llvm/lib/IR",
@@ -31,10 +32,12 @@ static_library("lib") {
3132
"Uops.cpp",
3233
]
3334

34-
# FIXME: Add this once llvm/lib/Target/AArch64 exists.
35-
#if (llvm_build_AArch64) {
36-
# deps += [ "AArch64" ]
37-
#}
35+
if (llvm_build_AArch64) {
36+
deps += [ "AArch64" ]
37+
}
38+
if (llvm_build_PowerPC) {
39+
deps += [ "PowerPC" ]
40+
}
3841
if (llvm_build_X86) {
3942
deps += [ "X86" ]
4043
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import("//llvm/utils/TableGen/tablegen.gni")
2+
3+
tablegen("PPCGenExegesis") {
4+
args = [ "-gen-exegesis" ]
5+
td_file = "//llvm/lib/Target/PowerPC/PPC.td"
6+
}
7+
8+
static_library("PowerPC") {
9+
output_name = "LLVMExegesisPowerPC"
10+
deps = [
11+
":PPCGenExegesis",
12+
13+
# Exegesis reaches inside the Target/PowerPC tablegen internals and must
14+
# depend on these Target/PowerPC-internal build targets.
15+
"//llvm/lib/Target/PowerPC/MCTargetDesc",
16+
]
17+
sources = [
18+
"Target.cpp",
19+
]
20+
include_dirs = [ "//llvm/lib/Target/PowerPC" ]
21+
}

‎llvm/utils/gn/secondary/llvm/unittests/BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ group("unittests") {
5757
if (llvm_build_WebAssembly) {
5858
deps += [ "Target/WebAssembly:WebAssemblyTests" ]
5959
}
60+
if (llvm_build_PowerPC) {
61+
deps += [ "tools/llvm-exegesis/PowerPC:LLVMExegesisPowerPCTests" ]
62+
}
6063
if (llvm_build_X86) {
6164
deps += [ "tools/llvm-exegesis/X86:LLVMExegesisX86Tests" ]
6265
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import("//llvm/utils/unittest/unittest.gni")
2+
3+
unittest("LLVMExegesisPowerPCTests") {
4+
deps = [
5+
"//llvm/lib/DebugInfo/Symbolize",
6+
"//llvm/lib/MC",
7+
"//llvm/lib/MC/MCParser",
8+
"//llvm/lib/Object",
9+
"//llvm/lib/Support",
10+
"//llvm/lib/Target/PowerPC",
11+
12+
# Exegesis reaches inside the Target/PowerPC tablegen internals and must
13+
# depend on these Target/PowerPC-internal build targets.
14+
"//llvm/lib/Target/PowerPC/MCTargetDesc",
15+
"//llvm/tools/llvm-exegesis/lib",
16+
"//llvm/tools/llvm-exegesis/lib/PowerPC",
17+
]
18+
include_dirs = [
19+
"//llvm/lib/Target/PowerPC",
20+
"//llvm/tools/llvm-exegesis/lib",
21+
]
22+
sources = [
23+
"AnalysisTest.cpp",
24+
"TargetTest.cpp",
25+
]
26+
}

0 commit comments

Comments
 (0)
Please sign in to comment.