Index: llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn +++ llvm/utils/gn/secondary/llvm/lib/Target/ARM/BUILD.gn @@ -103,7 +103,7 @@ } # 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 Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/AsmParser/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/AsmParser/BUILD.gn @@ -0,0 +1,23 @@ +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", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/BUILD.gn @@ -0,0 +1,91 @@ +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", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/Disassembler/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/Disassembler/BUILD.gn @@ -0,0 +1,23 @@ +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", + ] +} + Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/InstPrinter/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/InstPrinter/BUILD.gn @@ -0,0 +1,25 @@ +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", + ] +} + Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/MCTargetDesc/BUILD.gn @@ -0,0 +1,64 @@ +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", + ] +} + Index: llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/PowerPC/TargetInfo/BUILD.gn @@ -0,0 +1,15 @@ +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", + ] +} + Index: llvm/utils/gn/secondary/llvm/lib/Target/targets.gni =================================================================== --- llvm/utils/gn/secondary/llvm/lib/Target/targets.gni +++ llvm/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -10,6 +10,8 @@ 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 { @@ -20,6 +22,7 @@ llvm_targets_to_build = [ "AArch64", "ARM", + "PowerPC", "X86", ] } @@ -28,12 +31,15 @@ # and remember which targets are built. llvm_build_AArch64 = false llvm_build_ARM = false +llvm_build_PowerPC = false llvm_build_X86 = false foreach(target, llvm_targets_to_build) { if (target == "AArch64") { llvm_build_AArch64 = true } else if (target == "ARM") { llvm_build_ARM = true + } else if (target == "PowerPC") { + llvm_build_PowerPC = true } else if (target == "X86") { llvm_build_X86 = true } else { @@ -47,6 +53,8 @@ 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 { Index: llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn +++ llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/BUILD.gn @@ -5,6 +5,7 @@ deps = [ "//llvm/lib/Analysis", "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/GlobalISel", "//llvm/lib/ExecutionEngine", "//llvm/lib/ExecutionEngine/MCJIT", "//llvm/lib/IR", @@ -31,10 +32,12 @@ "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" ] } Index: llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/PowerPC/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/tools/llvm-exegesis/lib/PowerPC/BUILD.gn @@ -0,0 +1,21 @@ +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" ] +} Index: llvm/utils/gn/secondary/llvm/unittests/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/unittests/BUILD.gn +++ llvm/utils/gn/secondary/llvm/unittests/BUILD.gn @@ -54,6 +54,9 @@ if (llvm_build_ARM) { deps += [ "tools/llvm-exegesis/ARM:LLVMExegesisARMTests" ] } + if (llvm_build_PowerPC) { + deps += [ "tools/llvm-exegesis/PowerPC:LLVMExegesisPowerPCTests" ] + } if (llvm_build_X86) { deps += [ "tools/llvm-exegesis/X86:LLVMExegesisX86Tests" ] } Index: llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/PowerPC/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/unittests/tools/llvm-exegesis/PowerPC/BUILD.gn @@ -0,0 +1,26 @@ +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", + ] +}