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
}
# This is a bit different from most build files: Due to this group
-# having the directory's name, "//llvm/lib/Target/AArch64" will refer to this
+# having the directory's name, "//llvm/lib/Target/ARM" will refer to this
# target, which pulls in the code in this directory *and all subdirectories*.
# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenAsmMatcher") {
+ visibility = [ ":AsmParser" ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../PPC.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMPowerPCAsmParser"
+ deps = [
+ ":PPCGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/PowerPC/MCTargetDesc",
+ "//llvm/lib/Target/PowerPC/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "PPCAsmParser.cpp",
+ ]
+}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenCallingConv") {
+ visibility = [ ":LLVMPowerPCCodeGen" ]
+ args = [ "-gen-callingconv" ]
+ td_file = "PPC.td"
+}
+
+tablegen("PPCGenDAGISel") {
+ visibility = [ ":LLVMPowerPCCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "PPC.td"
+}
+
+tablegen("PPCGenFastISel") {
+ visibility = [ ":LLVMPowerPCCodeGen" ]
+ args = [ "-gen-fast-isel" ]
+ td_file = "PPC.td"
+}
+
+static_library("LLVMPowerPCCodeGen") {
+ deps = [
+ ":PPCGenCallingConv",
+ ":PPCGenDAGISel",
+ ":PPCGenFastISel",
+ "InstPrinter",
+ "MCTargetDesc",
+ "TargetInfo",
+ "//llvm/include/llvm/Config:llvm-config",
+ "//llvm/lib/Analysis",
+ "//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/AsmPrinter",
+ "//llvm/lib/CodeGen/SelectionDAG",
+ "//llvm/lib/IR",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target",
+ "//llvm/lib/Transforms/Utils",
+ ]
+ include_dirs = [ "." ]
+ sources = [
+ "PPCBoolRetToInt.cpp",
+ "PPCAsmPrinter.cpp",
+ "PPCBranchSelector.cpp",
+ "PPCBranchCoalescing.cpp",
+ "PPCCCState.cpp",
+ "PPCCTRLoops.cpp",
+ "PPCHazardRecognizers.cpp",
+ "PPCInstrInfo.cpp",
+ "PPCISelDAGToDAG.cpp",
+ "PPCISelLowering.cpp",
+ "PPCEarlyReturn.cpp",
+ "PPCFastISel.cpp",
+ "PPCFrameLowering.cpp",
+ "PPCLoopPreIncPrep.cpp",
+ "PPCMCInstLower.cpp",
+ "PPCMachineFunctionInfo.cpp",
+ "PPCMIPeephole.cpp",
+ "PPCRegisterInfo.cpp",
+ "PPCQPXLoadSplat.cpp",
+ "PPCSubtarget.cpp",
+ "PPCTargetMachine.cpp",
+ "PPCTargetObjectFile.cpp",
+ "PPCTargetTransformInfo.cpp",
+ "PPCTOCRegDeps.cpp",
+ "PPCTLSDynamicCall.cpp",
+ "PPCVSXCopy.cpp",
+ "PPCReduceCRLogicals.cpp",
+ "PPCVSXFMAMutate.cpp",
+ "PPCVSXSwapRemoval.cpp",
+ "PPCExpandISEL.cpp",
+ "PPCPreEmitPeephole.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/PowerPC" will refer to this
+# target, which pulls in the code in this directory *and all subdirectories*.
+# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
+# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
+# different behavior.
+group("PowerPC") {
+ deps = [
+ ":LLVMPowerPCCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "InstPrinter",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../PPC.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMPowerPCDisassembler"
+ deps = [
+ ":PPCGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/PowerPC/MCTargetDesc",
+ "//llvm/lib/Target/PowerPC/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "PPCDisassembler.cpp",
+ ]
+}
+
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenAsmWriter") {
+ visibility = [ ":InstPrinter" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../PPC.td"
+}
+
+static_library("InstPrinter") {
+ output_name = "LLVMPowerPCAsmPrinter"
+ deps = [
+ ":PPCGenAsmWriter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+
+ # MCTargetDesc depends on InstPrinter, so we can't depend on the full
+ # MCTargetDesc target here: it would form a cycle.
+ "//llvm/lib/Target/PowerPC/MCTargetDesc:tablegen",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "PPCInstPrinter.cpp",
+ ]
+}
+
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenInstrInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../PPC.td"
+}
+
+tablegen("PPCGenMCCodeEmitter") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../PPC.td"
+}
+
+tablegen("PPCGenRegisterInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../PPC.td"
+}
+
+tablegen("PPCGenSubtargetInfo") {
+ visibility = [ ":tablegen" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../PPC.td"
+}
+
+group("tablegen") {
+ visibility = [
+ ":MCTargetDesc",
+ "../InstPrinter",
+ "../TargetInfo",
+ ]
+ public_deps = [
+ ":PPCGenInstrInfo",
+ ":PPCGenMCCodeEmitter",
+ ":PPCGenRegisterInfo",
+ ":PPCGenSubtargetInfo",
+ ]
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMPowerPCDesc"
+ public_deps = [
+ ":tablegen",
+ ]
+ deps = [
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/PowerPC/InstPrinter",
+ "//llvm/lib/Target/PowerPC/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "PPCAsmBackend.cpp",
+ "PPCMCTargetDesc.cpp",
+ "PPCMCAsmInfo.cpp",
+ "PPCMCCodeEmitter.cpp",
+ "PPCMCExpr.cpp",
+ "PPCPredicates.cpp",
+ "PPCMachObjectWriter.cpp",
+ "PPCELFObjectWriter.cpp",
+ ]
+}
+
--- /dev/null
+static_library("TargetInfo") {
+ output_name = "LLVMPowerPCInfo"
+ deps = [
+ "//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 = [ ".." ]
+ sources = [
+ "PowerPCTargetInfo.cpp",
+ ]
+}
+
llvm_targets_to_build = [ "AArch64" ]
} else if (host_cpu == "arm") {
llvm_targets_to_build = [ "ARM" ]
+ } else if (host_cpu == "pcc" || host_cpu == "pcc64") {
+ llvm_targets_to_build = [ "PowerPC" ]
} else if (host_cpu == "x86" || host_cpu == "x64") {
llvm_targets_to_build = [ "X86" ]
} else {
llvm_targets_to_build = [
"AArch64",
"ARM",
+ "PowerPC",
"WebAssembly",
"X86",
]
# and remember which targets are built.
llvm_build_AArch64 = false
llvm_build_ARM = false
+llvm_build_PowerPC = false
llvm_build_WebAssembly = false
llvm_build_X86 = false
foreach(target, llvm_targets_to_build) {
llvm_build_AArch64 = true
} else if (target == "ARM") {
llvm_build_ARM = true
+ } else if (target == "PowerPC") {
+ llvm_build_PowerPC = true
} else if (target == "WebAssembly") {
llvm_build_WebAssembly = true
} else if (target == "X86") {
native_target = "AArch64"
} else if (host_cpu == "arm") {
native_target = "ARM"
+} else if (host_cpu == "pcc" || host_cpu == "pcc64") {
+ native_target = [ "PowerPC" ]
} else if (host_cpu == "x86" || host_cpu == "x64") {
native_target = "X86"
} else {
deps = [
"//llvm/lib/Analysis",
"//llvm/lib/CodeGen",
+ "//llvm/lib/CodeGen/GlobalISel",
"//llvm/lib/ExecutionEngine",
"//llvm/lib/ExecutionEngine/MCJIT",
"//llvm/lib/IR",
"Uops.cpp",
]
- # FIXME: Add this once llvm/lib/Target/AArch64 exists.
- #if (llvm_build_AArch64) {
- # deps += [ "AArch64" ]
- #}
+ if (llvm_build_AArch64) {
+ deps += [ "AArch64" ]
+ }
+ if (llvm_build_PowerPC) {
+ deps += [ "PowerPC" ]
+ }
if (llvm_build_X86) {
deps += [ "X86" ]
}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("PPCGenExegesis") {
+ args = [ "-gen-exegesis" ]
+ td_file = "//llvm/lib/Target/PowerPC/PPC.td"
+}
+
+static_library("PowerPC") {
+ output_name = "LLVMExegesisPowerPC"
+ deps = [
+ ":PPCGenExegesis",
+
+ # Exegesis reaches inside the Target/PowerPC tablegen internals and must
+ # depend on these Target/PowerPC-internal build targets.
+ "//llvm/lib/Target/PowerPC/MCTargetDesc",
+ ]
+ sources = [
+ "Target.cpp",
+ ]
+ include_dirs = [ "//llvm/lib/Target/PowerPC" ]
+}
if (llvm_build_WebAssembly) {
deps += [ "Target/WebAssembly:WebAssemblyTests" ]
}
+ if (llvm_build_PowerPC) {
+ deps += [ "tools/llvm-exegesis/PowerPC:LLVMExegesisPowerPCTests" ]
+ }
if (llvm_build_X86) {
deps += [ "tools/llvm-exegesis/X86:LLVMExegesisX86Tests" ]
}
--- /dev/null
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("LLVMExegesisPowerPCTests") {
+ deps = [
+ "//llvm/lib/DebugInfo/Symbolize",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Object",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/PowerPC",
+
+ # Exegesis reaches inside the Target/PowerPC tablegen internals and must
+ # depend on these Target/PowerPC-internal build targets.
+ "//llvm/lib/Target/PowerPC/MCTargetDesc",
+ "//llvm/tools/llvm-exegesis/lib",
+ "//llvm/tools/llvm-exegesis/lib/PowerPC",
+ ]
+ include_dirs = [
+ "//llvm/lib/Target/PowerPC",
+ "//llvm/tools/llvm-exegesis/lib",
+ ]
+ sources = [
+ "AnalysisTest.cpp",
+ "TargetTest.cpp",
+ ]
+}